2007 Jul 03 10:16 AM
hi all,
i had to delete entire row in the final output table inside a loop on condition that
T_output1-wt_acco ne 0.
wt_acco is contained in t_output1. how can i do that one can any body help me
LOOP AT T_BKPF.
MOVE T_BKPF-BLART TO T_OUTPUT_FINAL-BLART.
MOVE T_BKPF-BUDAT TO T_OUTPUT_FINAL-BUDAT.
MOVE T_BKPF-XBLNR TO T_OUTPUT_FINAL-XBLNR.
READ TABLE T_OUTPUT1 WITH KEY BELNR = T_BKPF-BELNR.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_OUTPUT1 TO T_OUTPUT_FINAL.
T_OUTPUT_FINAL-TDSAMOUNT = ( T_OUTPUT1-WT_QBSHH * T_OUTPUT1-ZWHT ) / T_OUTPUT1-ZTOT.
T_OUTPUT_FINAL-SURCHARGE = ( T_OUTPUT1-WT_QBSHH * T_OUTPUT1-ZSUR ) / T_OUTPUT1-ZTOT.
T_OUTPUT_FINAL-EDUCESS = ( T_OUTPUT1-WT_QBSHH * T_OUTPUT1-ZEDU ) / T_OUTPUT1-ZTOT.
ENDIF.
READ TABLE T_LFA1 WITH KEY LIFNR = T_OUTPUT1-WT_ACCO.
IF SY-SUBRC = 0.
MOVE T_LFA1-NAME1 TO T_OUTPUT_FINAL-NAME1.
MOVE T_LFA1-STDC1 TO T_OUTPUT_FINAL-STDC1.
APPEND T_OUTPUT_FINAL.
CLEAR T_OUTPUT_FINAL.
ENDIF.
endloop.
thanks and regards
siva
2007 Jul 03 10:20 AM
2007 Jul 03 10:20 AM
2007 Jul 03 10:20 AM
Hi Siva,
<b>Delete t_output1 where wt_acco ne 0.</b>
the above statement would work for U.
<b>Reward points if helpful.</b>
Kiran
2007 Jul 03 10:23 AM
Hi Siva.
You can use two different ways to achieve this.
First:
Check if your condition is fulfilled before appending the line, that is easy and faster than deleting rows afterwards.
So your code would be like:
....
READ TABLE T_OUTPUT1 WITH KEY BELNR = T_BKPF-BELNR.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_OUTPUT1 TO T_OUTPUT_FINAL.
* Additional check
IF t_output_final-wt_acco NE 0.
CONTINUE.
ENDIF.
Second option:
Directly delete relevant entries from t_output_final
DELETE t_output_final WHERE wt_acco NE 0.
Regards,
Timo
2007 Jul 03 10:23 AM
Hi
Don't append the row if that field is not 0
LOOP AT T_BKPF.
MOVE T_BKPF-BLART TO T_OUTPUT_FINAL-BLART.
MOVE T_BKPF-BUDAT TO T_OUTPUT_FINAL-BUDAT.
MOVE T_BKPF-XBLNR TO T_OUTPUT_FINAL-XBLNR.
READ TABLE T_OUTPUT1 WITH KEY BELNR = T_BKPF-BELNR.
IF SY-SUBRC = 0.
CHECK T_OUTPUT1-WT_ACCO = 0.
Max
2007 Jul 03 10:24 AM
loop at T_output1 where wt_acco ne 0 .
DELETE TABLE T_OUTPUT_FINAL WITH TABLE KEY wt_acco = wt_acco .
endloop .
reward points if it is usefull ....
Girish