cancel
Showing results for 
Search instead for 
Did you mean: 

Dispaly standard text in SAP SCRIPT which content saved using SAVE_TEXT FM

pkb
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

pkb
Participant
0 Kudos

Thank You for your reply Suganya.

I have tried as you suggested. Even I have given waiting time up to 10 seconds. But text is not displaying in Print preview of SAP SCRIPT. Also the exact code for waiting is

WAIT UP TO 10 SECONDS.