3 Replies Latest reply: Mar 17, 2008 2:57 PM by Sanjay Hatti RSS

PROVIDE - ENDPROVIDE in HR ABAP

Sanjay Hatti
Currently Being Moderated

Hi All,

 

I am trying to understand how the PROVIDE - ENDPROVIDE statement in HR ABAP works.

I have gone through many of the links discussion on this but is not very clear.

Can you please correct my understanding if it.

 

-


I was under impression that the provide statement in the below report ZTEST gets exectuted like the following LOOP ENDLOOP statement which is not correct. Can you please help me understand how it processes the provide statement and how different is the PROVIDE statement from the LOOP ENDLOOP statement.

 

    loop at p0002 where begda <= pn-begda

                        and endda >= pn-endda.

      WRITE: / p0002-pernr.

      ...

      ...

    endloop.

 

 

-


 

REPORT ZTEST.

 

TABLES: pernr.

 

INFOTYPES: 0002. "Personal Data

 

SELECT-OPTIONS: language FOR p0002-sprsl.

 

**-- Selection screen

INITIALIZATION.

pnptimed = 'D'.

 

*-- Processing

 

START-OF-SELECTION.

 

GET pernr.

 

PROVIDE * FROM p0002 BETWEEN pn-begda AND

pn-endda.

CHECK language.

WRITE: / p0002-pernr,

sy-vline,

pernr-ename,

sy-vline,

p0002-sprsl,

sy-vline,

p0002-gbdat.

ENDPROVIDE.

 

 

-


Regards,

Sanjay.

  • Re: PROVIDE - ENDPROVIDE in HR ABAP
    Currently Being Moderated

    change your loop .. endloop as ...

     

    loop at p0002 where begda <= pn-endda

               and endda >= pn-begda.

      WRITE: / p0002-pernr.

    ...

    ...

    endloop.

     

     

     

    PROVIDE * FROM p0002 BETWEEN pn-begda AND

    pn-endda.

     

    *This gets data in P0002 between begin and enddate .. entered

    on the selection screen ...

     

    ENDPROVIDE.

    • Re: PROVIDE - ENDPROVIDE in HR ABAP
      Sanjay Hatti
      Currently Being Moderated

      Hi Srinivas,

       

      Thank you for your relpy.

       

      Im little confused.

       

      1. The LOOP statement you have sent is it equivalent form of  the PROVIDE statement ?

       

      2. You said:

      -


      PROVIDE * FROM p0002 BETWEEN pn-begda AND

      pn-endda.

       

      *This gets data in P0002 between begin and enddate .. entered

      on the selection screen ...

       

      ENDPROVIDE

      -


      Since the provide has BETWEEN then can I understand the provide statement like ( i know that the syntax is not right, but trying to understand the logic here) . You have mentioned that it get the data from p0002 betwwen begin and enddate entered on selection screen.

       

      PROVIDE * FROM p0002 where begda >= pn-begda AND endda <= pn-endda.

       

      Regards,

      Sanjay

  • Re: PROVIDE - ENDPROVIDE in HR ABAP
    Raymond Giuseppi
    Currently Being Moderated

    Look at this documentation [Report Programming in HR|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAXX/PYINT_PROGRAMM.pdf]

     

    Processing All Infotype Records (PA-PAD)

    After the GET PERNR event, the internal tables of the infotypes contain records and are ready for processing.

    Internal tables are generally processed line-by-line using the LOOP statement.

    The internal tables of infotypes have features which allow special processing.

    These tables are defined for specific intervals. In HR, these are time intervals or validity periods.

    Processing of infotype records is time-dependent; by this we mean dependent on the data selection period entered on the selection screen. The data of several infotypes can be processed

    at the same time and made available for a specific partial period.

    Internal infotype tables are processed with the PROVIDE statement.

    The syntax is as follows:

    PROVIDE * FROM Pnnnn BETWEEN PN-BEGDA AND PN-ENDDA.

    WRITE: / Pnnnn-<field>.

    ENDPROVIDE.

    nnnn stands for the four-digit infotype number. The relationship between the infotype and the data selection period of the selection screen is established using the PN/BEGDA and PN/ENDDA variables.

    In the PROVIDE loop, the data of an infotype record is available for processing in the Pnnnn

    structure.

    Regards

Actions