Significance of Provide - endprovide in LDB
Hi experts can any one spot light on the significance of PROVIDE - ENDPROVIDE in LDB? and what is the difference between LOOP - ENDLOOP and
PROVIDE - ENDPROVIDE.
Thanks in advance.
vamsi.
1) Provide :
Its used to FETCH data from INTERNAL TABLE.
Its also used in logical databases like pnp,
where the actual data is retrived by
the logical database itself,
and our provide statement, JUST,
fetches from the internal table in ldb program.
2) Retrieves the contents of the specified fields from the internal tables and places them in the table header lines within the required range.
Provide is similar to outer join of tables.
3) Provide:
PROVIDE f1 f2 ... FROM itab1
g1 g2 ... FROM itab2
FROM itabi
BETWEEN f AND g.
Similar Messages
-
Difference between Provide - Endprovide.
Hi experts can any one spot light on the significance of PROVIDE - ENDPROVIDE in LDB? and what is the difference between LOOP - ENDLOOP and
PROVIDE - ENDPROVIDE.
Thanks in advance.
vamsi.Hi
You can go through help doc .
PROVIDE - ENDPROVIDE is similar like Loop
LOOP - ENDLOOP
[<b>b]Reminder : Points should be given on answers.</b></b> -
Provide - Endprovide with SD n MM modules
Hi experts can any one tell me im learning ABAP-HR, in this im working with LDB, i have a doubt that can't we use Provide - Endprovide of LDB with SD and MM Modules .
Hi Madhu,
Please find the below program which displays the available user exits for the specified transaction code. Just you need to specify the transaction code it will display all the user exits of the transaction.
Use the following link for the above from ****************
http://****************/Tutorials/ExitsBADIs/FindUserExitswithTCode.htm
You can also find some scenarios in **************** for the user exits and Badis.
Explore the **************** site.
Thanks,
Naveen Kumar. -
Is PROVIDE-ENDPROVIDE statement obsolete ? Can I use it from now onwards?
Hello Techies..
I am working on HR ABAP, I have used PNP LDB extensively.
I came to know from SAP help that Provide-Endprovide statement has been obsolete in newer version of
SAP. I am aware that it is obsolete in ABAP OO context. But does that mean - we should not use provide - endprovide in our report(type 1 program).
I would be glad if you can focus some light on this point.
My second doubt:
I am using PNP LDB, can I replace PNP by PNPCE (since PNP is replaced by PNPCE in newer version).
If I do so my existing functionality will be affected.
Can you give me a brief of added features of PNPCE?
Points will be rewarded to satisfying answer !!
Regards,
Mihir.>
Mihir Nagar wrote:
> I came to know from SAP help that Provide-Endprovide statement has been obsolete in newer version of SAP. I am aware that it is obsolete in ABAP OO context.
> Mihir.
Hello Mihir,
That is not correct. The syntax for PROVIDE statement has changed in the newer version as a result the old syntax has been declared obsolete by SAP but that is not to say that the PROVIDE statement itself has become obsolete, if I understand you correctly.
Here's the (old) syntax which has become obsolete:
PROVIDE {*|{comp1 comp2 ...}} FROM itab1
{*|{comp1 comp2 ...}} FROM itab2
BETWEEN extliml AND extlimu.
And here's the (new) syntax for the same PROVIDE statement which you should use in the newer SAP releases:
PROVIDE FIELDS {*|{comp1 comp2 ...}}
FROM itab1 INTO wa1 VALID flag1
BOUNDS intliml1 AND intlimu1
[WHERE log_exp1]
FIELDS {*|{comp1 comp2 ...}}
FROM itab2 INTO wa2 VALID flag2
BOUNDS intliml2 AND intlimu2
[WHERE log_exp2]
BETWEEN extliml AND extlimu
[INCLUDING GAPS].
ENDPROVIDE.
Note the changes in the syntax. The new syntax can be used to evaluate and process records in an internal table the same way you used to with the old syntax depending on the options you are using from the new syntax. In summary, the new syntax is able to do exactly the same processing as the old but only difference in the new syntax is that the introduction of additional keywords like FIELDS, VALID and BOUNDS. You'll also notice that the new syntax requires a single workarea to read the record in the provide-endprovide loop unlike the old syntax where it did not require an explicit workarea.
>
Mihir Nagar wrote:
> My second doubt:
> I am using PNP LDB, can I replace PNP by PNPCE (since PNP is replaced by PNPCE in newer version). If I do so my
> existing functionality will be affected. Can you give me a brief
> of added features of PNPCE?
> Mihir.
It only makes sense to use PNPCE if your comany uses the SAP functionality of Concurrent Employment (CE) in HR - i.e. this feature is turned on (active) via the IMG. If CE is not active there's no problem continuing to use PNP as this is not declared obsolete or anything like that but SAP recommends that all new developments should use LDB PNPCE - I understand existing developements should be fine (as long they don't have to handle CE scenarios).
So let me know if CE is active and you need to replace all PNP reports with PNPCE and I'll be happy to send you an overview with code snippets etc.
Hope this helps and please don't forget to reward points.
Cheers,
Sougata. -
PROVIDE - ENDPROVIDE in HR ABAP
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.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 -
Macros versus provide -endprovide
Why do we use MACRO instead of provide- endprovide in HR sometimes ?
Is it that we have to use macro when we are using logical database for reporting of PD under HR.I cannot tell in terms of HR but in a general sense, PROVIDE will work only with internal tables. It is a kind of outer join concept as it relates to database tables.
MACRO is just a name given to an executable piece of code. So I can define a macro GET_ME_SUM_OF that adds two numbers and puts it into a variable as follows.
DEFINE GET_ME_SUM_OF.
&3 = &1 + &2.
END-OF-DEFINITION.
Now in my program I can simply write get_me_sum_of 1 2 v_sum, which will get me the sum of 1 and 2 and puts 3 into the variable v_sum.
Srinivas -
Hi,
I am using PNP ldb as we know that we will get a standard selection screen by using pnp and I have to add 4 extra fields to the existing selection screen then I have created by using select-options in the program.
Now my question is .. Can we skip the standard selection screen .
I hope u got.
Regards
AnilHi
PROVIDE
PROVIDE FIELDS {*|{comp1 comp2 ...}}
FROM itab1 INTO wa1 VALID flag1
BOUNDS intliml1 AND intlimu1
[WHERE log_exp1]
FIELDS {*|{comp1 comp2 ...}}
FROM itab2 INTO wa2 VALID flag2
BOUNDS intliml2 AND intlimu2
[WHERE log_exp2]
BETWEEN extliml AND extlimu
[INCLUDING GAPS].
ENDPROVIDE.
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.
To be able to process internal tables using PROVIDE, all tables itab1 itab2 ... must be fully typed index tables and contain two special columns that have the same data type (d, i, n, or t) for all relevant tables. For every table you must specify the names intliml1 intliml2 ... and intlimu1 intlimu2 ... of these columns using the addition BOUNDS.
The columns intliml1 intliml2 ... and intlimu1 intlimu2 ... in every row of the relevant internal tables must contain values that can be interpreted as limits of closed intervals. Within a table, the intervals specified in these columns must not overlap and must be sorted in ascending order. The intervals therefore make up a unique key for every row.
For every table you must specify a work area wa1 wa2 ... compatible with the row type and a variable flag1 flag2 ..., for which a character-type data type with length 1 is expected. In the PROVIDE loop, the components specified after FIELDS are filled with values in the relevant work areas wa1 wa2 ... for every specified internal table. The variables flag1 flag2 ... are also filled. A work area wa1 wa2 ... or a variable flag1 flag2 ... cannot be specified more than once.
With the BETWEEN addition you must specify an interval extliml, extlimu. It must be possible to convert the data objects extliml and extlimu into the data types of the respective columns intliml1 intliml2 ... and intlimu1 intlimu2 ... of the individual tables.
The interval limits intliml1 intliml2 ... and intlimu1 intlim2 for every row of all relevant internal tables itab1 itab2 ... that are within the closed interval made up by extliml and extlimu divide the latter into new intervals and every interval limit closes one interval in the original direction. If, within a relevant table, a lower interval limit follows an upper interval limit with no space or gap between them and the components of the corresponding rows specified after FIELDS have the same content, the two intervals are combined and the corresponding interval limits intliml1 intliml2 ... and intlimu1 intlimu2 ... are ignored for the new intervals.
For every interval that is created in such a way and overlaps with at least one of the intervals of a table involved, the PROVIDE loop is passed once. The components of every work area wa1 wa2 ... specified after FIELDS and the variables flag1 flag2 ... are filled with values as follows:
The components intliml1 intliml2 ... and intlimu1 intlimu2 ... of every work area wa1 wa2 ... are filled with the interval limits of the current interval.
If the current interval overlaps with one of the intervals of an involved table, the remaining components of the corresponding work area are assigned the contents of the relevant components of this table row and the variable flag1 flag2 ... is set to the value "X". Otherwise, the work area components and the variables flag1 flag2 ... are set to their Initial value.
Except for intliml1 intliml2 ... and intlimu1 intlimu2 ..., the components not specified after FIELDS are always set to their initial value. The components intliml1 intliml2 ... and intlimu1 intlimu2 ... are always assigned.
The ABAP runtime environment checks for every table involved, whether the condition of sorted and non-overlapping intervals is met within the interval made up by extliml and extlimu and, if necessary, triggers an exception that can be handled.
If the INCLUDING GAPS addition is specified, the system passes the PROVIDE loop for every interval, that is also when the current interval does not overlap with at least one of the intervals of an involved table. In the latter case, the variable flag is of initial value for every relevant table.
You can use the WHERE addition to specify a condition for every table itab1 itab2 ... involved. After WHERE, you can specify any logical expression log_exp1 log_exp2 ... ; the first operand of every comparison must be a component of the internal table. As such, all logical expressions except for IS ASSIGNED, IS REQUESTED, and IS SUPPLIED are possible. You can only specify components that are in the list after FIELDS. Here it is not possible to specify a component using character-type data objects in brackets. The table entries for which the condition is not met are ignored by the PROVIDE loop. You can leave the PROVIDE loop following the instructions in the section Leaving loops.
<b>System fields</b>
The system fields sy-subrc and sy-tabix are set to the value 0 before every loop pass and at ENDPROVIDE. Only if the loop is not passed once, is sy-subrc set to 4 at ENDPROVIDE.
The relevant internal tables should not be modified in the PROVIDE loop.
The WHERE condition can be used to remove overlaps between the tables involved or to ensure the sorting of the intervals.
In two tables itab1 and itab2, the respective columns col1 and col2 are interval limits of type i. The filling of the internal tables results in the following intervals (rows two and three):
The interval specified in the BETWEEN addition to the PROVIDE statement is shown in the fourth row. It serves as a basis for the five intervals in the fifth row represented by i1 to i5. These can be processed in the PROVIDE loop.
Because each of the five intervals overlaps with one of the intervals from rows two and three, the PROVIDE loop is passed five times.
Only the component col3 of wa1 is filled in the first pass, only the component col3 of wa2 in the third pass, and the components col3 of both work areas in the second and fourth passes. The fields valid1 and valid2 are set accordingly.
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
<b>REWARD IF USEFULL</b> -
Using Provide-endprovide copy internal table
Hi,
I have problem that is if i want to copy the data from infotype to internal table means
Provide * from p9012 between pn-begda and pn-endda.
if p9012-zz_client_c EQ itemp-z_client_c.
MOVE: p9012-begda TO it9012-begda,
p9012-zz_dept_c TO it9012-z_dept_c,
SORT IT9012 BY z_dept_c.
append it9012.
endif.
endprovide.
this one not copying data from infotype to internaltable.
what i can do?
Thanks,
Regards,
NandhaHI Use this code example..
plz reward poins if it helps you..
& Report ZSAPHR_PNP
Report ZSAPHR_PNP.
TABLES : PERNR.
*Infotype Declaration
INFOTYPES: 0002, "PERSONAL DATA
0006, "ADDRESS
0008, "
0000, "
0001. "ACTIONS
DATA : BEGIN OF ITAB OCCURS 10, "INTERNAL TABLE DECLARATION
NACHN LIKE P0002-NACHN,
VORNA LIKE P0002-VORNA,
GESCH LIKE P0002-GESCH,
GBDAT LIKE P0002-GBDAT,
FAMST LIKE P0002-FAMST,
HSNMR LIKE P0006-HSNMR,
STRAS LIKE P0006-STRAS,
LOCAT LIKE P0006-LOCAT,
PSTLZ LIKE P0006-PSTLZ,
LAND1 LIKE P0006-LAND1,
PLANS LIKE P0001-PLANS,
ORGEH LIKE P0001-ORGEH,
BET01 LIKE P0008-BET01,
WAERS LIKE P0008-WAERS,
PERNR LIKE P0000-PERNR,
END OF ITAB.
DATA: G_REPID LIKE SY-REPID."Report name
INITIALIZATION.
G_REPID = SY-REPID.
PNPTIMED = 'D'.
**********************************************START OF
SELECTION*****************************************
START-OF-SELECTION.
GET PERNR.
PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.
ITAB-PERNR = P0000-PERNR.
ITAB-NACHN = P0002-NACHN.
ITAB-VORNA = P0002-VORNA.
IF P0002-FAMST = '0'.
ITAB-FAMST = 'S'.
ELSE.
ITAB-FAMST = 'M'.
ENDIF.
ITAB-FAMST = P0002-FAMST.
IF P0002-GESCH = '1'.
ITAB-GESCH = 'M'.
ELSE.
ITAB-GESCH = 'F'.
ENDIF.
ITAB-GBDAT = P0002-GBDAT.
ITAB-HSNMR = P0006-HSNMR.
ITAB-STRAS = P0006-STRAS.
ITAB-LOCAT = P0006-LOCAT.
ITAB-PSTLZ = P0006-PSTLZ.
ITAB-LAND1 = P0006-LAND1.
ITAB-ORGEH = P0001-ORGEH.
ITAB-PLANS = P0001-PLANS.
ITAB-BET01 = P0008-BET01.
ITAB-WAERS = P0008-WAERS.
APPEND ITAB.
ENDPROVIDE.
END-OF-SELECTION. -
Provide, endprovide and protect
what is the difference between provide..endprovide and protect...endprotect statements
Title edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:51 AMHi Sudheer,
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.
Preventing Page Breaks: PROTECT
You can specify, either in the style or in the form, that a particular paragraph should not be split in two by a page break. If this page protect attribute is set, then the complete paragraph is always printed on one page. This property applies only to that particular paragraph.
This attribute is not intended to be used to protect all paragraphs against a page break. The point is that a page break is by its very nature a dynamic event and the exact point at which it occurs depends on the current state (length and contents) of the preceding text. It is also possible that you may want to protect only certain parts of a paragraph against a page break. One way to achieve this is to use the NEW-PAGE command immediately before the text concerned starts. Explicitly beginning a new page at this point should ensure that a further page break does not occur within the text. However, this technique is not change-friendly. For example, you format your text with the help of the NEW-PAGE command so that no page breaks occur where they should not. At a later time, you insert or delete some lines. These changes cause all the subsequent text to be moved relative to the printed page, and you must check each NEW-PAGE command you previously inserted to see if it is still in the correct place.
To allow you to define the areas to be protected against a page break on an individual basis, SAPscript provides the PROTECT.. ENDPROTECT command pair. If you enclose the text to be protected in these commands, then SAPscript will ensure that each line of this text is printed together on the same page. If the complete text fits in the space remaining on the current page, then it is printed on this page just as it would be if no PROTECT command had been used. If, however, the remaining space is not sufficient for the text, then the PROTECT command has the same effect as a NEW-PAGE command and text is printed on a new page.
Thus the PROTECT/ENDPROTECT commands may be regarded as a kind of conditional NEW-PAGE command, the condition being whether or not the lines enclosed between the two commands fit in the space remaining in the current main window.
Syntax:
/: PROTECT
/: ENDPROTECT
The text lines to be protected are enclosed between the two commands.
o An ENDPROTECT command without a preceding PROTECT command has no effect.
o If the terminating ENDPROTECT is missing, SAPscript assumes it at the end of the text.
o PROTECT.. ENDPROTECT command pairs cannot be nested. If a second PROTECT command occurs before the first one has been terminated by an ENDPROTECT, it is ignored.
o If the text enclosed by a PROTECT.. ENDPROTECT pair is itself too long for a single page, then a page break is generated immediately before the text and the text is printed in the normal way. It is then unavoidable that a page break will occur at some point within the text.
<REMOVED BY MODERATOR>
Regards,
Nitin.
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 6:51 AM -
RP_PROVIDE_FROM_LAST AND PROVIDE AND ENDPROVIDE
hi all,
When to use RP_PROVIDE_FROM_LAST and Provide and EndProvide?
which scenario we go for RP_PROVIDE_FROM_LAST and Provide?
both will do the same purpose?
RP_PROVIDE_FROM_LAST will read recent records.
Provide will read sequentially data.
other than this...difference
can anyone clear my doubt?Hi,
For PROVIDE-ENDPROVIDE :
1) You can fetch individual fields of the infotypes.
2) You can also use the JOIN and PROJECTION of infotypes. Based on the criteria, datas can be fetched from two or more infotypes.
3) It is similar to the SELECT STATEMENT of normal ABAP.
4) You can do processing within the Block of PROVIDE - ENDPROVIDE
For RP_PROVIDE_FROM_LAST:
1) You fetch only the recent record of the Infotype.
2) This is a MACRO delivered by SAP and not a statement. You can also create something similar to this.
Regards,
Anirban -
Re-write provide statement with loop
Hello,
I am a bit confused how to rewrite a provide statement but with loop instead.
For example, how would the following code be written with 'loop at':
PROVIDE * FROM P0001
FROM P0016 BETWEEN '20020401' AND '20061001'
ENDPROVIDE
Thanks for your help.Data Retrieval from LDB
1. Create data structures for infotypes.
INFOTYPES: 0001, "ORG ASSIGNMENT
0002, "PERSONAL DATA
0008. "BASIC PAY
2. Fill data structures with the infotype records.
Start-of-selection.
GET PERNR.
End-0f-selection.
Read Master Data
Infotype structures (after GET PERNR) are internal tables loaded with data.
The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
GET PERNR.
PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. endif.
ENDPROVIDE.
Period-Related Data
All infotype records are time stamped.
IT0006 (Address infotype)
01/01/1990 12/31/9999 present
Which record to be read depends on the date selection period specified on the
selection screen. PN/BEGDA PN/ENDDA.
Current Data
IT0006 Address - 01/01/1990 12/31/9999 present
RP-PROVIDE-FROM-LAST retrieves the record which is valid in the data selection period.
For example, pn/begda = '19990931' pn/endda = '99991231'
IT0006 subtype 1 is resident address
RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
hope it will be of help to u. -
How to Add a new fields in the selection screen of LDB.
Hi All,
I want to add a new fields in the selection screen of LDB & then i need to select the data for that fields.
So could you please tell me for that where i need to add the code for selecting the data.
Thanks
RoliHi
welcome to SDN forum
If you are designing your own LDB with your own tables you can define tree structure and then the selection screen for the tables
if you wants to modify the std LDB of SAp means take the access key and to modify that code
if you add the extra field you have to modify the where conditions in the code also
see the doc
A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.
LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.
Less coding s required to retrieve data compared to normal internel tables.
Tables used LDB are in hierarchial structure.
Mainly we used LDBs in HR Abap Programming.
Where all tables are highly inter related so LDBs can optimize the performance there.
Check this Document. All abt LDB's
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2flibrary%2fabap%2fabap-code-samples%2fldb+browser.doc
GO THROUGH LINKS -
http://www.sap-basis-abap.com/saptab.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
Re: **LDB**
www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html
www.sap-img.com/abap/abap-interview-question.htm
www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm
Gothru the blog which provides info on LDB's:
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
Sample code
TABLES: SPFLI,
SFLIGHT,
SBOOK,
SCARR.
START-OF-SELECTION.
GET SPFLI.
WRITE:/ SPFLI: , SPFLI-CARRID, SPFLI-CONNID,
SPFLI-AIRPFROM, SPFLI-AIRPTO.
GET SFLIGHT.
WRITE:/ SFLIGHT: , SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.
GET SBOOK.
WRITE:/ SBOOK: , SBOOK-CARRID, SBOOK-CONNID,
SBOOK-FLDATE, SBOOK-BOOKID.
GET SFLIGHT LATE.
WRITE:/ GET SFLIGHT LATE: , SFLIGHT-FLDATE.
Regards
anji -
Hi,
I use report RFDOPR10 which i copied into ZRFDOPR10 . This report uses
a LDB DDF. In the new report i need to set some values in the selection-screen such as DD_UMSKZ but can't catch up the screen field name.
Is there a way to solve it?
ThanksA logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.
LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.
Less coding s required to retrieve data compared to normal internel tables.
Tables used LDB are in hierarchial structure.
Mainly we used LDBs in HR Abap Programming.
Where all tables are highly inter related so LDBs can optimize the performance there.
Check this Document. All abt LDB's
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2flibrary%2fabap%2fabap-code-samples%2fldb+browser.doc
GO THROUGH LINKS -
http://www.sap-basis-abap.com/saptab.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
Re: **LDB**
www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html
www.sap-img.com/abap/abap-interview-question.htm
www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm
Gothru the blog which provides info on LDB's:
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
Sample code
TABLES: SPFLI,
SFLIGHT,
SBOOK,
SCARR.
START-OF-SELECTION.
GET SPFLI.
WRITE:/ SPFLI: , SPFLI-CARRID, SPFLI-CONNID,
SPFLI-AIRPFROM, SPFLI-AIRPTO.
GET SFLIGHT.
WRITE:/ SFLIGHT: , SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.
GET SBOOK.
WRITE:/ SBOOK: , SBOOK-CARRID, SBOOK-CONNID,
SBOOK-FLDATE, SBOOK-BOOKID.
GET SFLIGHT LATE.
WRITE:/ GET SFLIGHT LATE: , SFLIGHT-FLDATE. -
Dear All,
I have written a program for using Logical Database PNP displaying employee data which are fetched from different infotypes. I have used PROVIDE END PROVIDE Statement. In the Report it is found that it is Printing PN-BEGDA and PN-ENDDA value for P0001-BEGDA and P0001-ENDDA when User selects following values in Selection Screen.
1) Today
2) Current Month
3) Current Year
4) Up to Today
5) From Today
if require I will send the code.
Thanks in Advance
Regards
MangeshHi Mangesha,
<li>PROVIDE-ENDPROVIDE is like LOOP-ENDLOOP but It creates partial periods.
Lets say we have two records for one employee in itab p0001.We give dates on selection-screen 01.06.2008 to 01.06.2009.
Lets say p0000 has two records
1).. 01.01.2008 to 31.12.2009 -first record
2).. 01.01.2009 to 31.12.2009 -second record
If use PROVIDE statement to loop the p0000 table, It is looped two times. But if you see P000-BEGDA and P0000-ENDDA inside PROVIDE-ENDPROVIDE, the records are like below.
p0000-begda -- p0000-endda
01.06.2008 -- 31.12.2009
01.01.2009 -- 01.06.2009.
<li>It can be used to join tables more tables
Thanks
Venkat.O -
Hello All,
Can someone please tell me how does a PROVIDE statement work? How does it help retrieve data from multiple infotypes?
Thanks.
Regards,
KPPROVIDE
Variants:
1. PROVIDE { FIELDS {*|{compi}}
FROM itabj INTO waj VALID flagj
BOUNDS intlim1j AND intlim2j
[WHERE log_expj] }
BETWEEN extlim1 AND extlim2
[INCLUDING GAPS].
2. PROVIDE { {*|{compi}}
FROM itabj }
BETWEEN extlim1 AND extlim2.
Effect
Special join for internal tables. Variant 1 is the universally applicable form of the PROVIDE statement. Variant 2 is a short form of variant 1 that is not permitted in ABAP Objects.
Variant 1
PROVIDE { FIELDS {*|{compi}}
FROM itabj INTO waj VALID flagj
BOUNDS intlim1j AND intlim2j
[WHERE log_expj] }
BETWEEN extlim1 AND extlim2
[INCLUDING GAPS].
Effect
The statements PROVIDE and ENDPROVIDE define a loop through a statement block. In this loop, any number of internal tables itabj are processed together. A single table can appear several times. For every table itabj you must specify a FIELDS clause. After FIELDS you must specify the character * for all components or a list compi for specific components of the relevant table. The names of the components compi can only be specified directly.
To be able to process internal tables using PROVIDE, all tables itabj must be fully typed index tables and contain two special columns that have the same data type (d, i, n, or t) for all relevant tables. For every table you must specify the names intlim1 and intlim2 of these columns using the BOUNDS addition.
The columns intlim1 and intlim2 in every row of the relevant internal tables must contain values that can be interpreted as limits of closed intervals. Within a table, the intervals specified in these columns must not overlap and must be sorted in ascending order. The intervals therefore make up a unique key for every row.
For every table you must specify a work area waj compatible with the row type and a variable flagj, for which a character-type data type with length 1 is expected. In the PROVIDE loop, the components specified after FIELDS are filled with values in the relevant work areas waj for every specified internal table. The variable flagj is also filled. A single work area waj or variable flagj cannot be specified more than once.
With the BETWEEN addition you must specify an interval extlim1, extlim2. It must be possible to convert the data objects extlim1 and extlim2 into the data types of the respective columns intlim1 and intlim2 of the individual tables.
The interval limits intlim1j and intlim2j for every row of all relevant internal tables itabj that are within the closed interval made up by extlim1 and extlim2 divide the latter into new intervals and every interval limit closes one interval in the original direction. If, within a relevant table, a lower interval limit follows an upper interval limit with no space or gap between them and the components of the corresponding rows specified after FIELDS have the same content, the two interval limits are combined and the corresponding interval limits intlim2j and intlim1j are ignored for the new intervals.
For every interval that is created in such a way and overlaps with at least one of the intervals of a table involved, the PROVIDE loop is passed once. The components of every work area waj specified after FIELDS and the variable flagj are filled with values as follows:
The components intlim1 and intlim2 of every work area waj are filled with the interval limits of the current interval.
If the current interval overlaps with one of the intervals of an involved table, the remaining components of the corresponding work area are assigned the contents of the relevant components of this table row and the variable flagj is set to the value "X". Otherwise, the work area components and the variable flagj are set to their initial value.
Except for intlim1j and intlim2j, the components not specified after FIELDS are always set to their initial value. The components intlim1j and intlim2j are always assigned.
The ABAP runtime environment checks for every table involved, whether the condition of sorted and non-overlapping intervals is met within the interval made up by extlim1 and extlim2 and, if necessary, triggers an exception that can be handled.
If the INCLUDING GAPS addition is specified, the system passes the PROVIDE loop for every interval, that is also when the current interval does not overlap with at least one of the intervals of an involved table. In the latter case, the variable flagj is of initial value for every relevant table.
You can use the WHERE addition to specify a condition for every table involved. After WHERE, you can specify any logical expression log_exp; the first operand of every comparison must be a component of the relevant table. Here it is not possible to specify a component using character-type data objects in brackets. The table entries, for which the condition is not met are ignored by the PROVIDE loop.
Notes
The system fields sy-subrc and sy-tabix are set to the value 0 before every loop pass and at ENDPROVIDE. Only if the loop is not passed once, is sy-subrc set to 4 at ENDPROVIDE.
The relevant internal tables should not be modified in the PROVIDE loop.
The WHERE condition can be used to remove overlaps between the tables involved or ensure the sorting of the intervals.
Example
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'.
APPEND wa2 TO itab2.
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.
In two tables itab1 and itab2, the respective columns col1 and col2 are interval limits of type i. The filling of the internal tables results in the following intervals (rows two and three):
|01|02|03|04|05|06|07|08|09|10|11|12|13|14|
| Itab1 Int1 | |Itab1 Int2 | |
| | Itab2 Int1 | |
| | ... BETWEEN ... |
| | i1 | i2 | i3 | i4 |i5| |
The interval specified in the AB>BETWEEN addition to the PROVIDE statement is shown in the fourth row. It serves as a basis for the five intervals in the fifth row represented by i1 to i5. These can be processed in the PROVIDE loop.
Because each of the five intervals overlaps with one of the intervals from rows two and three, the PROVIDE loop is passed five times.
Only the component col3 of wa1 is filled in the first pass, only the component col3 of wa2 in the third pass, and the components col3 of both work areas in the second and fourth passes. The fields valid1 and valid2 are set accordingly.
The list is displayed 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
Exceptions
Catchable Exceptions
CX_SY_PROVIDE_INTERVAL_OVERLAP
Cause: In one of the tables involved, there are overlapping intervals within extlim1 and extlim2.
Runtime Error: UNCAUGHT_EXCEPTION
CX_SY_PROVIDE_TABLE_NOT_SORTED
Cause: One of the involved tables is not sorted in ascending order by the intervals within extlim1 and extlim2.
Runtime Error: UNCAUGHT_EXCEPTION
Variant 2
PROVIDE { {*|{compi}}
FROM itabj }
BETWEEN extlim1 AND extlim2.
This statement is not allowed in an ABAP Objects context. See Cannot Use Short Form of PROVIDE.
Effect
This form of the PROVIDE statement is a short form of variant 1. The compiler distinguishes the long and short forms by language elements FIELDS to be specified explicitly before the component specifications.
In principle, the short form of the PROVIDE statement works like variant 1. Unlike variant 1 however, fewer additions are allowed here. In the short form, you cannot specify a table several times The internal tables must have headers and the additions that have to be specified in the long form are added by the runtime environment, as described below.
For the PROVIDE loop to function correctly, the same conditions apply as in the long form. However, now exceptions are raised if one of the involved tables is not sorted or 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 END OF if an internal table is declared with 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 implicitly used for the work areas that have to be specified as wa in the long form using the AB>INTO addition.
VALID flag
The data objects that have to be specified as flag in the long form using the VALID addition are added in the short form by the system implicitly creating a data object itab_valid of type c and length 1 for every table itab.
WHERE condition
No conditions can be specified in the short form.
INCLUDING GAPS addition
In the short form, you cannot force the system to pass the PROVIDE loop for every interval.
Notes
The short form of the PROVIDE statement is especially useful with internal tables declared using INFOTYPES, or internal tables that have the structure of infotypes.
The system fields sy-tabix and sy-subrc are not filled by the short form for PROVIDE - ENDPROVIDE.
Example
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.
PROVIDE col3 FROM itab1
col3 FROM itab2
BETWEEN 2 AND 14.
WRITE: / itab1-col1, itab1-col2, itab1-col3, itab1_valid.
WRITE: / itab2-col1, itab2-col2, itab2-col3, itab2_valid.
SKIP.
ENDPROVIDE.
The example has the same result as the example for variant 1. Here, the tables itab1 and itab2 have headers and the columns col1 and col2 are defined as interval limits of type i using the VALID addition to the DATA END OF statement.
awrd points if useful
Bhupal
Maybe you are looking for
-
HT1267 How do I delete an Apple account from my iphone
I have just got a reconditioned iphone as my original one broke. It has got an apple ID email address on it which isn't my own. How do I delete that account and add my own account to the phone.
-
Error while doing asset retiremnt entry
Hi, While doing Asset Retiremnt through f-92 sale with revenue to customer. Geeting error message as ' Auxiliary Account Assingment to asset not possible, remove entry" I have given 1st line tem as customer account 2nd as asset sale offset account. A
-
I have three tabs in my application. What i want is to display a warning message when the user tries to go from one tab to another with Yes and No options. If Yes clicked then navigate to the new tab if No is clicked then remain on the same tab. Can
-
How do I create a brand new .pat file?
I am attempting to create a set of patterns to share online, and I cannot figure out how to create a truly custom .pat file. I fully understand how to define a pattern in photoshop, however, the only way I've ever known about accessing and permanentl
-
Disable Sleep Mode When Closing Lid
Is it possible to disable this? It is really inconvenient and annoying. I don't want my computer open on my desk when its simply playing music or streaming media. Also, sleep obviously logs me off instant messengers. This is also inconvenient when mo