SAP Certification
SAP Download
SAP Companies India
SAP Books
SAP JOBS
SAP jobs in India
SAP ABAP jobs in India
SAP BASIS jobs in India
SAP BI jobs in India
SAP CRM jobs in India
SAP FICO jobs in India
SAP Fresher jobs in India
SAP HR jobs in India
SAP MM jobs in India
SAP PM jobs in India
SAP PP jobs in India
SAP SD jobs in India
SAP XI jobs in India
|
PROVIDE is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.
Show Full Details
PROVIDE
Basic form PROVIDE f1 f2 ... FROM itab1 g1 g2 ... FROM itab2 ... * FROM itabi ... BETWEEN f AND g.
Effect Retrieves
the contents of the specified fields from the internal tables ( itab1 ,
itab2 , ...) and places them in the table header lines within the
required range. Also executes the processing block enclosed by the
PROVIDE and ENDPROVIDE statements for each range.
Note Für itab1 , itab2 ... only tables with header lines are allowed.
Effect Basic principle:
The
diagram below illustrates the functionality of the PROVIDE statement
for the most simple case where just two tables A and B are to be
processed:
IA1 IA2 ----------- -------------- table A : : : : : IB1 : IB2 : : : ----------- ------------- : table B : : : : : : : : : : PROVIDE area : : : ...----------------------------------------... : : : : : : : : :TI1: TI2 :TI3: : TI4 : TI5 : TI6 : ...------------- -----------------... result ranges
The
data structures which form the basis for the table lines must each
contain two components which can be interpreted as a range (e.g. start
date and end date). In the diagram, the ranges belonging to the entries
in table A are marked with IA1 or IA2 , and those in table B with IB1
or IB2 . If you split the ranges of both tables into overlapping and
non-overlapping ranges and then form the union set with the PROVIDE
area, this results in 6 sub-ranges TI1 to TI6 . In these sub-ranges,
the values of the tables A and B are constant. The PROVIDE statement
makes the contents of the tables A and B available for the 6
sub-ranges, one after the other. It thus acts as a kind of loop where
the data of the tables involved can be processed with reference to each
range.
Effect General principle Each of the specified
internal tables has two fields which contain the line-related validity
range. You can determine these in the DATA statement with the addition
" VALID BETWEEN ... AND ... ". If this addition is not used, sub-fields
of the table determine these range fields (e.g. VALID BETWEEN first
field AND second field). These fields can be date fields, time fields
or even number fields. Both these two fields and also f and g should be
the same type.
PROVIDE splits the range f to g into sub-ranges
so that each of the fields ( f1 , f2 , ...) specified for each table is
constant in this range and so that each sub-range is as large as
possible (range limits are considered part of the range). Each time
the processing passes through the loop, the current range limits and
the specified sub-fields are placed in the header lines of the internal
tables. If you want to make all sub-fields available, enter '*' instead
of the field list. The unspecified sub-fields are set to their initial
value (CLEAR ). It is a requirement that the ranges within a table
are in ascending order and not overlapping. However, there can be gaps
between one upper range limit and the next lower range limit.
For
each table itab1 , itab2 ... , the automatically generated fields
itab1_VALID , itab2_VALID , ... indicate (with 'X' oder Leerzeichen ' '
) whether a suitable entry was found for the current sub-range.
Example The entries in the table SE , PR and SH contain time ranges and are filled as follows:
DATA: BEGIN OF SE OCCURS 3, FROM TYPE D, TO TYPE D, NAME(15) TYPE C, AGE TYPE I, END OF SE,
BEGIN OF PR OCCURS 4, START TYPE D, END TYPE D, PRICE TYPE I, NAME(10) TYPE C, END OF PR,
BEGIN OF SH OCCURS 2, CLOSED TYPE D, STR(20) TYPE C, OPENED TYPE D, END OF SH VALID BETWEEN OPENED AND CLOSED,
BEGIN TYPE D VALUE '19910701', END TYPE D VALUE '19921001'.
SE-FROM = '19910801'. SE-TO = '19910930'. SE-NAME = 'Shorty'. SE-AGE = 19. APPEND SE. SE-FROM = '19911005'. SE-TO = '19920315'. SE-NAME = 'Snowman'. SE-AGE = 35. APPEND SE. SE-FROM = '19920318'. SE-TO = '19921231'. SE-NAME = 'Tom'. SE-AGE = 25. APPEND SE.
PR-START = '19910901'. PR-END = '19911130'. PR-NAME = 'Car'. PR-PRICE = 30000. APPEND PR. PR-START = '19911201'. PR-END = '19920315'. PR-NAME = 'Wood'. PR-PRICE = 10. APPEND PR. PR-START = '19920318'. PR-END = '19920801'. PR-NAME = 'TV'. PR-PRICE = 1000. APPEND PR. PR-START = '19920802'. PR-END = '19921031'. PR-NAME = 'Medal'. PR-PRICE = 5000. APPEND PR.
SH-CLOSED = '19920315'. SH-STR = 'Gold Avenue'. SH-OPENED = '19910801'. APPEND SH. SH-CLOSED = '19921031'. SH-STR = 'Wall Street'. SH-OPENED = '19920318'. APPEND SH.
PROVIDE NAME AGE FROM SE NAME FROM PR * FROM SH BETWEEN BEGIN AND END. ... ENDPROVIDE.
The three tables are processed according to the following schema:
ISE1 ISE2 ISE3 ------- ----------- ------------------------ : : : : : : : :IPR1 IPR2 : : IPR3 IPR4 : : ---------------- -------------------- : : : : : : : : : : : : : ISH1 : : : ISH2 : : : ---------------------- --------------------- : : : : : : : : : : : : : : : PROVIDE area : : : --------------------------------------------------... : : : : : : : : : : : : : : : : : : ...------------------ --------------------... result ranges
This PROVIDE loop is executed 7 times and produces the following sub-ranges:
01.08.1991 - 31.08.1991 01.09.1991 - 30.09.1991 01.10.1991 - 04.10.1991 05.10.1991 - 30.11.1991 01.12.1991 - 15.03.1992 18.03.1992 - 01.08.1992 02.08.1992 - 01.10.1992
In
most of the loop passes, the fields SE_VALID , PR_VALID and SH_VALID
contain 'X' . The exceptions to this are the 1st loop pass, where
PR_VALID contains ' ' , and the 3rd loop pass, where AB>SE_VALID
contains ' ' .
Field contents (header lines) during the third loop pass:
SE-FROM = '01101991' SE-TO = '04101991' SE-NAME = ' ' SE-AGE = 0 PR-START = '01101991' PR-END = '04101991' PR-PRICE = 0 PR-NAME = 'Car' SH-CLOSED = '04101991' SH-STR = 'Gold Avenue' SH-OPENED = '01101991'
Notes Strictly
speaking, if you imagine each range as a short way of writing a set of
single values, this is an "outer join" of the tables. After ENDPROVIDE
, the contents of the system fields SY-INDEX , SY-TABIX and SY-SUBRC
are undefined. Neither the header lines nor the actual table lines of
the table specified with PROVIDE should be changed between PROVIDE and
ENDPROVIDE . Otherwise, the PROVIDE results are undefined.
Show Most Readed SAP Tutorials
Most readed SAP Tutorials
Show Latest Added SAP Tutorials
Latest Added SAP documents
|
"Site covers most of the SAP technical and functional tutorials, articles, interview questions and PDF study materials . List and details of SAP transaction codes ( tcodes ), Tables, report names, Bapi, ABAP programming syntax and keywords are also available in the site.
Information on SAP Certification and training, latest SAP jobs in India, ABAP interview questions are useful for SAP professionals seeking for a career in SAP as a fresher or experienced.ABAP tutorial downloads on BDC, LSMW, BAPI, ALE, IDOC, Smartforms, Sapscripts etc etc are also added.Now you can read from this page about PROVIDE (ABAP Keyword)" |