Rp_provide_from_last
hi friends,
What is the proper use of RP_PROIVDE_FROM_LAST.
thanks,
SK
Hi
The RP_PROVIDE_FROM_LAST macro retrieves the last valid data record in the data selection period.
The parameters for RP_PROVIDE_FROM_LAST are: infotype, subtype, start date, and end date. If you do not want to specify a particular subtype, enter SPACE.
You can process not only the last valid data record in the data selection period, but also the first valid data record using the RP_PROVIDE_FROM_FRST macro.
Regards Lokesh
Similar Messages
-
Rp_provide_from_last dynamic table
Hi,
I have a report which uses logical database PNPCE to fetch employee data and macros like rp_provide_from_last to read infotypes.
INFOTYPES: 0001 name gtab1,
002 name gtab2.
rp_provide_from_last gtab1 space pn-begda pn-endda
rp_provide_from_last gtab2 space pn-begda pn-endda.
I want to use a dynamic fieldname instead of gtab1 / gtab2. Basically i want to use this above macro statement to check if the infotype exists for a employee. So if there are 50 infotypes to be checked, i donot want to write this macro 50 times with 50 tables, is there a way to use a dynamic table name in the macro statement ?
Thanks
SubhaYour requirement can be met by modelling the program based on the below source code. This program will list all infotypes that have been maintained for a PERNR. This proram excludes certain infotypes like PD infotypes. The source code can be changed to include all desired infotypes.
*& Report ZTEST_CHECK_INFY
REPORT ZTEST_CHECK_INFY.
tables: t777d.
DATA SUBRC LIKE SY-SUBRC.
DATA PAR1 LIKE SY-MSGV1.
DATA: BEGIN OF SELTAB OCCURS 5.
INCLUDE STRUCTURE PRELP AS prelp. "UC
DATA: OPERA(1).
DATA: END OF SELTAB.
data: it_777d like t777d occurs 0.
data: wa_777d type t777d.
data: ls_index(4) type n.
select-options: so_infty for t777d-infty.
select-options: so_inft1 for t777d-infty no intervals.
Initialization.
so_infty-sign = 'I'.
so_infty-option = 'BT'.
so_infty-low = '0000'.
so_infty-high = '9999'.
append so_infty.
select * from t777d into corresponding fields of table it_777d where infty in so_infty.
loop at it_777d into wa_777d.
so_inft1-sign = 'I'.
so_inft1-option = 'EQ'.
so_inft1-low = wa_777d-infty.
append so_inft1.
endloop.
start-of-selection.
CALL FUNCTION 'HR_INITIALIZE_BUFFER'
EXPORTING
TCLAS = 'A'
PERNR = '40101017'
EXCEPTIONS
OTHERS = 1.
Loop at so_inft1 where not low between '1000' and '8999'.
REFRESH SELTAB.
CLEAR SELTAB.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
TCLAS = 'A'
PERNR = '40101017'
INFTY = so_INFT1-low
BEGDA = '19000101'
ENDDA = '99991231'
IMPORTING
SUBRC = SUBRC
TABLES
INFTY_TAB = SELTAB
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
if subrc eq 0.
write:/ so_inft1-low, 'has been maintained for employee: ', '40101017'.
endif.
endloop. -
What is rp_provide_from_last
Hi all,
Can any one please explain me what his line would do?
rp_provide_from_last p0001 space pn-begda pn-endda.
I know p0001[] is itab and p0001 its wa but I cantunderstand what it does.?
Thanks in advance.in your example:
rp_provide_from_last p0001 space pn-begda pn-endda.
rp_provide_from_last is a macro which will get you latest record from internal table p0001, it will place the fetched record in the header of P0001.
space is placeholder for subtype, there is no subtype in infotype 0001 so thats why we put 'space' here.
pn-begda and pn-endda are the date ranges in which the latest record will be fetched.
P0001 will be populated with all records of current pernr. so basically we are looking for latest record in the dates that user provides on the selection screen.
Hope it helps.
Thanks. -
Proper use of rp_provide_from_last
Hello Experts,
I've used the macro rp_provide_from_last p0000 space pn-begda pn-endda
pn-begda = 05.07.2010
pn-endda = 05.07.2010
I can't retrieve the last record with
p0000-begda = 07.07.2010
p0000-endda = 31.12.9999
Instead I keep retrieving the second to the last record with
p0000-begda = 01.09.2009
p0000-endda = 06.07.2010
What is the reason why I keep retrieving the second to the last record? Hope you can answer my query.
Thanks in advancegive
pn-begda = 01.01.1800
pn-endda = 31.12.9999
With this specification you will always retrieve the latest record.
In short the macro will give you the last record in the given dates i.e. last record between pn-begda and pn-endda.
cheers
AJ
Edited by: Ajay Hosur on Jul 16, 2010 7:02 AM -
Use of RP_PROVIDE_FROM_LAST
Hi experts ,
I need to fatch the record base on PERNR in RFC . as well i need fatch data from othere info type . but my requirement is i need last record .
there is some thread to use RP_PROVIDE_FROM_LAST , but i am not confident to how can use this .
Please if any body have sample program please send me . so i can refeer the same .
Regards
Ajay PandeyGET PERNR.
RP_PROVIDE_FROM_LAST P0002 SPACE PN-BEGDA PN-ENDDA.
LOOP AT P0002.
MOVE: P0002-VORNA TO GW_0002-VORNA,
P0002-NACHN TO GW_0002-NACHN.
MODIFY GT_0002 FROM GW_0002
TRANSPORTING BEGDA WHERE PERNR = P0002-PERNR.
ENDLOOP.
I used this code but i not know how i will make this with my import parameters . and i am getting two records -
Difference between RP_PROVIDE_FROM_LAST and RP-PROVIDE-FROM-LAST
Can anyone tell me the difference between RP_PROVIDE_FROM_LAST and RP-PROVIDE-FROM-LAST? Both the macros are same difference is with underscore(_) and hiphen(-). Both are working fine for the functionality without any difference. Then why there are two macros for a single functionality?
Just providing the links are considered as link farming ( which are against the rules of the forums ), the links would be removed for the following reasons:
1) If a link is provided( not many ) , then you must point out the explanation in it
2) If the links were easily searchable by the OP
3) If the links just direct you to sap documentation
4) If the reply consists only bunch of link references.
I think the 3rd & 4th point made your post to be deleted.
There are no links which states the differences between these two Macro's. Mod's are doing their right job, please join them and make this forum clean
Kesav -
Regarding rp_provide_from_last
hi experts,
PERNR INFTY SUBTY OBJPS SPRPS ENDDA BEGDA SEQNR PUNCHTIME EMPLOYEECARDNO
00000001|9777 |P20 | | |20080804|20080804|000 |130000 |12345678
00000001|9777 |P20 | | |20080804|20080804|001 |190000 |12345678
here the data in my internal table is in this format i need to pick the last row
for this i use " rp_provide_from_frst P9777 'P20' s_date s_date."but this
macro is picking the first row not the last row which i want..
plz help me to sort out this problem,i want to pick up the last punch out i.e punchtime-190000
i.e P20 for the employees not punchtime-1300000.Have a look at this link. This will describe almost every macro in HR with examples.
http://help.sap.com/saphelp_45b/helpdata/en/60/d8bc0a576311d189270000e8322f96/frameset.htm
The one which is of interest to you is
[RP_PROVIDE_FROM_FRST|http://help.sap.com/saphelp_45b/helpdata/en/60/d8bc0a576311d189270000e8322f96/content.htm]
[RP_PROVIDE_FROM_LAST|http://help.sap.com/saphelp_45b/helpdata/en/60/d8bc17576311d189270000e8322f96/content.htm]
Amandeep -
Macro rp_provide_from_last is not working for ...
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 balaYou need to sort P9380 descending on ENDDA before doing RP-PROVIDE-FROM-LAST.
SORT P9380 by ENDDA DESCENDING. -
RP_PROVIDE_FROM_FRST & RP_PROVIDE_FROM_LAST
Dear friends
Coul any1 of u tel me th exact diff bet th macros RP_PROVIDE_FROM_FRST & RP_PROVIDE_FROM_LAST which r used for HR application.
regards
sakthiHi Sakthi vel,
Check the program.
REPORT ztest1.
TABLES: pernr.
INFOTYPES: 0001.
GET pernr.
rp_provide_from_frst p0001 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'.
WRITE: / pernr-pernr, p0001-stell, pn-begda, pn-endda.
ELSE.
REJECT.
ENDIF.
"After GET PERNR event p0001 internal table is filled up with
"data for one employee. If you have multiple records in the
"internal table, If use rp_provide_from_frst macro along with
"parameters dates , It gets the first record from the body of
"the internal table and puts on the header of the internal table
"in the given period pn-begda and pn-endda. It does not get
"from database table.
REPORT ztest1.
TABLES: pernr.
INFOTYPES: 0001.
GET pernr.
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'.
WRITE: / pernr-pernr, p0001-stell, pn-begda, pn-endda.
ELSE.
REJECT.
ENDIF.
"After GET PERNR event p0001 internal table is filled up with
"data for one employee. If you have multiple records in the
"internal table, If use rp_provide_from_last macro along with
"parameters dates , It gets the last record from the body of
"the internal table and puts on the header of the internal table
"in the given period pn-begda and pn-endda. It does not get
"from database table.
I hope that it helps u .
Regards,
Venkat.O -
Rp_provide_from_last p2001 space pn-begda pn-endda
Hi Guru's,
I am using PNP as LDB and after ,
My requirement is to fetch the records from p2001 for a specific time period mentioned in the selection screen.
Code :
Get Perner.
rp_provide_from_last p2001 space pn-begda pn-endda.
the output of the above is giving all the data from P2001 irrespective of the dates (Pn-begda & pn-endda.)
But i want the data with in the dates (Pn-begda & pn-endda.).
Plz suggest.
Thanks.Hi,
PROVIDE * FROM P2001
BETWEEN Pnpbegda AND Pnpendda.
write: p2001-pernr,p2001-begda.
ENDPROVIDE.
use this code..........
Regards,
vamshidhar .
Edited by: vamshi naini on Apr 23, 2008 2:06 PM -
Rp_provide_from_last infotype subtype pn-begda pn-endda.
Hi All,
Is there a way to find out if a subtype exists before using this macro. If a subtype does not exist then it crashes.
rp_provide_from_last infotype subtype pn-begda pn-endda.
Thanks,
~MarkMark,
Check the View V_T591A - Subtype Characteristics.
It will have all Subtypes maintained in your sytem for infotype.
Additionally if you want to Use the Macro for an Infotype without Subtype, Pass SPACE instead of Subtype.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
Hope this helps.
Vinodh Balakrishnan
Edited by: Vinodh Balakrishnan on Jan 15, 2008 3:19 PM -
Rp_provide_from_last p9003
Hi
I am working on a HR report using the custom infotype, I am using following code
rp_provide_from_last p9003 space pn-begda pn-endda.
IF pnp-sw-found = 1 .
MOVE-CORRESPONDING p9003 TO i_pa9003.
APPEND i_pa9003.
ENDIF.
pernr endda begda
01 31.12.2009 19.05.1990
01 31.12.9999 01.01.2010
after executing I am not getting the second record, only getting the first record.
Please let me know what is problem, in my uderstanding rp_provide_from_last will give the last record.
Regards
Sebastian John
Edited by: Sebastian John on Mar 21, 2010 1:04 PM
Edited by: Sebastian John on Mar 21, 2010 1:06 PMHi John,
<li> You are correct. When you use rp_provide_from_last, it gives you the last record in the given period pn-begda and pn-endda.
<li>Instead of that macro, you can use PROVIDE-ENDPROVIDE. Its like LOOP-ENDDLOOP. for more info.. Use F1 help on PROVIDE.
PROVIDE * FROM p9003 BETWEEN pn-begda AND pn-endda.
MOVE-CORRESPONDING p9003 TO i_pa9003.
APPEND i_pa9003.
ENDPROVIDE
Thanks
Venkat.O -
RP_provide_from_last selecting wrong value ???
Hi experts..
In my report i had used statement ..
RP_provide_from_last P0027 SPACE PN-BEGDA PN-ENDA...
Now on selction secreen i am giving any random pernr no. 5656 along with
begda-->01011800
enda--->31129999
Although there no such data peresent for perner 5656 in the TABLE PA0027 but the rp_provide stmt is selecting the record.
i tried with clear and refresh stmt but nothing is working.
how stmt can select records if specified pernr is not peresent .
Please help.
I will reward points.
Thanks.Hi,
Refer to my code as follows:
at selection-screen.
SELECT SINGLE * FROM MSEG WHERE
MBLNR = IMBLNR.
IF SY-SUBRC <> 0.
MESSAGE S000(ZMM) WITH 'Please select a valid Material Number'.
ENDIF.
Modify it according to your requirement.
Hope this helps.
Reward if helpful.
Regards,
Sipra -
RP_PROVIDE_FROM_LAST AND PROVIDE AND ENDPROVIDE
hi all,
When to use RP_PROVIDE_FROM_LAST and Provide and EndProvide?
which scenario we go for RP_PROVIDE_FROM_LAST and Provide?
both will do the same purpose?
RP_PROVIDE_FROM_LAST will read recent records.
Provide will read sequentially data.
other than this...difference
can anyone clear my doubt?Hi,
For PROVIDE-ENDPROVIDE :
1) You can fetch individual fields of the infotypes.
2) You can also use the JOIN and PROJECTION of infotypes. Based on the criteria, datas can be fetched from two or more infotypes.
3) It is similar to the SELECT STATEMENT of normal ABAP.
4) You can do processing within the Block of PROVIDE - ENDPROVIDE
For RP_PROVIDE_FROM_LAST:
1) You fetch only the recent record of the Infotype.
2) This is a MACRO delivered by SAP and not a statement. You can also create something similar to this.
Regards,
Anirban -
Rp_provide_from_last regarding doubts
Dear All,
I am using rp_provide_from_last to fetch a record from the infotype.
I am getting only the last record from the infotype by i need all the record between the valid date range.
my date range is 01.04.2005 to 31.03.2006.
empno begda endda
01 01.04.2005 30.10.2005
01 01.11.2005 30.12.2005
<b>01 01.01.2006 30.02.2006</b>
I am getting the last record but i need all the three record what macro i should use.
with regards,
Prince ElvisYou can use the Provide statement which is specifically meant for this purpose in this fashion:
PROVIDE * FROM p0001 BETWEEN r_begda AND r_endda.
Do your processing here
For example
WRITE / p0001-pernr, p0001-plans.
ENDPROVIDE.
Note: Here you dont need to check for pernr because in the LDB, only one PERNR data is available in each pass of the GET PERNR event. So we dont need to bother abt that at all.
Please dont forget to award points if this helped.
Maybe you are looking for
-
Can't log in with my apple id on FaceTime for iPhone 5
Keep getting error message tell me it can't log in to face time on iPhone 5
-
Add our contact to ovi gps post office
Dear OVI we are tnt global express iran branch want to add our contact in post office directory while ovi gps is loading tehran map iam using nokia e72 . when i use my ovi gps every things is ferfect & also our resturant name was added in the directo
-
Serial number front panel pop-up
I have a vi that will scan a serial number. It will be called from teststand. The problem I am having that the front panel stays visable when it is executed. This will be very distracting for the test technician. I have attached the vi and a scre
-
I have just purchased a latest model Airport Extreme. I am currently on Sky broadband and use a Sky hub to send wifi around the house. Can someone please let me know what i need to do so i can set up an Apple home network. Is it just a case of pluggi
-
Print Multiple forms per Marketing Document SAP B1 2007
When printing the Delivery document, I need to print a Packing list and a Bill of Lading. How can I acheive this in SAP B1 2007? I am hoping there is a way when pressing the Print button that I can have both documents print like when printing and