‎2007 Jul 13 7:37 AM
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.
‎2007 Jul 13 7:42 AM
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,
‎2007 Jul 13 7:42 AM
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,
‎2007 Jul 13 7:45 AM
Hi Preeti.
use the following code.
loop at it1.
if it1-wagetype = 0.
delete it1.
modify it1.
endif.
endloop.
Reward if useful.
‎2007 Jul 13 8:05 AM
Hi.. Use this,
Delete itab where f1 is initial. Should solve ur problem
‎2007 Jul 13 8:10 AM
Is your IT-AMOUNT data type is same as the BAPIP0008P-AMOUNT.
(DEC type)
Please use this
DELETE IT1 WHERE amount EQ ''.