12-04-2007 1:13 AM
Hi all,
I had been looking up and down my materials for a specific HR macro to do sorting. I couldn't found one.
Thus, is there a HR Macro that do sorting on infotypes?
Thanks
William Wilstroth
12-04-2007 2:04 AM
Hi,
I think what you can do is put a sort statement inside the GET loop. For example, an infotype 0000 has been declared you can put the below sort statement before looping the infotype in a PROVIDE loop.
SORT P0000 BY BEGDA.
12-04-2007 1:25 AM
Not sure what you meant by sort, but
Within a date range, <i>rp-provide-from-last</i> would give you the most recent record &
<i>rp-provide-from-first</i> will give you the earliet record.
~Suresh
12-04-2007 2:04 AM
Hi,
I think what you can do is put a sort statement inside the GET loop. For example, an infotype 0000 has been declared you can put the below sort statement before looping the infotype in a PROVIDE loop.
SORT P0000 BY BEGDA.
12-04-2007 2:35 AM
Hi,
As suggested, the below macros will help you to get the first and last records in time sort order respectively.
RP-PROVIDE-FROM-FRST
RP-PROVIDE-FROM-LAST
Here is an example.
TABLES pernr.
INFOTYPES : 0001.
START-OF-SELECTION.
GET pernr.
WRITE : / 'Result from Macros'.
rp-provide-from-frst p0001 space pn-begda pn-endda.
IF pnp-sw-found = 1.
WRITE : / '----
'.
WRITE : / 'Result from rp-provide-from-frst'.
WRITE : / '----
'.
WRITE : / p0001-pernr, p0001-begda, p0001-endda.
ENDIF.
rp-provide-from-last p0001 space pn-begda pn-endda.
IF pnp-sw-found = 1.
WRITE : / '----
'.
WRITE : / 'Result from rp-provide-from-last'.
WRITE : / '----
'.
WRITE : / p0001-pernr, p0001-begda, p0001-endda.
ENDIF.
rp-read-infotype pernr-pernr 0001 p0001 pn-begda pn-endda.
IF pnp-sw-found = 1.
WRITE : / '----
'.
WRITE : / 'Result from rp-read-infotype'.
WRITE : / '----
'.
LOOP AT p0001.
WRITE : / p0001-pernr, p0001-begda, p0001-endda.
ENDLOOP.
ENDIF.
END-OF-SELECTION.
12-06-2007 6:37 AM
Hi Lily, Suresh and Jaya,
thanks for the reply, I guess there is no specific HR macro that can sort except if i use rp_provide_last or the rp_provide first... i think i use either one of this to accmplish my work.
Thanks a lot
William Wilstroth