Skip to Content
0
Apr 30, 2009 at 12:17 PM

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

34 Views

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