Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HR ABAP question

Former Member
0 Likes
1,960

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,671

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,672

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

Read only

Former Member
0 Likes
1,671

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

Read only

0 Likes
1,671

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

Read only

0 Likes
1,671
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,

Read only

Former Member
0 Likes
1,671

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

Read only

Former Member
0 Likes
1,671

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.