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

provide statement

Former Member
0 Likes
816

hi

is there any alternative statement instead of using provide?

when we use provide statement in LDB we declare tables and infotypes. is there any other method to use LDB without using this declaration.

can we use provide statement without LDB screen?

6 REPLIES 6
Read only

Former Member
0 Likes
743

The alternative to provide statement specific to HR module is Function Modules

To retreive data from Infotype 0001


  CALL FUNCTION 'HR_READ_INFOTYPE'
    EXPORTING
     tclas                 = 'A'
      pernr                 = pernr
      infty                 = '0001'
     begda                 = rec-begda
     endda                 = rec-endda
    TABLES
      infty_tab             = p0001
   EXCEPTIONS
     infty_not_found       = 1
     OTHERS                = 2 .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

please brief more about the requirement if you want further clarification

Reward points please

Edited by: Sriram Chandran on Jun 5, 2008 11:58 AM

Edited by: Sriram Chandran on Jun 5, 2008 11:59 AM

Read only

Former Member
0 Likes
743

U can use provide without LDB screen.

provide * from IT_PA0001 between v_date1 and v_date2.

endprovide.

If U don't want to use provide .. endprovide .. just loop thru the

structures U get declaring infotypes....

The statements PROVIDE and ENDPROVIDE define a loop through a statement block. In this loop, any number of internal tables itab1 itab2 ... are processed together. A single table can appear several times. For every table itab you must specify a FIELDS clause. After FIELDS you must specify the character * for all components or a list comp1 comp2 ... for specific components of the relevant table. The names of the components comp1 comp2 ... can only be specified directly.

Read only

0 Likes
743

i use this code

PROVIDE pernr uname

FROM p0000

pernr btrtl werks persg persk abkrs uname

FROM p0001

BETWEEN p_edate and p_edate

WHERE p0000-pernr IN p_perno and

p0001-pernr in p_perno.

the p_perno is the custom field.

this statement picks all the pernr from p0000 and p0001.

it does not pick according to the select option.

Read only

0 Likes
743

Your structures p0000 and p0001 has all the records for a

particular pernr ...

instead use macros to read ..

rp-provide from first/last p0000/p0001 space pn-begda pn-endda.

or loop thru p0000 or p0001 .. to get data ..

Read only

0 Likes
743

can send sample prog with provide statement with declarations.

Read only

0 Likes
743

DATA: BEGIN OF wa1,

col1 TYPE i,

col2 TYPE i,

col3 TYPE string,

END OF wa1.

DATA: BEGIN OF wa2,

col1 TYPE i,

col2 TYPE i,

col3 TYPE string,

END OF wa2.

DATA: itab1 LIKE STANDARD TABLE OF wa1,

itab2 LIKE STANDARD TABLE OF wa2.

DATA: flag1(1) TYPE c,

flag2(1) TYPE c.

wa1-col1 = 1.

wa1-col2 = 6.

wa1-col3 = 'Itab1 Int1'.

APPEND wa1 TO itab1.

wa1-col1 = 9.

wa1-col2 = 12.

wa1-col3 = 'Itab1 Int2'.

APPEND wa1 TO itab1.

wa2-col1 = 4.

wa2-col2 = 11.

wa2-col3 = 'Itab2 Int1'.

PROVIDE FIELDS col3 FROM itab1 INTO wa1

VALID flag1

BOUNDS col1 AND col2

FIELDS col3 FROM itab2 INTO wa2

VALID flag2

BOUNDS col1 AND col2

BETWEEN 2 AND 14.

WRITE: / wa1-col1, wa1-col2, wa1-col3, flag1.

WRITE: / wa2-col1, wa2-col2, wa2-col3, flag2.

SKIP.

ENDPROVIDE.

The list output is as follows:

2 3 Itab1 Int1 X

2 3

4 6 Itab1 Int1 X

4 6 Itab2 Int1 X

7 8

7 8 Itab2 Int1 X

9 11 Itab1 Int2 X

9 11 Itab2 Int1 X

12 12 Itab1 Int2 X

12 12