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: 

REGARDING DELETE

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

Hi

<b>DELETE T_output where wt_acco NE 0.</b>

Regards

Raj

Former Member
0 Kudos

<b>DELETET T_output1 WHERE wt_acco NE '0.00'.</b>

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos
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