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

Delete row from internal table

Former Member
0 Likes
622

Hi all,

I have arequirement to print the values of wagetypes where amount field has a value. If amount for any wagetype is 0, it should be deleted from internal table.Please see my code and advice how to deleet the line with zero amount.

LOOP AT IT_0001.

DO 20 TIMES VARYING WAGETYPES-E_LGA FROM P0008-LGA01 NEXT P0008-LGA02

VARYING WAGETYPES-E_BET FROM P0008-BET01 NEXT P0008-BET02.

IF WAGETYPES-E_LGA = '1001'.

SELECT SINGLE BETRG FROM T510 INTO T510-BETRG WHERE LGART = '1001' AND

TRFAR = P0008-TRFAR

AND TRFGB = P0008-TRFGB

AND TRFGR = P0008-TRFGR

AND TRFST = P0008-TRFST.

IF SY-SUBRC = 0.

IT_0001-BASIC2 = T510-BETRG.

ENDIF.

ENDIF.

ENDDO.

CALL FUNCTION 'BAPI_BASICPAY_GETDETAIL'

EXPORTING

EMPLOYEENUMBER = PERNR-PERNR

SUBTYPE = P0008-SUBTY

OBJECTID = P0008-OBJPS

LOCKINDICATOR = P0008-SPRPS

VALIDITYBEGIN = P9003-ZZDATE1

VALIDITYEND = '99991231'

RECORDNUMBER = P0008-SEQNR

TABLES

WAGETYPES = WAGETYPES1.

LOOP AT WAGETYPES1 .

IT1-AMOUNT = WAGETYPES1-AMOUNT.

IT1-NAMEOFWAGETYPE = WAGETYPES1-NAMEOFWAGETYPE.

APPEND IT1.

ENDLOOP.

ENDLOOP.

Result after debugging for table IT1:-

1 4200.0000 Basic pay

2 0.0000 DA

3 0.0000 CCA

4 2100.0000 Dearness Pay

5 1050.0000 Non Practicing Allw.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
595

Hi,

After final endloop u can use..

Delete IT1 where IT1-AMOUNT = '0.0000'.

or Pass 0.0000 value to some other field and then compare.

Thanks,

4 REPLIES 4
Read only

Former Member
0 Likes
596

Hi,

After final endloop u can use..

Delete IT1 where IT1-AMOUNT = '0.0000'.

or Pass 0.0000 value to some other field and then compare.

Thanks,

Read only

Former Member
0 Likes
595

Hi Preeti.

use the following code.

loop at it1.

if it1-wagetype = 0.

delete it1.

modify it1.

endif.

endloop.

Reward if useful.

Read only

0 Likes
595

Hi.. Use this,

Delete itab where f1 is initial. Should solve ur problem

Read only

0 Likes
595

Is your IT-AMOUNT data type is same as the BAPIP0008P-AMOUNT.

(DEC type)

Please use this

DELETE IT1 WHERE amount EQ ''.