SAP PROVIDE - Obsolete ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for PROVIDE_OBSOLETE

PROVIDE - Short form:
ABAP Code Snippet

Short Reference
• PROVIDE ABAP Statement
• FROM PROVIDE - obsolete
• * PROVIDE - obsolete
• BETWEEN PROVIDE - obsolete

ABAP Syntax(Obsolete)PROVIDE {*|{comp1 comp2 ...}} FROM itab1
{*|{comp1 comp2 ...}} FROM itab2
...
BETWEEN extliml AND extlimu.

What does it do? This form of the PROVIDE statement, not permitted in classes, is a short form of the permitted variant . The compiler distinguishes the long and short forms by the additions FIELDS, to be specified explicitly before the components.

The short form is exclusively intended for editing internal tables for HR info types, which have been declared with the special INFOTYPES statements or which have the same structure.

In principle, the short form of the PROVIDE statement works like the permitted variant. Unlike the permitted variant, however, fewer additions are allowed here. In the short form, a table cannot be specified more than once. The internal tables must have header lines and the additions that have to be specified in the long form are enhanced in the short form by the runtime environment, as described below.

For the PROVIDE loop to function correctly, the same conditions apply as in the long form. However, no exceptions are raised if one of the involved tables is not sorted or if there are overlapping intervals.

Interval limits BOUNDS The columns for interval limits to be specified in the long form as intlim1 and intlim2 using BOUNDS are attributes of the relevant tables in the short form and must be specified when they are declared.

This is done using the VALID BETWEEN addition that can be specified after DATA ENDOF if an internal table is declared with the obsolete OCCURS addition to the DATA BEGIN OF statement. If an internal table is declared using the INFOTYPES statement, these are the BEGDA and ENDDA columns. If no columns are specified for the interval limits in the declaration, the short form of PROVIDE uses the first two columns of the internal table.

Work area INTO In the short form, the headers of the internal table are used implicitly for the work areas that have to be specified as wa in the long form using the INTO addition.

Flag VALID For the data objects that have to be specified as flag in the long form using the VALID addition, a data object itab_valid of type c and length 1 is created in the short form for every table itab.

Condition WHERE No conditions can be specified in the short form. Addition INCLUDING GAPS In the short form, the PROVIDE loop cannot be forced for every interval.



Latest notes:The system fields sy-tabix and sy-subrc are
not filled by the short form for PROVIDE - ENDPROVIDE.



Example ABAP Coding
This example has the same result as the example for the
long form. Here, the tables itab1 and itab2 have header lines and the columns col1 and col2 are defined as interval limits of type i using the VALID addition of the DATA END OF statement. DATA: BEGIN OF itab1 OCCURS 0,
col1 TYPE i,
col2 TYPE i,
col3 TYPE string,
END OF itab1 VALID BETWEEN col1 AND col2.

DATA: BEGIN OF itab2 OCCURS 0,
col1 TYPE i,
col2 TYPE i,
col3 TYPE string,
END OF itab2 VALID BETWEEN col1 AND col2.

itab1-col1 = 1.
itab1-col2 = 6.
itab1-col3 = 'Itab1 Int1'.
APPEND itab1 TO itab1.

itab1-col1 = 9.
itab1-col2 = 12.
itab1-col3 = 'Itab1 Int2'.
APPEND itab1 TO itab1.

itab2-col1 = 4.
itab2-col2 = 11.
itab2-col3 = 'Itab2 Int1'.
APPEND itab2 TO itab2.

DATA output TYPE TABLE OF string WITH EMPTY KEY.
PROVIDE col3 FROM itab1
col3 FROM itab2
BETWEEN 2 AND 14.
APPEND | { itab1-col1 WIDTH = 2 } { itab1-col2 WIDTH = 2 } {
itab1-col3 } { itab1_valid } | TO output.
APPEND | { itab2-col1 WIDTH = 2 } { itab2-col2 WIDTH = 2 } {
itab2-col3 } { itab2_valid } | TO output.
APPEND INITIAL LINE TO output.
ENDPROVIDE.
cl_demo_output=>display( output ).

Return to menu