2004 Nov 18 11:58 AM
Hi all,
MAcro rp_provide_from_last in include DBPNPMAC is no working for the records
.
PERNR ENDDA BEGDA BSSAL
00033987 12/30/2004 01/01/2004 60,000
00033987 12/31/2004 01/01/2004 61,000
00033987 12/31/2005 01/01/2005 64,000
00033987 12/31/2005 01/01/2005 67,000
Am using .
rp_provide_from_last p9380 space pn-begda pn-endda .
PN-BEGDA 01/01/2004 PN-ENDDA 12/16/2004
I have to get bssal as 61,000 but am getting 60,000
DEFINE rp_provide_from_last.
$PNNNN$ = &1.
$SUBTY$ = &2.
$BEGDA$ = &3.
$ENDDA$ = &4.
pnp-sw-found = '0'.
clear pnp-sy-tabix.
loop at &1.
if &2 <> space.
check &1-subty = &2.
endif.
if &1-begda <= &4 and &1-endda >= &4.
pnp-sw-found = '1'.
exit.
endif.
if &1-begda <= &4 and &1-endda >= &3.
pnp-sy-tabix = sy-tabix.
endif.
endloop.
if pnp-sw-found = '0'.
if pnp-sy-tabix <> 0.
pnp-sw-found = '1'.
read table &1 index pnp-sy-tabix.
else.
clear &1.
endif.
endif.
END-OF-DEFINITION.
cheers
senthil
Message was edited by: senthil bala
2004 Nov 18 3:51 PM
You need to sort P9380 descending on ENDDA before doing RP-PROVIDE-FROM-LAST.
SORT P9380 by ENDDA DESCENDING.