05-12-2008 4:19 PM
Hi all,
I have two internal table it_vbak, it_vbap. I want to delete the VBEln from it_vbap where all line items of the NETWR is 0.
if any one of the line item of the netwr has value , it has to be come out. it should be there. I need to delete the VBEN from VBAp when all the line items of value nerwr is 0.
regards,
Ajay
05-12-2008 4:23 PM
hi check this...
loop at it_vbap where vbeln = it_vbak-vbeln.
delete it_vbap where NETWR eq 0.
endloop.
regards,
venkat
05-12-2008 4:23 PM
Hi Ajay,
I sugest u to filter these records in select itself instead of selecting and deleting.
CHECK NOT i_vbak[] IS INITIAL.
SELECT f1 f2 f3..
FROM vbap
INTO TABLE i_vbap
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln + all ur conditions
AND netwr GT '0.00'.
If u really want to delete then delete as a bunch
DELETE i_vbap WHERE netwr EQ '0.00'.
Thanks,
Vinod.
Edited by: Vinod Kumar Vemuru on May 12, 2008 8:54 PM
05-12-2008 4:29 PM
Hi all,
I want to check the all the line items whose are in one order.
regards,
Ajay
05-12-2008 4:39 PM
loop at it_vbak into wa_vbak.
loop at it_vbap into wa_vbap where vbeln = wa_vbak-vbeln.
if wa_vbap-netwr = '0'.
delete wa_vbap index sy-index.
endif.
clear wa_vbap.
endloop.
clear wa_vbak.
endloop.
05-12-2008 5:19 PM
Hi Jack,
I need to check the all line items nrewr. if all the line items of the netwr is 0 , then only I should delete. if any line item conatins otherthan 0 , we should not delete that vbeln from vbap.
regards,
Ajay
05-13-2008 5:07 AM
Hi Ajay,
Then check the logic below.
DATA: w_check TYPE c.
SORT: i_vbak BY vbeln,
i_vbap BY vbeln.
LOOP AT i_vbak INTO wa_vbak.
CLEAR w_check.
LOOP AT i_vbap INTO wa_vbap
WHERE vbeln EQ wa_vbak-vbeln.
CHECK wa_vbap-netwr NE '0.00'.
w_check = 'X'.
EXIT.
ENDLOOP.
CHECK w_check IS INITIAL.
DELETE i_vbap WHERE vbeln EQ wa_vbak-vbeln.
ENDLOOP.
Hope this will solve ur problem.
Thanks,
Vinod.
Edited by: Vinod Kumar Vemuru on May 13, 2008 9:39 AM
05-12-2008 4:26 PM
hi,
do this way ..
delete it_vbap where netwr = '0.00'.
Regards,
santosh
05-13-2008 7:13 AM
Hi all,
I have two internal table it_vbak, it_vbap. I want to delete the VBEln from it_vbap where all line items of the NETWR is 0.
if any one of the line item of the netwr has value , it has to be come out. it should be there. I need to delete the VBEN from VBAp when all the line items of value nerwr is 0.
regards,
Ajay
Ans: use dlete it_vbap where netwr ne 0.
05-13-2008 7:22 AM
Hi Ajay,
try this
CLEAR : wa_vbrp,
wa_vbak.
LOOP AT tb_vbak INTO wa_vbak.
wf_tabix = sy-tabix.
READ TABLE tb_vbap INTO wa_vbap
WITH KEY netwr eq 0.
IF sy-subrc EQ 0.
CONTINUE.
ELSE.
DELETE tb_vbap FROM wa_vbap.
CONTINUE.
CLEAR wa_vbrp.
ENDIF.
enloop.
cheers
Mohinder Singh
05-13-2008 7:26 AM
hi
Can you please explain .. what do you mean by "all the line items of netwr"?
05-13-2008 7:30 AM
Hi,
DELETE it_vbap where netwr is initial.
Hope it helps...
P.S. Please award points if it helps...
05-13-2008 10:17 AM
Hey...
try this logic
CLEAR : wa_vbak,wa_vbap.
LOOP AT tb_vbak INTO wa_vbak.
READ TABLE tb_vbap INTO wa_vbap
WITH KEY vbeln = wa_vbak-vbeln
netwr = 0.
IF sy-subrc EQ 0.
DELETE tb_vbap WHERE vblen EQ wa_vbap-vblen.
ENDIF.
clear: wa_vbak, wa_vbap.
ENDLOOP.
Regards,
N M Poojari