Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Not able to upload multiple text lines using SAVE _TEXT

Former Member
0 Likes
1,088

Hi all,

I am trying to upload confirmation text (long text) for Order confirmation (IW41) using SAVE_TEXT function module.

The problem is that if there are 3 lines of text which are to be uploaded, only the last line gets saved in the text area. Here is the code which I have used for testing -

DATA: l_thead LIKE thead,

l_tline LIKE tline occurs 0 with header line.

*l_thead-TDOBJECT = 'AUFK'.

*l_thead-TDNAME = '213000080000160'.

*l_thead-TDID = 'KOPF'.

*l_thead-TDSPRAS = 'EN'.

*l_thead-tdtxtlines = 1.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

id = 'RMEL'

language = 'E'

name = '213000000330900000001'

object = 'AUFK'

IMPORTING

header = l_thead

TABLES

lines = l_tline

EXCEPTIONS

error_message = 1

OTHERS = 2.

l_tline-tdformat = '*'.

l_tline-tdline = 'PSHO 123'.

APPEND l_tline.

l_tline-tdformat = '*'.

l_tline-tdline = 'PSHO 358'.

APPEND l_tline.

clear l_tline.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

header = l_thead

  • INSERT = 'X'

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

tables

lines = l_tline

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

As seen from the code, the last text line ie PSHO 358 is seen in the order confirmation text. Please if anyone can provide any solution for this.

Shoma

Hi all,

I am trying to upload confirmation text (long text) for Order confirmation (IW41) using SAVE_TEXT function module.

The problem is that if there are 3 lines of text which are to be uploaded, only the last line gets saved in the text area. Here is the code which I have used for testing -

DATA: l_thead LIKE thead,

l_tline LIKE tline occurs 0 with header line.

*l_thead-TDOBJECT = 'AUFK'.

*l_thead-TDNAME = '213000080000160'.

*l_thead-TDID = 'KOPF'.

*l_thead-TDSPRAS = 'EN'.

*l_thead-tdtxtlines = 1.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

id = 'RMEL'

language = 'E'

name = '213000000330900000001'

object = 'AUFK'

IMPORTING

header = l_thead

TABLES

lines = l_tline

EXCEPTIONS

error_message = 1

OTHERS = 2.

l_tline-tdformat = '*'.

l_tline-tdline = 'PSHO 123'.

APPEND l_tline.

l_tline-tdformat = '*'.

l_tline-tdline = 'PSHO 358'.

APPEND l_tline.

clear l_tline.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

header = l_thead

  • INSERT = 'X'

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

tables

lines = l_tline

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

As seen from the code, the last text line ie PSHO 358 is seen in the order confirmation text. Please if anyone can provide any solution for this.

Shoma

4 REPLIES 4
Read only

Former Member
0 Likes
780

Hi

Check what you are passing in the Header while calling SAVE_TEXT.

Regards,

Raj

Read only

Clemenss
Active Contributor
0 Likes
780

Hi,

commit work is not enough because text is buffered in special areas. First use Function Module COMMIT_TEXT.

regards,

Clemens

Read only

Former Member
0 Likes
780

Hi,

Can you please try by passing the body of the internal table to the function module.

Thanks,

Rashmi

Read only

Clemenss
Active Contributor
0 Likes
780

Rashmi,

please!

The function is defined with a TABLES parameter - you can't transfer anything except the body.

Regards,

Clemens

You can write a small test program to proove your (and my) assumption.