‎2007 May 24 11:15 AM
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
‎2007 May 24 11:37 AM
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
‎2007 May 24 11:37 AM
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
‎2007 May 24 11:43 AM
Hi Pavan
Declare individually the fileds int he internal table i think it works
rewards if helpfull
Regards
Pavan
‎2007 May 24 11:46 AM
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