‎2007 Aug 23 7:06 PM
I am trying to fill the quantity value if it is blank by looking for a record with the key and putting it's value in it. the code is below but the part whee it says where order_qty > 0 is not working. It just hops out even if it is.
CLEAR: T_SCHED_DATA, T_QUANTITY_DATA.
REFRESH: T_SCHED_DATA, T_QUANTITY_DATA.
*
SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DSDEL_DATE REQ_DATE ORDER_QTY
INTO TABLE T_SCHED_DATA
FROM /BIC/AZSCH_O5400
FOR ALL ENTRIES IN DATA_PACKAGE
WHERE
DOC_NUMBER = DATA_PACKAGE-DOC_NUMBER AND
S_ORD_ITEM = DATA_PACKAGE-S_ORD_ITEM AND
SCHED_LINE = DATA_PACKAGE-SCHED_LINE.
SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DSDEL_DATE REQ_DATE ORDER_QTY
INTO TABLE T_QUANTITY_DATA
FROM /BIC/AZSCH_O5400
FOR ALL ENTRIES IN T_SCHED_DATA
WHERE
DOC_NUMBER = T_SCHED_DATA-VBELN AND
S_ORD_ITEM = T_SCHED_DATA-POSNR.
T_QUANTITY_DATA2[] = T_QUANTITY_DATA[].
sort t_quantity_data2 by vbeln posnr SCHED_LINE
ascending.
sort t_quantity_data by vbeln posnr SCHED_LINE
ascending.
loop at T_QUANTITY_DATA into LF_DATA
where order_qty > 0.
loop at T_QUANTITY_DATA2 into LF_DATA2
where
vbeln = LF_DATA-VBELN AND
posnr = LF_DATA-POSNR AND
DSDEL_DATE = LF_DATA-DSDEL_DATE AND
SCHED_LINE NE LF_DATA-SCHED_LINE and
order_qty = 0.
lf_data3 = lf_data2.
move LF_DATA-order_qty to lf_data3-order_qty.
append lf_data3 to T_QUANTITY_DATA3.
endloop.
endloop.
‎2007 Aug 23 7:30 PM
HI,
why dont you check with ur data... you say its going out of that loop.. do you think that this statment is not working.. There is not use in posting the same question again and again.. put a break point and check the data.. ur code is 100 correct...
Thanks
mahesh
‎2007 Aug 23 7:30 PM
HI,
why dont you check with ur data... you say its going out of that loop.. do you think that this statment is not working.. There is not use in posting the same question again and again.. put a break point and check the data.. ur code is 100 correct...
Thanks
mahesh
‎2007 Aug 23 7:39 PM
We did and had another developer look at it and it is not working and doing the exact same thing
thanks for your help
‎2007 Aug 23 7:40 PM
How is "order_qty" defined? It should be numeric type for your statement to work as expected.
‎2007 Aug 23 7:45 PM
‎2007 Aug 23 7:47 PM
Then it should work, put a breakpoint on the LOOP statement and see if there are any contents in the internal table. Also verify if you have any records with order_qty > 0.
‎2007 Aug 23 7:48 PM
See if your second loop is the one that is an issue, not the first loop.
‎2007 Aug 23 7:51 PM
loop at T_QUANTITY_DATA into LF_DATA
where <b>order_qty > 0.</b> <b> " when this is greater than zero</b>
loop at T_QUANTITY_DATA2 into LF_DATA2
where
vbeln = LF_DATA-VBELN AND
posnr = LF_DATA-POSNR AND
DSDEL_DATE = LF_DATA-DSDEL_DATE AND
SCHED_LINE NE LF_DATA-SCHED_LINE and
<b>order_qty = 0.</b> <b>" how can it be zero here</b>
lf_data3 = lf_data2.
move LF_DATA-order_qty to lf_data3-order_qty.
append lf_data3 to T_QUANTITY_DATA3.
endloop.
endloop.
‎2007 Aug 23 7:56 PM
It can be zero because we have several lines/document and only the qty is on 1 line so we want to fill the blanks with whatever line is not zero. the one loop looks at the one > 0 and finds a amtch based on the key with qty = o and we wnat to fill it with what is in lf_data-order_qty
‎2007 Aug 23 8:11 PM
its nothing to do with the logic... its only data problem... we cannot help it out..
‎2007 Aug 23 9:53 PM
I got it to work but now my last code I need to modify the current recod with the qty but it keeps appending to the table instead of going to that record and modifying.
loop at T_QUANTITY_DATA3[] into LF_DATA3.
read table T_QUANTITY_DATA4[] into lf_data4 with key
vbeln = LF_DATA3-VBELN
posnr = LF_DATA3-POSNR.
T_QUANTITY_DATA5 = T_QUANTITY_DATA3.
move lf_data4-order_qty to lf_data5-order_qty.
append lf_data5 to T_QUANTITY_DATA5.