Application Development 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: 

Fetching data

Former Member
0 Kudos

Hi,

In HR ABAP , How many ways to fetch the data.

ex: select, Provide endprovide

In which scenario select and provide to be used.

Thanks

8 REPLIES 8

Former Member
0 Kudos

Hi,

We can fetch data both by Select and Provide statement. If you are using logical DB then after get event you can process the data using PROVIDE-ENDPROVIDE block. The main difference is without using LDB you can not use PROVIDE-ENDPROVIDE but with LDB you can use both PROVIDE-ENDPROVIDE and SELECT statement. Inside provide and end provide the data in Pnnnn is processed as a loop statement for internal table.

Regards,

Chandu

bpawanchand
Active Contributor
0 Kudos

Hi

We use SELECT statements very rarely in HR ABAP programs either we LDB's or by using macros we read the data from the DB when we talk about macros we have so many and one of them is PROVIDE....ENDPROVIDE

we can use this macro

E;g

GET pernr

PROVIDE

END PROVIDE

Further Reference

http://help.sap.com/saphelp_45b/helpdata/en/8c/38e0343734cf72e10000009b38f83b/frameset.htm

Regards

pavan

Former Member
0 Kudos

U can also get data from FM ..

HR_READ_INFOTYPE ...

If UR using LDB's no need to fetch data .. Its enough if U

declare infotypes : ... data will be filled in the GET PERNR

event ..

Former Member
0 Kudos

Hi Asha.

The most vital role is played in HR ABAP by the Logical Databases, Macros and Clusters.

Provide and Endprovide acts a loop statement which we give in Normal cases of displaying records.

But, In case of LDB's We can also use IF statement in the provide and endprovide statement.

Get statement indicates use of LDBs and it is usefull in replacing the SELECT query.

Sample Code:


 
start-of-selection.

get pernr.
 
  provide *
      from p0000
between pn-begda
       and pn-endda.
    if p0000-valid = 'X'.

   write:/5 p0000-pernr,
               p0000-subty,
               p0000-objps,
               p0000-begda.

    endif.

  endprovide.

end-of-selection

Good Luck.

Harsh

Edited by: Harsh Dave on Jul 9, 2008 4:13 PM

Former Member
0 Kudos

Hi Asha,

If you are going with LDB you go for

GET pernr

provide

....

endprovide.

else also u can make use of FM like

hr_read_infotype in PA

rh_read_infty_1000 in OM

rh_read_infty_1001 in OM

and also Select statemnt if required.

Regards,

Pritam.

Former Member
0 Kudos

Hi Asha,

In abap Hr we can retrieve data using

Select,

macros

Function Modules

Provide -- endprovide

In ABAP HR we generally go with LDB's and we go with reading data using macros and provide and endprovide

if you are not using LDB's you can go with select and Function modules... (Preferably Function Modules)

regards

padma

Former Member
0 Kudos

Hi Asha,

We can use both the statements SELECT and PROVIDE-ENDPROVIDE in HR ABAP.

But generally we use only Provide-Endprovide.

When the amount of data to be fetched is less we go for Select else we go for Provide - endprovide.

But using Select does not check for the autorizations and it directly fetches the data. So, we generally do not use Select. Instead we go for PROVIDE-ENDPROVIDE in HR ABAP.

Hope this helps you.

Regards,

Chandra Sekhar

Former Member
0 Kudos

Thanks