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

multiple line issue in sap script

Former Member
0 Likes
1,080

Hi All,

There is a window in the sap script.

The window consists of a text element and i am displaying 4 lines of text in that window.

Sap script:

/E Reason

AC &LINE&

In the source code, an internal table will have 5 text lines and those 5 lines should be reflected in sap script.

The source code as follows.....

loop at li_tline.

CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'

EXPORTING

NAME = 'LINE'

VALUE = li_tline-tdLINE.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'REASON'

WINDOW = 'REASON'

function = 'APPEND'.

endloop.

In final output, the last line of the internal table is reflacting..... Hope its getting over written each time in the loop.

How to make the code, so that i can reflect all the lines from internal table to the sap script....??????????????

Please help me, as this issue is very much urgent..........

Regards

Pavan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
680

Hi

Do like this.

declare 5 variables each of 80 char length.

data: v1(80), v2(80), v3(80), v4(80), v5(80).

Read the Internal table li_tline with index and move each line to different variables and write those variables in the script.

if not li_tline[] is initial.

read table li_tline index 1.

if sy-subrc = 0.

v1 = li_tline-tdline+0(80).

endif.

read table li_tline index 2.

if sy-subrc = 0.

v2 = li_tline-tdline+0(80).

endif.

read table li_tline index 3.

if sy-subrc = 0.

v3 = li_tline-tdline+0(80).

endif.

read table li_tline index 4.

if sy-subrc = 0.

v4 = li_tline-tdline+0(80).

endif.

read table li_tline index 5.

if sy-subrc = 0.

v5 = li_tline-tdline+0(80).

endif.

endif.

write the &V1& &V2& &V3& &V4& &V5& variables ins cript

Reward points if useful

Regards

Anji

3 REPLIES 3
Read only

Former Member
0 Likes
681

Hi

Do like this.

declare 5 variables each of 80 char length.

data: v1(80), v2(80), v3(80), v4(80), v5(80).

Read the Internal table li_tline with index and move each line to different variables and write those variables in the script.

if not li_tline[] is initial.

read table li_tline index 1.

if sy-subrc = 0.

v1 = li_tline-tdline+0(80).

endif.

read table li_tline index 2.

if sy-subrc = 0.

v2 = li_tline-tdline+0(80).

endif.

read table li_tline index 3.

if sy-subrc = 0.

v3 = li_tline-tdline+0(80).

endif.

read table li_tline index 4.

if sy-subrc = 0.

v4 = li_tline-tdline+0(80).

endif.

read table li_tline index 5.

if sy-subrc = 0.

v5 = li_tline-tdline+0(80).

endif.

endif.

write the &V1& &V2& &V3& &V4& &V5& variables ins cript

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
680

Hi Pavan

Declare individually the fileds int he internal table i think it works

rewards if helpfull

Regards

Pavan

Read only

Former Member
0 Likes
680

Hi Pavan ,

The loop will work only on a MAIN window.

if the window is any other then it overwrites at the same location.

You can move your TEXT ELEMENT to the MAIN WINDOW

then your Logic Will Work.

if it is not possible to use MAIN window ,then solution provided by Anji is the best option

Kindly reward Points if useful

Regards,

Gaurav