Application Development and Automation 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: 
Read only

Logic required.

Former Member
0 Likes
1,277

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
Read only

Former Member
0 Likes
1,252

hi check this...

loop at it_vbap where vbeln = it_vbak-vbeln.

delete it_vbap where NETWR eq 0.

endloop.

regards,

venkat

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,252

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

Read only

0 Likes
1,252

Hi all,

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

regards,

Ajay

Read only

0 Likes
1,252
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.
Read only

0 Likes
1,252

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

Read only

0 Likes
1,252

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

Read only

Former Member
0 Likes
1,252

hi,

do this way ..


delete it_vbap where netwr = '0.00'.

Regards,

santosh

Read only

Former Member
0 Likes
1,252

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.

Read only

Former Member
0 Likes
1,252

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

Read only

Former Member
0 Likes
1,252

hi

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

Read only

aris_hidalgo
Contributor
0 Likes
1,252

Hi,

DELETE it_vbap where netwr is initial.

Hope it helps...

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

Read only

Former Member
0 Likes
1,252

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