04-16-2009 6:52 PM
Hi,
I am extracting the data from PA0006 as shown but in the varying condition i have to extract using PA0001-PERNR also.
Provide STRAS LOCAT ORT01 ORT02 LAND1 from P0006 between GV_BEGDA and GV_ENDDA where P0006-SUBTY = 1.
Do 6 times varying I_COMXX FROM COM01 NEXT COM02
VARYING I_NUMXX FROM NUM01 NEXT NUM02 where PA0001-PERNR.
IF I_COMXX = u2018WORKu2019
I_EXTN = I_NUMXX.
ENDIF.
ENDDO.
or it should be like this:
PA0001-PERNR also.
If PA0006-PERNR = PA0001-PERNR
Provide STRAS LOCAT ORT01 ORT02 LAND1 from P0006 between GV_BEGDA and GV_ENDDA where P0006-SUBTY = 1.
Do 6 times varying I_COMXX FROM COM01 NEXT COM02
VARYING I_NUMXX FROM NUM01 NEXT NUM02.
IF I_COMXX = u2018WORKu2019
I_EXTN = I_NUMXX.
ENDIF.
Please advise which is correct way of doing this.
ENDDO.
04-16-2009 7:24 PM
Thanks for your reply.
since you have given the option of using RP-PROVIDE-FROM-LAST but this statement would fetch only one latest record (pls correct me if i am wrong) but i need to fetch all the records between begda and endda so please clear my doubt about it. and if RP-PROVIDE-FROM-LAST can also fetch all the records then what is the difference between rp-provide and provide * from statements.
04-16-2009 7:13 PM
write the second way ...
If PA0006-PERNR = PA0001-PERNR.
Provide STRAS LOCAT ORT01 ORT02 LAND1 from P0006
between GV_BEGDA and GV_ENDDA
where P0006-SUBTY = 1.
Do 6 times varying I_COMXX FROM COM01 NEXT COM02
VARYING I_NUMXX FROM NUM01 NEXT NUM02.
IF I_COMXX = u2018WORKu2019
I_EXTN = I_NUMXX.
ENDIF.
ENDDO.
If UR using LDB's then write the coding as follows ...
rp-provide-from-last p0001 space GV_BEGDA GV_ENDDA.
if pnp-sw-found <> 1.
reject.
endif.
rp-provide-from-last p0006 1 GV_BEGDA GV_ENDDA.
if pnp-sw-found <> 1.
reject.
endif.
Do 6 times varying I_COMXX FROM p0006-COM01 NEXT p0006-COM02
VARYING I_NUMXX FROM p0006-NUM01 NEXT p0006-NUM02.
IF I_COMXX = u2018WORKu2019
I_EXTN = I_NUMXX.
exit.
ENDIF.
ENDDO.
04-16-2009 7:24 PM
Thanks for your reply.
since you have given the option of using RP-PROVIDE-FROM-LAST but this statement would fetch only one latest record (pls correct me if i am wrong) but i need to fetch all the records between begda and endda so please clear my doubt about it. and if RP-PROVIDE-FROM-LAST can also fetch all the records then what is the difference between rp-provide and provide * from statements.
04-16-2009 7:51 PM
generally U'll find only one active record in PA0006 with subtype 1 in the given begin and enddates ..
so no need to loop thru P0006 or use provide.. endprovide
rp-provide-fom-last .. gives the latest record in the given begin and enddates.