on 11-05-2008 10:16 AM
I want to display one standard text content in SAP SCRIPT and want to store content of it during run time.
For that, first I have created one standard text using SO10.Named the standard text as Z_TEST_WRITE. Initially it was empty.
In my SAP SCRIPT, I try to display the content of the standard text using below given SAP SCRIPT code and report program. Although I am able to store text in Standard text
Z_TEST_WRITE but in first display of the SCRIPT it is not displaying against the include command of SAP SCRIPT. But when I see the content of Z_TEST_WRITE through SO10 transaction, I can see the content with new text which was previously empty.
Now if I do the same transaction newly (suppose second time), then text stored in standard text Z_TEST_WRITE is displaid against includes command of SAP SCRIPT.
My print program is a SAP STANDARD which one can be changed.
/: DEFINE &NAME& = ''
/: PERFORM TEST IN PROGRAM Z_SAVE_TEXT
/: CHANGING &NAME&
/: ENDPERFORM
<B>&NAME&</>
/: INCLUDE Z_TEST_WRITE OBJECT TEXT ID ST
REPORT Z_SAVE_TEXT.
FORM TEST TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA IT_HEADER LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: LS_HEADER LIKE THEAD,
LT_LINES TYPE STANDARD TABLE OF TLINE WITH HEADER LINE.
OUT_PAR-NAME = 'NAME'.
OUT_PAR-VALUE = 'Sample text for Test'.
APPEND OUT_PAR.
*-Populate Header Text details
LS_HEADER-TDOBJECT = 'TEXT'.
LS_HEADER-TDNAME = 'Z_TEST_WRITE'.
LS_HEADER-TDID = 'ST'.
LS_HEADER-TDSPRAS = SY-LANGU.
*-Populate details of Text
CONCATENATE 'Shipment No :' 'RM Ship No' INTO LT_LINES-TDLINE
SEPARATED BY SPACE.
LT_LINES-TDFORMAT = '*'.
APPEND LT_LINES.
CONCATENATE 'Bill of Lading:' '1234567' INTO LT_LINES-TDLINE
SEPARATED BY SPACE.
APPEND LT_LINES.
*-Save Text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = LS_HEADER
SAVEMODE_DIRECT = 'V'
TABLES
LINES = LT_LINES
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
COMMIT WORK and WAIT.
ENDFORM. "TEST
Hi,
If the text is getting displayed the second time, then this should be due to delay in saving the text.
After your COMMIT WORK AND WAIT in your report program, just put a WAIT FOR 2 SECS and check again.
Regards,
Suganya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.