We use HR macro to get first or last record from table. One of these are rp_provide_from_last
.
I need to get two subtypes (0010
, 0004
) from P0105
table:
Below is my code. The problem is that after the second macro, there are only records of 0004
.
How can I hold on them together?
GET pernr.
rp_provide_from_last p0105 '0010' pn-begda pn-endda.
CHECK pnp-sw-found eq '1'.
rp_provide_from_last p0105 '0004' pn-begda pn-endda.
CHECK pnp-sw-found eq '1'.
here is definition.
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.