Wednesday, August 1, 2007

SAP Function Modules - ABAP

FM to display number in words

REPORT ZZSPELLAMT.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : AMOUNT LIKE SPELL-NUMBER VALUE '1234510'.

PERFORM SPELL_AMT USING AMOUNT 'USD'.

WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.

FORM SPELL_AMT USING P_AMT P_WAERS.

CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = P_AMT
CURRENCY = P_WAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.

ENDFORM.

Wednesday, July 11, 2007

FullScreen ALV


Few features of Full Screen ALV:
•FS-ALV is much simpler to implement than the previous one.
• It provides a complete tool bar that allows a high level of flexibility at the end user level.
•The graphics as well as the logo printing on the header improves the layout of FS-ALV.
• The Grid wise display maintains the power full feature of data handling and best readability.
negative:
•On other hand Full screen ALV has limited events to handle with user actions.
• And only one FS-ALV can be drawn on a screen , where as multiple ALV grids were possible in Screen design ALV.


For controlling and implementing the FS-ALV we have to concentrate on few of the components as follows :
1.Selection of data.
2.Prepare Layout of display list.
3.Event handling.
4.Export all the prepared data to REUSE_ALV_GRID_DISPLAY.


The properties of the FS-ALV layout settings are defined at ‘INITIALIZATION’.

The same structure is exported to the ‘REUSE_ALV_GRID_DISPLAY’ to parameter is_layout .
The structure that is used for layout settings is of type ‘SLIS_LAYOUT_ALV’



The table to handle event is of type ‘SLIS_ALV_EVENT’.
SLIS_ALV_EVENT has 2 components :
1.Name(30) type C, “ Name is the event name
2.Form(30) type C. “ Form is the procedure name




Function module ‘REUSE_ALV_EVENTS_GET’ returns table of possible events for a list type into a internal table.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = rt_events.
Read table rt_event with key name and put the corresponding subroutine name in corresponding field of the event. As under :



Read table rt_event with key name and put the corresponding subroutine name in corresponding field of the event. As under :
read table rt_events with key name = slis_ev_top_of_page into ls_event.
if sy-subrc = 0.
move g_top_of_page to ls_event-form.
append ls_event to rt_events.
endif.
Here slis_ev_top_of_page is a constant defined in type pool SLIS having value
‘TOP_OF_PAGE’. Also, g_top_of_page = ‘TOP_OF_PAGE’. A list or internal table is prepared having all the events and corresponding columns have the subroutine name that will be called on occurrence of the event.So same if performed for all events.

TOP_OF_PAGE event will call this subroutine.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
endform.


Now all the tables including layout , events as well as final data internal are exported to
'REUSE_ALV_GRID_DISPLAY'. And
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'ALV_BACKGROUND' "QBJ50
i_callback_program = g_repid
i_structure_name = 'SFLIGHT' “Structure for the list output
is_layout = gs_layout
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
* I_SCREEN_START_COLUMN = 0 "Use coordinates for
* I_SCREEN_START_LINE = 0 "display as dialog box
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
importing
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
tables
t_outtab = gt_outtab
exceptions
program_error = 1
others = 2.

Tuesday, July 10, 2007

SAP Query or Quick Viewer

Quick Viewer : SQ00

Or use SAP Query:
SQ01 SAP Query: Maintain queries
SQ02 SAP Query: Maintain InfoSet
SQ03 SAP Query: Maintain user groups

Step 1 : SQ03 - create user group > SAVE
Step 2 : Create infostet, include all the tables you want > SAVE
Step 3 : Use infoset and create a final query with selected selection screen fields and selected report out put fields.

Also it will generate a program in background, you can directly execute if required.

Refer urls :
http://help.sap.com/saphelp_nw04/helpdata/en/d2/cb3efb455611d189710000e8322d00/frameset.htm
www.olemiss.edu/projects/sap/SQ01_10_03.pdf

Monday, July 9, 2007

SAP List Viewer - ALV

SAP List Viewer : Implementation – Introduction Guide

Index

  1. Introduction of ALV
  2. Features of ALV
  3. Technical overview - Object Oriented
  4. Technical overview -ALV
  5. Events related to ALV
  6. Methods for handling ALV
  7. Implementation go thru
  8. Implementation Summary
  9. Appendix – A
  10. Appendix- B (Properties of the ALV Grid Control)
Download the Guide - PDF Format http://sap-it.wetpaint.com/page/ALV+Stuff

Introduction of ALV

The ALV Grid Control (ALV = SAP List Viewer) is a flexible tool for displaying lists. The tool provides common list operations as generic functions and can be enhanced by self-defined options.


As custom report writing results the output in plain list format and a very few events can be captured and dealt with using Selection Screen . The end had zero control on modifing the output .The hardcoded reports are very inflexible at the users end And small changes required enough programming efforts i.e more time and labour.


Considering all the features ALV grid control provides the best solution. ALV grid control captures the data and displays it , along with the options for the user to handle accordingly. As a complete toolbar is provided in the grid to act on the displayed data like SORT –Ascend. Or Descend. , Find/Search , Filter one or more Columns , Totals/Subtotals , print , Export data and user defined tools.The grid also provides a series of events that can be used to handle the users action and a max level of comfort is provided to the enduser.