Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Logic required.

Former Member
0 Kudos

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

12 REPLIES 12

Former Member
0 Kudos

hi check this...

loop at it_vbap where vbeln = it_vbak-vbeln.

delete it_vbap where NETWR eq 0.

endloop.

regards,

venkat

vinod_vemuru2
Active Contributor
0 Kudos

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

0 Kudos

Hi all,

I want to check the all the line items whose are in one order.

regards,

Ajay

0 Kudos
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.

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

hi,

do this way ..


delete it_vbap where netwr = '0.00'.

Regards,

santosh

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

hi

Can you please explain .. what do you mean by "all the line items of netwr"?

aris_hidalgo
Contributor
0 Kudos

Hi,

DELETE it_vbap where netwr is initial.

Hope it helps...

P.S. Please award points if it helps...

Former Member
0 Kudos

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