‎2007 Jul 19 1:18 PM
‎2007 Jul 19 1:21 PM
Hi,
It is not a problem to print table data in the main window of the script. Here is an example code snippet.
Populate internal table
SELECT * FROM <dbtab>
INTO TABLE itab
WHERE.................
CALL FUNCTION 'OPEN_FORM'
...............................................
...............................................
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = ' '
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
ENDLOOP
CALL FUNCTION 'CLOSE_FORM'
.................................................
.................................................
In the script you can refer to this itab.
However the same process will not work for a variable window in script. This is because unlike the main window, whenever we call write_form FM for variable window, values are not mapped to script from print program immediately, but when
close_form/end_form FM is called. This means if we loop at an internal table from print progeam and call a variable window inside the loop, only the last row of internal table will be mapped to that variable window of the script.
For more info check this URL.
http://www.sap-img.com/sapscripts/faq-for-sap-scripts.htm
Regards
‎2007 Jul 19 1:25 PM
refer
<b>material regd script</b>
http://www.sap-img.com/sapscripts.htm
http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm
http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm
<b>transporting a script</b>
<b>to test a script</b>
regards,
srinivas
<b>*reward for useful answers*</b>