02-11-2018 7:38 AM
Hi, All Expert Abap.
Help me, How to select data from the table structure then issued in the internal table with the conditions.
example :
DATA: it_bill TYPE STANDARD TABLE OF ZRECEIPT WITH HEADER LINE,
wa_bill type ZRECEIPT.
SELECT
mseg~werks
mseg~lgort
mseg~mblnr
mseg~matnr
mseg~bwart
mseg~bwtar
mseg~menge
mseg~meins
mkpf~budat
makt~maktx
INTO CORRESPONDING FIELDS OF TABLE it_bill FROM mseg
INNER JOIN mkpf on mseg~mblnr = mkpf~mblnr
INNER JOIN makt on mseg~matnr = makt~matnr
WHERE mseg~werks = Plant and mseg~lgort = Sloc.
LOOP AT IT_BILL into wa_bill.
WRITE 😕 wa_bill-mblnr, wa_bill-matnr, wa_bill-bwart, wa_bill-bwtar, wa_bill-menge, wa_bill-meins, wa_bill-budat, wa_bill-maktx.
ENDLOOP.
At the time of debugging does not appear its data. Plz help me......
02-13-2018 8:48 AM
This code should work, however we can't see what input you are using. Check your 'Plant' and 'SLoc' input if you are not getting any data ...
Or are you just not 'seeing it correctly' in Debugging. As you are using a Table "WITH HEADER LINE" you should look at "IT_BILL[]" :
IT_BILL[1]-MBLNR = <first_value> ....
IT_BILL[2]-MBLNR = <second_value> ...
However, this code is not optimal and some pointers would be :
Again, you should be able to get this to work, but it is far from optimal and I would suggest Optimizing the Query / Report. One resource would be the use of Trx."SLIN" to Evaluate your Development running all Checks ...