" The functions Hold data and Set data is used when you want to create a group of objects that contain the same data. The function Hold data can be used to create data that can be changed, for example if you wish to create multiple objects with slight variation in the field values (Sales order or Purchase order) then the function Hold data can be used. If you wish to create multiple objects with exactly the same data without changing any of the filed values then SET data can be used. To hold data on the screen you need to first enter the data in the field and then choose User Profile from the Systems Menu. Now choose Hold data. The data that you hold on the screen can be changed. In case if you wish to hold data on the screen without changing it then select SET data. This way the data will be held but you will not be able to change the contents of the individual fields. You can delete the Data that is held. To do this select User profile from the Systems menu and select the option Delete data. Once the delete Data option is selected no data will be displayed the next time you visit the screen. You may want to work in more than one screen, and would like to store data in each screen, to do this you can press Ctrl+S or click on the save icon while moving between screens. You can also Cancel the data that you have just entered on the screen. To do this press the cancel button. Please note that when using HOLD data and SET data options, the required/Mandatory fields on the screen cannot be ignored. The correct values should be entered in these fields before proceeding to the next screen. Using the menus and functions you can go to the other screens within your task, as well as in related tasks. Check the Goto Extras and Environment menus in the Menu bar to find out the other screens available within your task and related tasks. Depending upon the task the contents also change. "
"The flow of a program is determined by a sequence of screens in a dialog transaction. The screens that are called within a transaction, must belong to a single ABAP program, usually a module pool (Type M). You have to use the transaction maintenance transaction (SE93) to create a dialog transaction. Once you have entered a transaction code and a short description, chose transaction type program and screen. Then enter data on the next screen as required. The transaction code in a dialog program must be linked to the number of its initial screen. Finally enter this number in the screen number field."
If you wish to SUBMIT a program you can do so by using the SUBMIT statement or you can use the following function module. Once the called program executes the control is returned to the calling program.
RZL_SUBMIT
Please find the code below.
REPORT ZEX_FUNCCALLPROG .
Parameters: p_prog like sy-repid.
CALL FUNCTION 'RZL_SUBMIT' EXPORTING REPID = p_prog .
If you wish to retrieve the selection Parameters of a report and print them at the end of the report then you can use the following function Module.
RS_COVERPAGE_SELECTIONS
To use this Function Module you need to create a variant for the the report. There can be multiple variants for a single report, but the selection screen will get printed fro the one that is used currently for running the report.
Please note that code related to this function module is marked in Brown.
REPORT ZEX_PAYMENTDETAILS1.
* Tables declaration TABLES:bsak, "Accounting: Secondary Index for Vendors (Cleared Items) payr, "Payment Medium File lfa1. "Vendor Master (General Section)
TYPE-POOLS : slis. * Type Declaration TYPES : BEGIN OF etab, bukrs LIKE bsak-bukrs, augdt LIKE bsak-augdt, xblnr LIKE bsak-xblnr, belnr LIKE bsak-belnr, bldat LIKE bsak-bldat, lifnr LIKE bsak-lifnr, name1 LIKE lfa1-name1, augb1 LIKE bsak-augbl, rwbtr LIKE payr-rwbtr, waers LIKE payr-waers, chect LIKE payr-chect, zaldt LIKE payr-zaldt, hbkid LIKE payr-hbkid, END OF etab. * Internal Tables DATA : tab_etab TYPE STANDARD TABLE OF etab, wa_etab TYPE etab, d_prog like sy-repid.
Data: Begin of int_infotab occurs 0, Field1(100), End of int_infotab.
* Data Declaration DATA: wa_fieldcat TYPE slis_fieldcat_alv, it_fieldcat TYPE slis_t_fieldcat_alv, wa_event TYPE slis_alv_event, it_events TYPE slis_t_event, wa_line TYPE slis_listheader, it_line TYPE slis_t_listheader, wa_sort TYPE slis_sortinfo_alv, it_sort TYPE slis_t_sortinfo_alv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS s_ccode FOR bsak-bukrs ."OBLIGATORY. SELECTION-SCREEN SKIP 1. SELECT-OPTIONS s_pdate FOR bsak-augdt. SELECT-OPTIONS s_drence FOR bsak-xblnr.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select.
PERFORM build_fcat.
PERFORM display.
PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'H:\TESTSAP.xls'.
move: sy-repid to d_prog.
CALL FUNCTION 'RS_COVERPAGE_SELECTIONS' EXPORTING REPORT = d_prog VARIANT = sy-slset * NO_IMPORT = ' ' TABLES INFOTAB = int_infotab EXCEPTIONS ERROR_MESSAGE = 1 VARIANT_NOT_FOUND = 2 OTHERS = 3 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
ENDFORM.
*---------------------------------------------------------------------* * FORM select * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* FORM select.
SELECT bsak~bukrs bsak~augdt bsak~xblnr bsak~belnr bsak~bldat bsak~lifnr bsak~bschl bsak~xstov payr~rwbtr payr~waers payr~chect payr~zaldt payr~hbkid FROM bsak INNER JOIN lfa1 ON bsak~lifnr = lfa1~lifnr INNER JOIN payr ON bsak~augbl = payr~vblnr AND bsak~gjahr = payr~gjahr INTO TABLE tab_etab WHERE bukrs IN s_ccode AND augdt IN s_pdate AND xblnr IN s_drence AND bsak~bschl = 31 AND bsak~xstov = ''.
Always specify your conditions in the Where-clause instead of checking
them yourself with check statements. The database system can then use an index
(if possible) and the network load is considerably less.
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.