cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in passing a internal table to a sap script using a standard text

former_member190818
Active Contributor
0 Kudos

Hi,

I am facing a problem in passing an internal table from a subroutine pool to a sapscript.I am using a std text and populating it programatically using the function module save_text.I am reading this standard text in the sapscript using include statement.

The problem is,though the save_text updates the standard text with the new value in the program but when the include standard text statement is encountered in the sapscript,it reads the previous values stored on the standard text and not the updated data.

Once the program is completely executed the form prints the old data on the form.Each time it prints the previous data stored.

I have tried using explicit commit statement,wait and commit_text.None of them seemed to help.Is there anything that can be done regarding this?The include statements somehow seem to pick up the standard text much before the execution of the subroutine pool though the include statement is accessed only after that form routine is called...

Below is the code snippet and the sapscript statement for the same..

CONCATENATE l_date l_day l_time INTO W_TEXT-TDLINE SEPARATED BY c_par .

APPEND w_text TO t_text.

ENDLOOP.

check sy-subrc = 0.

  • Populate header info* Text object

w_header-tdobject = 'TEXT'.

  • Standard text name

w_header-tdname = 'Z_LDCORR_TIME_SCHEDULE'.

  • Text id

w_header-tdid = 'ST'.

  • Language

w_header-tdspras = 'E'.

w_header-MANDT = SY-MANDT.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = w_header

  • insert = 'X'

savemode_direct = 'X'

TABLES

lines = t_text

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5

.

IF sy-subrc EQ 0.

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

OBJECT = 'TEXT'

NAME = 'Z_LDCORR_TIME_SCHEDULE'

ID = 'ST'

LANGUAGE = 'E'

SAVEMODE_DIRECT = 'X'

KEEP = 'X'

  • LOCAL_CAT = ' '

  • IMPORTING

  • COMMIT_COUNT =

  • TABLES

  • T_OBJECT =

  • T_NAME =

  • T_ID =

  • T_LANGUAGE =

.

IF SY-SUBRC EQ 0.

COMMIT WORK AND WAIT.

WAIT UP TO 10 SECONDS.

ENDIF.

ENDIF.

In script:

INCLUDE Z_LDCORR_TIME_SCHEDULE OBJECT TEXT ID ST LANGUAGE EN

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Update will be done only once the transaction is fully executed, Even if u write the explicit commit statements.

U need update the text before triggering the form in a separate program or else Instead of using the Include for the standard text pass them to vairables in the program and get the values using external routines.If u know the rows in the T_TEXT, it will be easy to define that many vairables. if not it will be tuff.

Check function module WRITE_FORM_LINES to write the table to the script.