2008 May 01 11:34 AM
hi everyone
can anybody tell me the difference between rp_provide_from_last and provide * from
in HR ABAP?
ive been seeing a program where it makes use of both command and i really dont know why it is so
2008 May 01 11:41 AM
Hi Anjali,
RP-PROVIDE-FROM-LAST (PROVIDE FROM LAST)
The last entry of the time period (or subtype) you want is taken from an internal infotype table (defined by means of the programming language declaration INFOTYPES) and placed in the table header.
RP-PROVIDE-FROM-LAST is a MACRO
where as PROVIDE statement is nothing but LOOP ENDLOOP statement
PROVIDE is a statement. which is used to output the data.
Here GET pernr acts as Select Statement.
GET pernr.
PROVIDE * FROM p0167 BETWEEN pn-begda AND pn-endda.
Hope this helps...
best regards
raam
2008 May 01 11:41 AM
Hi Anjali,
RP-PROVIDE-FROM-LAST (PROVIDE FROM LAST)
The last entry of the time period (or subtype) you want is taken from an internal infotype table (defined by means of the programming language declaration INFOTYPES) and placed in the table header.
RP-PROVIDE-FROM-LAST is a MACRO
where as PROVIDE statement is nothing but LOOP ENDLOOP statement
PROVIDE is a statement. which is used to output the data.
Here GET pernr acts as Select Statement.
GET pernr.
PROVIDE * FROM p0167 BETWEEN pn-begda AND pn-endda.
Hope this helps...
best regards
raam
2008 May 01 11:42 AM
Reward if useful
One is macro adn another is just liek select statment..
rp_provide_last ..will retrieve all the last records based on start data end date..
where provide will retireve all the records from the data base.
Regards
sas
2008 May 01 12:04 PM
in the program, both commands uses the begining date and ending date
see this, an extract of the program
GET pernr.
PROVIDE * from p0121 between pn-begda and pn-endda.
Retrieve datd from infotypes
rp_provide_from_last p0000 space pn-begda pn-endda.
rp_provide_from_last p0001 space pn-begda pn-endda.
can anybody tell me whether theres a difference or we can use both commands in any case
2008 May 01 12:53 PM
GET pernr.
PROVIDE * from p0121 between pn-begda and pn-endda.
Just imagine that for same pernr-> personnel number u have 3 type of records
justy like
1000 20-01-2008 19-02-2008
1000 20-02-2008 19-03-2008
1000 20-03-2008 31-12-9999
of this u want to retireve only Last reocrd of the pernr so we write:
rp_provide_from_last p0001 space pn-begda pn-endda.
so o.p is
1000 20-03-2008 31-12-9999
if u want only first records
u write:
rp_provide_from_frst p0001 space pn-begda pn-endda.
o.p is
1000 20-01-2008 19-02-2008
if suppose u want all the 3records.
u write:
get pernr.
provide * from p0001 between pn-begda and pn-endda.
endprovide.
u will get all the 3 records
Reward if useful please
Regards
sas
let me know for further clarification.Hope u understand,
2008 May 01 12:02 PM
hi check this..
macros with logical data base
TABLES pernr.
INFOTYPES : 0001.
START-OF-SELECTION.
GET pernr.
WRITE : / '----
'.
WRITE : /'Result from ProvideEndprovide'.
WRITE : / '----
'.
PROVIDE * FROM p0001 BETWEEN pn-begda AND pn-endda.
WRITE : / p0001-pernr, p0001-begda, p0001-endda.
ENDPROVIDE.
END-OF-SELECTION.
macros with out logical data base..
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.
regards,
venkat
2008 May 01 12:12 PM
Hi,
Think that you have the following records in internal table p0001.
pernr begda endda
00000001 20060101 20070221
00000001 20070222 20080229
00000001 20080301 99991231
rp_provide_from_last p0001 space '20060101' '20070225'.
the above macro pick the second record as the last record for the given dates in the macro.
rp_provide_from_last p0001 space '20060101' '99991231'.
the above macro pick the third record as the last record for the given dates in the macro.