2023 Nov 30 10:09 AM
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.
2023 Dec 01 4:58 PM
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.