Application Development 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: 

Only print Last PO Line item Text instead of all of the item text

emylah
Explorer
0 Kudos
198

Hi Experts,

I got confusing situation and need your help.In sales order, there are item lines and in that selected item lines, there will be multiple text data. I tried to print but it just print only last of the item text row. got confused regarding the internal table loop.

Below is my code.

CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lw_stxhh-tdid
language = sy-langu
name = lw_stxhh-tdname
object = lw_stxhh-tdobject
TABLES
lines = it_line
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.

CASE SY-SUBRC.
WHEN 0. "Get characters start from 10 and convert to number format
LOOP AT it_line INTO lw_line.
convertno = lw_line-tdline.
MOVE convertno+9(20) to lt_return-text_del_qty.
ENDLOOP.
WHEN OTHERS. "If no value is found in item text, get VBEP-WMENG as EDD quantity
SELECT SINGLE wmeng
INTO lw_vbep-wmeng
FROM vbep
WHERE vbeln = lt_vbap-vbeln
AND posnr = lt_vbap-posnr.

MOVE lw_vbep-wmeng to quantity.
lw_line-tdline = quantity.
APPEND lw_line TO it_line.
LOOP AT it_line INTO lw_line.
lt_return-text_del_qty = lw_line-tdline.
ENDLOOP.
ENDCASE.

1 REPLY 1

thilakan_t
Participant
0 Kudos
142

You are looping it_line but not appending the data(lw_line-tdline) into any internal table. You have to append the data into lt_return inside the loop.