Pl. provide ABAP logic
Can any body help me in providing the logic (ABAP logic-infopackage) for extracting data for 6th month considering sydatum.
Logic should be on Caday.
Example: If I am executing I/P today i.e. 13.01.2012, I should get the data of 01.06.2011 to 30.06.2011.
Please help.
Thanks in Advance.
Maddali VSKP
Hi,
As I am not core ABAPER, I tried below logic in the development. Logic is working fine. I am getting expected results.
DATA: l_cur_month(2) type n,
l_pre_month(2) type n,
l_cur_year(4) type n,
z_ppredat type DATS,
z_ppredat1 type INT1,
z_ppredat2(8) type n,
z_ppredat3(2) type n,
l_pre_year(4) type n.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'CALDAY'.
l_idx = sy-tabix.
l_cur_month = sy-datum+4(2).
l_cur_year = sy-datum(4).
l_pre_year = sy-datum(4).
if l_cur_month >= 7.
l_pre_month = l_cur_month - 7.
endif.
if l_cur_month <= 6.
l_pre_year = l_cur_year - 1.
l_pre_month = 12 - ( 7 - l_cur_month ).
endif.
break-point.
concatenate l_pre_year l_pre_month '01'
into z_ppredat.
CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
EXPORTING
IV_DATE = z_ppredat
IMPORTING
EV_DAYS = z_ppredat1 .
z_ppredat3 = z_ppredat1.
concatenate l_pre_year l_pre_month z_ppredat3
into z_ppredat2.
concatenate "l_pre_year l_pre_month z_ppredat1" into z_ppredat2
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
l_t_range-low = z_ppredat.
l_t_range-high = z_ppredat2.
modify l_t_range index l_idx.
p_subrc = 0.
Request you to help me to validate the logic.
Thanks in Advance,
Maddali VSKP
Similar Messages
-
Hi
How to Improve ABAP logics(Programming) in all areas.
I need guidence from you all. How to start to improve them.
Regards,
MarutiHi,
Following are the performance standards need to be following in writing ABAP programs:
1. Unused/Dead code
Avoid leaving unused code in the program. Either comment out or delete the unused situation. Use program --> check --> extended program to check for the variables, which are not used statically.
2. Subroutine Usage
For good modularization, the decision of whether or not to execute a subroutine should be made before the subroutine is called. For example:
This is better:
IF f1 NE 0.
PERFORM sub1.
ENDIF.
FORM sub1.
ENDFORM.
Than this:
PERFORM sub1.
FORM sub1.
IF f1 NE 0.
ENDIF.
ENDFORM.
3. Usage of IF statements
When coding IF tests, nest the testing conditions so that the outer conditions are those which are most likely to fail. For logical expressions with AND , place the mostly likely false first and for the OR, place the mostly likely true first.
Example - nested IF's:
IF (least likely to be true).
IF (less likely to be true).
IF (most likely to be true).
ENDIF.
ENDIF.
ENDIF.
Example - IF...ELSEIF...ENDIF :
IF (most likely to be true).
ELSEIF (less likely to be true).
ELSEIF (least likely to be true).
ENDIF.
Example - AND:
IF (least likely to be true) AND
(most likely to be true).
ENDIF.
Example - OR:
IF (most likely to be true) OR
(least likely to be true).
4. CASE vs. nested Ifs
When testing fields "equal to" something, one can use either the nested IF or the CASE statement. The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
5. MOVE statements
When records a and b have the exact same structure, it is more efficient to MOVE a TO b than to MOVE-CORRESPONDING a TO b.
MOVE BSEG TO *BSEG.
is better than
MOVE-CORRESPONDING BSEG TO *BSEG.
6. SELECT and SELECT SINGLE
When using the SELECT statement, study the key and always provide as much of the left-most part of the key as possible. If the entire key can be qualified, code a SELECT SINGLE not just a SELECT. If you are only interested in the first row or there is only one row to be returned, using SELECT SINGLE can increase performance by up to three times.
7. Small internal tables vs. complete internal tables
In general it is better to minimize the number of fields declared in an internal table. While it may be convenient to declare an internal table using the LIKE command, in most cases, programs will not use all fields in the SAP standard table.
For example:
Instead of this:
data: t_mara like mara occurs 0 with header line.
Use this:
data: begin of t_mara occurs 0,
matnr like mara-matnr,
end of t_mara.
8. Row-level processing and SELECT SINGLE
Similar to the processing of a SELECT-ENDSELECT loop, when calling multiple SELECT-SINGLE commands on a non-buffered table (check Data Dictionary -> Technical Info), you should do the following to improve performance:
o Use the SELECT into <itab> to buffer the necessary rows in an internal table, then
o sort the rows by the key fields, then
o use a READ TABLE WITH KEY ... BINARY SEARCH in place of the SELECT SINGLE command. Note that this only make sense when the table you are buffering is not too large (this decision must be made on a case by case basis).
9. READing single records of internal tables
When reading a single record in an internal table, the READ TABLE WITH KEY is not a direct READ. This means that if the data is not sorted according to the key, the system must sequentially read the table. Therefore, you should:
o SORT the table
o use READ TABLE WITH KEY BINARY SEARCH for better performance.
10. SORTing internal tables
When SORTing internal tables, specify the fields to SORTed.
SORT ITAB BY FLD1 FLD2.
is more efficient than
SORT ITAB.
11. Number of entries in an internal table
To find out how many entries are in an internal table use DESCRIBE.
DESCRIBE TABLE ITAB LINES CNTLNS.
is more efficient than
LOOP AT ITAB.
CNTLNS = CNTLNS + 1.
ENDLOOP.
12. Performance diagnosis
To diagnose performance problems, it is recommended to use the SAP transaction SE30, ABAP/4 Runtime Analysis. The utility allows statistical analysis of transactions and programs.
13. Nested SELECTs versus table views
Since releASE 4.0, OPEN SQL allows both inner and outer table joins. A nested SELECT loop may be used to accomplish the same concept. However, the performance of nested SELECT loops is very poor in comparison to a join. Hence, to improve performance by a factor of 25x and reduce network load, you should either create a view in the data dictionary then use this view to select data, or code the select using a join.
14. If nested SELECTs must be used
As mentioned previously, performance can be dramatically improved by using views instead of nested SELECTs, however, if this is not possible, then the following example of using an internal table in a nested SELECT can also improve performance by a factor of 5x:
Use this:
form select_good.
data: t_vbak like vbak occurs 0 with header line.
data: t_vbap like vbap occurs 0 with header line.
select * from vbak into table t_vbak up to 200 rows.
select * from vbap
for all entries in t_vbak
where vbeln = t_vbak-vbeln.
endselect.
endform.
Instead of this:
form select_bad.
select * from vbak up to 200 rows.
select * from vbap where vbeln = vbak-vbeln.
endselect.
endselect.
endform.
Although using "SELECT...FOR ALL ENTRIES IN..." is generally very fast, you should be aware of the three pitfalls of using it:
Firstly, SAP automatically removes any duplicates from the rest of the retrieved records. Therefore, if you wish to ensure that no qualifying records are discarded, the field list of the inner SELECT must be designed to ensure the retrieved records will contain no duplicates (normally, this would mean including in the list of retrieved fields all of those fields that comprise that table's primary key).
Secondly, if you were able to code "SELECT ... FROM <database table> FOR ALL ENTRIES IN TABLE <itab>" and the internal table <itab> is empty, then all rows from <database table> will be retrieved.
Thirdly, if the internal table supplying the selection criteria (i.e. internal table <itab> in the example "...FOR ALL ENTRIES IN TABLE <itab> ") contains a large number of entries, performance degradation may occur.
15. SELECT * versus SELECTing individual fields
In general, use a SELECT statement specifying a list of fields instead of a SELECT * to reduce network traffic and improve performance. For tables with only a few fields the improvements may be minor, but many SAP tables contain more than 50 fields when the program needs only a few. In the latter case, the performace gains can be substantial. For example:
Use:
select vbeln auart vbtyp from table vbak
into (vbak-vbeln, vbak-auart, vbak-vbtyp)
where ...
Instead of using:
select * from vbak where ...
16. Avoid unnecessary statements
There are a few cases where one command is better than two. For example:
Use:
append <tab_wa> to <tab>.
Instead of:
<tab> = <tab_wa>.
append <tab> (modify <tab>).
And also, use:
if not <tab>[] is initial.
Instead of:
describe table <tab> lines <line_counter>.
if <line_counter> > 0.
17. Copying or appending internal tables
Use this:
<tab2>[] = <tab1>[]. (if <tab2> is empty)
Instead of this:
loop at <tab1>.
append <tab1> to <tab2>.
endloop.
However, if <tab2> is not empty and should not be overwritten, then use:
append lines of <tab1> [from index1] [to index2] to <tab2>. -
ABAP Logic in Transformations-Start or Field Routine
Hi Experts,
As i am new to BW Please update me with the ABAP logic i need to implement in Transformation routine...and please advise me wether i can use that as a Start or field routine for a better performance.
Target DSO:
DSO A : Active Table:/BIC/AZDSOA
Fields (ZLOC,ZPAY_ID,ZNPAY_ID,ZOPAY_ID & ZCHG_DTE)
Source DSO
DSO B : Active Table:/BIC/BZDSOA
(ZLOC,ZPAY_ID)
DSO C : Active Table:/BIC/CZDSOA
Fields (ZLOC,ZPAY_ID,ZNPAY_ID & ZCHG_DTE(date))
While Transfering Data from DSO B-->DSO A
It should check DSO C for that ZLOC & ZPAY_ID
If ZCHG_DTE IS Blank then it should pick ZNPAY_ID for that ZLOC & ZPAY_ID from DSO C and update ZNPAY_ID in DSO A
if ZCHG_DTE IS not Blank then it should pick ZPAY_ID for that ZLOC & ZPAY_ID from DSO C and update ZOPAY_ID & ZCHG_DTE in DSO A
ZPAY_ID - Pay ID
ZNPAY_ID -New Pay ID
ZOPAY_ID -Old Pay ID
ZCHG_DTE -Change Date
ZLOC -Location.
Logic in words:
If Change date is Blank then it should pick new pay id for that Location & Pay Id and update NEw pay id field in DSO A
If Change date is not Blank then it should pick pay id for that Location & Pay Id and update old pay id field & change date in DSO A
Please update me with releavent code
ThanksIt must have something to do with your input variables - I ran this FM locally using my DOB and today's date and it worked fine.
make sure your input date types are in the correct format for the FM. -
Expalin about ABAP Logical errors?
Help me sending appropriate link to understand more.
Moderator Message: Read the Rules of Engagement of this forum.
Edited by: kishan P on Dec 27, 2011 9:50 PMHi Vinay,
You can't delete the ABAP Runtime errors. But you can catch the errors using catch exception Statement.
For Example,
Class-based exceptions are handled in the following control structure:
TRY.
... " TRY block (application coding)
CATCH cx_... cx_... ...
... " CATCH block (exception handler)
CATCH cx_... cx_... ...
... " CATCH block (exception handler)
CLEANUP.
... " CLEANUP block (cleanup context)
ENDTRY.
Try This Sample Code,
*--EXAMPLE FOR RUNTIME ERROR--
*DATA : VALUE1 TYPE I.
*VALUE1 = 1 / 0. -
>>>>>> IT MAKES RUN TIME ERROR.
*WRITE : VALUE1.
*-EXAMPLE FOR HOW TO CATCH THE ARITHMETIC ERROR AT THE RUN TIME USING SUBRC----
DATA : VALUE1 TYPE I.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.
VALUE1 = 1 / 0.
WRITE : VALUE1.
ENDCATCH.
IF SY-SUBRC = 1.
WRITE : ' IT MAKES ERROR'.
ELSE.
WRITE : VALUE1.
ENDIF.
Thanks,
Reward If Helpful. -
Abap logic in Transformation End Routine not working correctly
Hi,
I wrote a piece of code but during testing I found out that it doesn't meet my requirement.
Requirement
I want to extract Standard_Cost for all sales items that meets the conditon. but at the moment only the first sales item in the DSO is showing.
I would like the following lines to display in the cube as well since the PLITEM is different.
201021 PI31 REDBACK 999999A 78,850
201021 PI31 FLXAAA 999999A 3154,000
DSO Table
CALWEEK PLPLANT PLITEM SALESITEM STRDCOST
201020 IN06 FLXAAA 557868B 6308,000
201021 FI24 FLXAAA 557868B 6308,000
201021 FI24 FLXAAA 999999B 0,000
201021 PI31 REDBACK 999999A 78,850
201021 PI31 FLXAAA 999999A 3154,000
InfoCube
SALESITEM PLPLANT SALESDOC STRDCOST
999999A PI31 1100000911 78,850
Abap Logic
Data ld_calweek(6) TYPE n.
Getting the current week based on the system date.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = sy-datum
IMPORTING
week = ld_calweek
EXCEPTIONS
date_invalid = 1
OTHERS = 2.
Data rp TYPE tys_TG_1.
LOOP AT RESULT_PACKAGE INTO rp.
SELECT SINGLE STRDCOST FROM /N/ABC_EFG00 INTO
rp-S_STRDCOST
WHERE SALESITEM = rp-S_ITEMID AND CALWEEK =
ld_calweek AND PLPLANT EQ rp-S_SOURCE.
MODIFY RESULT_PACKAGE FROM rp.
Clear rp.
ENDLOOP.
How do I resolve this
thanksHi Vaidya
Select single will always select the first entry from the source which matched your where condition.
therefore you are not getting all the required data.
WHERE SALESITEM = rp-S_ITEMID AND CALWEEK =
ld_calweek AND PLPLANT EQ rp-S_SOURCE.
according to your logic
it will pick only one record e.g
201021 PI31 REDBACK 999999A 78,850
201021 PI31 FLXAAA 999999A 3154,000
item id = 999999A
plplant = PI31
in this case it will pick only the first record due to select single will fetch only one record (whichever it gets first and which meets your where condition)
You need to change your code logic and need to include more fileds which differentiates one record from another who have same valued as in your present where condition.
Thanks
Navneet -
Hi all,
I have a requirement where i need to lookup for a value in ods1 and based on that value i should update in ods2. can anyone help me with any abap logic --- is there one for look-up ? any sample code would be really helpful.
~rahulthe following method will give the ODS table name
CALL METHOD cl_rsd_odso=>get_tablnm
EXPORTING
i_odsobject = <ods name>
i_tabt = '0'
IMPORTING
e_tablnm = ods_tab_name .
do a select from the ODS table to find whether infoobject A is there and get the value and based on that update ods2.
Regards
Raja -
BI Content Datasources' ABAP Logic
Dear Friends,
Where and how can I find the BI Content Datasources' ABAP Logic. I am particularly looking for the code for 2LIS_03_BX, 2LIS_03_BF and 2LIS_03_UM.
Thanks!Hi,
Go to transaction RSO2 (Generic datasources) in ECC, put the datasource name in the transaction data field and click on display, then you will get a warning message at the bottom of the screen like below:
datasource 2lis_03_bf is extacted using function module mcex_bw_lo_api
likewise you can check for other datasources as well. Go to the function modules in SE37 and check the code there.
Regards,
Murali. -
Need of ABAP logic for 0CDFY variable
Hi Everyone,
Iam trying to use the Current Fiscal Year--0CDFY variable in one of query.
I want to know the ABAP logic for that variable.
anyone please help me out
Thankyou
ARUNThis variable brings in the current fiscal year.
If you want to see code behind it than go to Tcode SE37
type in RSVAREXIT_0CDFY and click on disply -
Hi
Anyone pls provide me logic for the following scenario.
parameters: p_fiscal like zmkt-gjahr, "fiscal year
p_monat LIKE zmkt-monat. "two digit no for month
I i give 2006 in p_fiscal It should consider the fiscal year as 01.04.2006 to 31.03.2007.
and if i give 12 in p_monat it should generate the report on march month of 2007.
i.e, if p_fiscal = 2006 and p_monat =01
it should generate report on the month of April 2006
if p_fiscal = 2006 and p_monat =02
it should generate report on the month of May 2006
if p_fiscal = 2006 and p_monat =03
it should generate report on the month of june 2006
if p_fiscal = 2006 and p_monat =04
it should generate report on the month of July 2006
if p_fiscal = 2006 and p_monat =05
it should generate report on the month of Aug 2006
if p_fiscal = 2006 and p_monat =06
it should generate report on the month of Sept 2006
if p_fiscal = 2006 and p_monat =07
it should generate report on the month of Oct 2006
if p_fiscal = 2006 and p_monat =08
it should generate report on the month of Nov 2006
if p_fiscal = 2006 and p_monat =09
it should generate report on the month of Dec 2006
if p_fiscal = 2006 and p_monat = 10
it should generate report on the month of Jan 2007
if p_fiscal = 2006 and p_monat = 11
it should generate report on the month of Feb 2007
if p_fiscal = 2006 and p_monat =12
it should generate report on the month of mar 2007
Thanks in Advance
RajaHi,
perform get_fiscal_year using p_fiscal p_monat changing
p_date.
form get_fiscal_year using p_fiscal
p_monat
changing
p_date.
if p_monat < 10.
data: l_monat like p_monat.
l_monat = p_monat + 3.
concatenate '01' l_monat p_fiscal into p_date.
else.
case p_monat.
when 10.
l_monat = '01'.
concatenate '01' l_monat p_fiscal into p_date.
when 11.
l_monat = '02'.
concatenate '01' l_monat p_fiscal into p_date.
l_monat = '03'.
when 12.
concatenate '01' l_monat p_fiscal into p_date.
endcase.
endif.
endform.
Then use the date that you get from thos routine to generate the report.
Regards,
Sesh -
Hi All, I am quite familiar with Logical Databases but I need to understand the following.
1) I am using LDB ADA, but I want to use my own Selection Screen and not the default one that the LDB provides. I know I must put something in AT SELECTION-SCREEN but am unsure what.
2) Once I get the data, I want to store the data in an internal table - how do I go about doing this? If you can provide a code example that would be great.
Points for any relevant help.Hi,
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.
Logical database structures
There are three defining entities in an SAP logical database. You must be clear on all three in order to create and use one.
Table structure: Your logical database includes data from specified tables in SAP. There is a hierarchy among these tables defined by their foreign keys (all known to SAP), and you are going to define a customized relationship between select tables. This structure is unique and must be defined and saved.
Data selection: You may not want or need every item in the referenced tables that contributes to your customized database. There is a selection screen that permits you to pick and choose.
Database access programming: Once youve defined your logical database, SAP will generate the access subroutines needed to pull the data in the way you want it pulled.
Creating your own logical database
Heres a step-by-step guide:
1) Call up transaction SLDB (or transaction SE36). The path you want is Tools | ABAP Workbench | Development | Programming Environment | Logical Databases. This screen is called Logical Database Builder.
2) Enter an appropriate name in the logical database name field. You have three options on this screen: Create, Display, and Change. Choose Create.
3) Youll be prompted for a short text description of your new logical database. Enter one. Youll then be prompted to specify a development class.
4) Specify a root node, or a parent table, as the basis of your logical database structure. You can now place subsequent tables under the root table as needed to assemble the data object you want. You can access this tree from this point forward, to add additional tables, by selecting that root node and following the path Edit | Node | Create. Once youve saved the structure you define in this step, the system will generate the programming necessary to access your logical database. The best part is you dont have to write a single line of code.
Noted point is we cant add any selection criteria thru our se38 program if you are attaching any LDB to program.Ist of no use.
If you want to change selection criteria to the existing LDB, you have to goto SE36 tcode and provide LDB name and choose "Change" mode by selecting "Selections" Radio button.
declaration of params is different compared to normal se38 program in some aspects.
PARAMETERS :p_curr LIKE bkpf-waers FOR TABLE bkpf OBLIGATORY.
this BKPF table should be one of the node in the "Structure" Radio button.
Thanks
Sivaparvathi
Please reward points if helpful. -
Hi Experts,
The following is the ABAP Code used in Function Module to extract Master Data from R/3 to BW.Could please convert that into human language (Explain logic of code)
FUNCTION MDEX_MATERIAL_MD .
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR OPTIONAL
*" VALUE(I_CHABASNM) TYPE SBIWA_S_INTERFACE-CHABASNM OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE OPTIONAL
*" VALUE(I_DATAPAKID) TYPE SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
*" VALUE(I_S_TIMEINT) TYPE SBIWA_S_TIMEINT OPTIONAL
*" VALUE(I_RLOGSYS) TYPE SRSC_S_INTERFACE-RLOGSYS OPTIONAL
*" VALUE(I_PRIVATE_MODE) OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" E_T_BIW_MARA_S STRUCTURE BIW_MARA_S OPTIONAL
*" E_T_BIW_MARC_S STRUCTURE BIW_MARC_S OPTIONAL
*" E_T_BIW_MARD_S STRUCTURE BIW_MARD_S OPTIONAL
*" E_T_BIW_MVKE_S STRUCTURE BIW_MVKE_S OPTIONAL
*" E_T_BIW_MARM_S STRUCTURE BIW_MARM_S OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
function acts as a S-API-compatible interface for the SD-extractor
MATERIAL_DYNAM_DATA_SELECTION
STATICS: L_FIRST_CALL TYPE SBIWA_FLAG,
L_NO_SELECT TYPE C.
DATA: L_SUBRC TYPE SBIWM_SUBRC.
DATA: L_T_CHABASCMP LIKE RSSOSFIELD OCCURS 0 WITH HEADER LINE,
L_S_REQUEST TYPE RSAP_S_REQUEST,
L_SLOGSYS LIKE TBDLS-LOGSYS,
L_RODCHABGEN LIKE RODCHABGEN,
L_LINES TYPE I,
L_TX_SELECT TYPE SBIWA_TX_SELECT,
L_T_SELECT TYPE SBIWA_T_SELECT,
L_S_SELECT TYPE SBIWA_S_SELECT.
DATA: L_T_MARA LIKE MARA OCCURS 10 WITH HEADER LINE,
L_T_MARC LIKE MARC OCCURS 10 WITH HEADER LINE,
L_T_MARD LIKE MARD OCCURS 10 WITH HEADER LINE,
L_T_MVKE LIKE MVKE OCCURS 10 WITH HEADER LINE,
L_T_MARM LIKE MARM OCCURS 10 WITH HEADER LINE.
DATA: L_S_MATNR_MATERIAL_KEYS LIKE PRE03,
L_S_WERKS_MATERIAL_KEYS LIKE PRE01,
L_S_LGORT_MATERIAL_KEYS LIKE PRE08,
L_S_VTLIN_MATERIAL_KEYS LIKE PRE10.
Variable to read compound information "note383430 insED08052001
DATA: i_chabasnm_cmp TYPE sbiwa_s_interface-chabasnm.
"note383430 insED08052001
IF I_INITFLAG = 'X'.
Initialization: check input parameters
buffer input parameters
prepare data selection
Invalid second initialization call -> error exit
IF NOT G_FLAG_INTERFACE_INITIALIZED IS INITIAL.
IF 1 = 2. MESSAGE E008(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'008' "message number
' ' "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ELSE.
G_FLAG_INTERFACE_INITIALIZED = SBIWA_C_FLAG_ON.
ENDIF.
Check for supported update mode
CASE I_UPDMODE.
WHEN SBIWA_C_UPDMODE_FULL.
WHEN SBIWA_C_UPDMODE_DELTAINIT.
WHEN SBIWA_C_UPDMODE_DELTA.
WHEN OTHERS.
IF 1 = 2. MESSAGE E011(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'011' "message number
I_UPDMODE "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
Initialize variable to read compound information
i_chabasnm_cmp = i_chabasnm. "note383430 insED08052001
**Check InfoObject validity and set IO-dependent parameters
G_TAB1_FLG = G_TAB2_FLG = G_TAB3_FLG = G_TAB4_FLG = ' '.
g_tab5_flg = ' '. "note417314 insED04072001
G_NO_MARM = 'X'.
CASE I_CHABASNM.
WHEN '0MATERIAL'.
G_TAB1_FLG = 'X'.
G_TABLENAME = 'MARA'.
WHEN '0ARTICLE'. "note383430 insED30042001
G_TAB1_FLG = 'X'. "note383430 insED30042001
G_TABLENAME = 'MARA'. "note383430 insED30042001
i_chabasnm_cmp = '0MATERIAL'. "note383430 insED08052001
WHEN '0ME_MATERIAL'. "note759687
G_TAB1_FLG = 'X'. "note759687
G_TABLENAME = 'MARA'. "note759687
i_chabasnm_cmp = '0MATERIAL'. "note759687
WHEN '0MAT_PLANT'.
G_TAB2_FLG = 'X'.
G_TABLENAME = 'MARC'.
WHEN '0ART_PLANT'. "note383430 insED30042001
G_TAB2_FLG = 'X'. "note383430 insED30042001
G_TABLENAME = 'MARC'. "note383430 insED30042001
i_chabasnm_cmp = '0MAT_PLANT'. "note383430 insED08052001
WHEN '0MAT_ST_LOC'.
G_TAB3_FLG = 'X'.
G_TABLENAME = 'MARD'.
WHEN '0ART_ST_LOC'. "note383430 insED30042001
G_TAB3_FLG = 'X'. "note383430 insED30042001
G_TABLENAME = 'MARD'. "note383430 insED30042001
i_chabasnm_cmp = '0MAT_ST_LOC'. "note383430 insED08052001
WHEN '0MAT_SALES'.
G_TAB4_FLG = 'X'.
G_TABLENAME = 'MVKE'.
when '0ART_SALES'. "note383430 insED30042001 "delED
g_tab4_flg = 'x'. "note383430 insED30042001 "delED
g_tablename = 'MVKE'. "note383430 insED30042001 "delED
WHEN '0ART_SALES'. "insED
G_TAB4_FLG = 'X'. "insED
G_TABLENAME = 'MVKE'. "insED
i_chabasnm_cmp = '0MAT_SALES'. "note383430 insED08052001
WHEN '0MAT_UNIT'.
G_TAB1_FLG = 'X'. "note417314 delED04072001
g_tab5_flg = 'X'. "note417314 insED04072001
G_TABLENAME = 'MARM'.
G_NO_MARM = ' '.
WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_CHABASNM "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
** fill parameter buffer for data extraction calls
G_S_EXTR_IF-REQUNR = I_REQUNR.
G_S_EXTR_IF-CHABASNM = I_CHABASNM.
G_S_EXTR_IF-MAXSIZE = I_MAXSIZE.
G_S_EXTR_IF-INITFLAG = I_INITFLAG.
G_S_EXTR_IF-UPDMODE = I_UPDMODE.
G_S_EXTR_IF-DATAPAKID = I_DATAPAKID.
g_s_interface-read_opt =.
G_S_INTERFACE-MAX_MATNR = I_MAXSIZE.
g_s_interface-max_lifnr =.
g_s_interface-max_kunnr =.
g_s_interface-max_werks =.
CASE I_UPDMODE.
WHEN SBIWA_C_UPDMODE_DELTA.
** settings for delta data transfer
** get additional information about current extraction
CALL FUNCTION 'RSAN_LOGSYS_DETERMINE'
EXPORTING
I_CLIENT = SY-MANDT
IMPORTING
E_LOGSYS = L_SLOGSYS.
L_S_REQUEST-SNDPRN = L_SLOGSYS.
L_S_REQUEST-RCVPRN = I_RLOGSYS.
*----- Fill Content release so get_rodchabgen will work ok -
PERFORM GET_BWBCRL IN PROGRAM SAPLRSAP "OSS 1054070/2000
USING L_S_REQUEST-RCVPRN "OSS 1054070/2000
CHANGING L_SUBRC. "OSS 1054070/2000
PERFORM GET_RODCHABGEN IN PROGRAM SAPLRSAP
USING L_RODCHABGEN
I_CHABASNM
L_S_REQUEST.
** get base characteristic information
PERFORM DETERMINE_COMPOSITES IN PROGRAM SAPLRSAM
TABLES L_T_CHABASCMP
USING I_CHABASNM.
USING i_chabasnm_cmp. "note383430 insED08052001
** Get information about modified data objects
PERFORM FILL_MD_SELECT_ENTRYTABLE IN PROGRAM SAPLRSAP
TABLES L_T_CHABASCMP
USING L_RODCHABGEN-MSGTYP
I_CHABASNM
CHANGING L_TX_SELECT
L_SUBRC.
DESCRIBE TABLE L_TX_SELECT LINES L_LINES.
IF L_LINES = 0.
L_NO_SELECT = 'X'.
ENDIF.
** fill key-table for extractor
REFRESH G_T_MATNR_MATERIAL_KEYS.
REFRESH G_T_WERKS_MATERIAL_KEYS.
REFRESH G_T_LGORT_MATERIAL_KEYS.
REFRESH G_T_VTLIN_MATERIAL_KEYS.
refresh g_t_marm_material_keys. "note417314 insED04072001
LOOP AT L_TX_SELECT INTO L_T_SELECT.
CASE I_CHABASNM.
WHEN '0MATERIAL' OR '0ARTICLE' "note383430 insED30042001
OR '0ME_MATERIAL'.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_MATNR_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
APPEND L_S_MATNR_MATERIAL_KEYS TO G_T_MATNR_MATERIAL_KEYS.
WHEN '0MAT_PLANT' OR '0ART_PLANT'. "note383430 insED30042001
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_WERKS_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'WERKS'.
L_S_WERKS_MATERIAL_KEYS-WERKS = L_S_SELECT-LOW.
APPEND L_S_WERKS_MATERIAL_KEYS TO G_T_WERKS_MATERIAL_KEYS.
WHEN '0MAT_ST_LOC' OR '0ART_ST_LOC'.
"note383430 insED30042001
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_LGORT_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'WERKS'.
L_S_LGORT_MATERIAL_KEYS-WERKS = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'LGORT'.
L_S_LGORT_MATERIAL_KEYS-LGORT = L_S_SELECT-LOW.
APPEND L_S_LGORT_MATERIAL_KEYS TO G_T_LGORT_MATERIAL_KEYS.
WHEN '0MAT_SALES' OR '0ART_SALES'. "note383430 insED30042001
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_VTLIN_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'VKORG'.
L_S_VTLIN_MATERIAL_KEYS-VKORG = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'VTWEG'.
L_S_VTLIN_MATERIAL_KEYS-VTWEG = L_S_SELECT-LOW.
APPEND L_S_VTLIN_MATERIAL_KEYS TO G_T_VTLIN_MATERIAL_KEYS.
ENDCASE.
ENDLOOP.
IF L_SUBRC <> 0.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_CHABASNM "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
EXIT.
ENDIF.
** settings for full data transfer or delta init.
*----- Selektionsbedingungen müssen immer übernommen werden -
WHEN sbiwa_c_updmode_full "DEL"TH090800
OR sbiwa_c_updmode_deltainit. "DEL"TH090800
REFRESH g_t_sel_table. "DEL"TH090800
LOOP AT i_t_select INTO l_s_select. "DEL"TH090800
g_s_sel_table-table = g_tablename. "DEL"TH090800
g_s_sel_table-field = l_s_select-fieldnm. "DEL"TH090800
MOVE-CORRESPONDING l_s_select TO g_s_sel_table. "DEL"TH090800
APPEND g_s_sel_table TO g_t_sel_table. "DEL"TH090800
ENDLOOP. "DEL"TH090800
WHEN OTHERS.
ENDCASE.
*----- Selektionsbedingungen müssen immer übernommen werden -
REFRESH G_T_SEL_TABLE. "INS"TH090800
LOOP AT I_T_SELECT INTO L_S_SELECT. "INS"TH090800
G_S_SEL_TABLE-TABLE = G_TABLENAME. "INS"TH090800
G_S_SEL_TABLE-FIELD = L_S_SELECT-FIELDNM. "INS"TH090800
MOVE-CORRESPONDING L_S_SELECT TO G_S_SEL_TABLE. "INS"TH090800
APPEND G_S_SEL_TABLE TO G_T_SEL_TABLE. "INS"TH090800
ENDLOOP. "INS"TH090800
REFRESH G_T_FIELDS.
APPEND LINES OF I_T_FIELDS TO G_T_FIELDS.
ELSE. "Initialization mode or data extraction ?
IF ( G_MORE_DATA_EXISTS = ' ' ) AND ( G_COUNTER_DATAPAKID NE 0 ).
RAISE NO_MORE_DATA.
EXIT.
ENDIF.
IF G_S_EXTR_IF-UPDMODE = SBIWA_C_UPDMODE_DELTA.
IF NOT L_NO_SELECT IS INITIAL.
RAISE NO_MORE_DATA.
ENDIF.
ENDIF.
IF ( G_MORE_DATA_EXISTS = 'X' ) OR ( G_COUNTER_DATAPAKID = 0 ).
REFRESH L_T_MARA.
REFRESH L_T_MARC.
REFRESH L_T_MARD.
REFRESH L_T_MVKE.
REFRESH L_T_MARM.
CALL FUNCTION 'MATERIAL_DYNAM_DATA_SELECTION'
EXPORTING
NO_MARM_DATA = G_NO_MARM
READ_MARA_DATA = G_TAB1_FLG
READ_MARC_DATA = G_TAB2_FLG
READ_MARD_DATA = G_TAB3_FLG
READ_MVKE_DATA = G_TAB4_FLG
read_marm_data = g_tab5_flg "note417314 insED04072001
JOIN_OPTION = 'O'
IN_MAX_MATNR = G_S_INTERFACE-MAX_MATNR
TABLES
IN_SELECT_FIELDS = G_T_SEL_TABLE
IN_MATNR_KEYS = G_T_MATNR_MATERIAL_KEYS
IN_WERKS_KEYS = G_T_WERKS_MATERIAL_KEYS
IN_VTLIN_KEYS = G_T_VTLIN_MATERIAL_KEYS
IN_LGORT_KEYS = G_T_LGORT_MATERIAL_KEYS "insED22032001
in_marm_keys = g_t_marm_material_keys "note417314
"insED04072001
OUT_MARA_TAB = L_T_MARA
OUT_MARC_TAB = L_T_MARC
OUT_MARD_TAB = L_T_MARD
OUT_MVKE_TAB = L_T_MVKE
OUT_MARM_TAB = L_T_MARM
CHANGING
MORE_DATA_EXISTS = G_MORE_DATA_EXISTS
EXCEPTIONS
WRONG_INPUT_DATA = 1
OTHERS = 2
IF SY-SUBRC <> 0.
IF 1 = 2. MESSAGE E011(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'011' "message number
SY-SUBRC "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDIF.
G_COUNTER_DATAPAKID = G_COUNTER_DATAPAKID + 1.
LOOP AT L_T_MARA.
MOVE-CORRESPONDING L_T_MARA TO E_T_BIW_MARA_S.
APPEND E_T_BIW_MARA_S.
ENDLOOP.
LOOP AT L_T_MARC.
MOVE-CORRESPONDING L_T_MARC TO E_T_BIW_MARC_S.
provide additional attributes not contained in MARC
PERFORM MARC_ADD_ATTRIBUTES CHANGING E_T_BIW_MARC_S
L_SUBRC.
IF L_SUBRC <> 0.
IF 1 = 2. MESSAGE E501(R§). ENDIF.
"insED03082001 begin note216922
log_write 'W' "message type
'R§' "message class
'501' "message number
e_t_biw_marc_s-werks "message variable 1
' '. "message variable 2
"insED03082001 end note216922
"delED03082001 begin note216922
LOG_WRITE 'E' "message type
'R§' "message class
'501' "message number
E_T_BIW_MARC_S-WERKS "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
"delED03082001 end note2169222
ENDIF.
APPEND E_T_BIW_MARC_S.
ENDLOOP.
LOOP AT L_T_MARD.
MOVE-CORRESPONDING L_T_MARD TO E_T_BIW_MARD_S.
APPEND E_T_BIW_MARD_S.
ENDLOOP.
LOOP AT L_T_MVKE.
MOVE-CORRESPONDING L_T_MVKE TO E_T_BIW_MVKE_S.
APPEND E_T_BIW_MVKE_S.
ENDLOOP.
LOOP AT L_T_MARM.
MOVE-CORRESPONDING L_T_MARM TO E_T_BIW_MARM_S.
APPEND E_T_BIW_MARM_S.
ENDLOOP.
ENDIF.
ENDIF.
ENDFUNCTION.
ThanksHi,
This might not be the right forum for this. You can post your question in more relevant forum like Netweaver-Exchange Infrastructure. -
Provide ABAP statement used in HR Extractor
Hello All,
I am extracting data by enhancing 0EMPLOYEE_ATTR extractor, using database tables PA0002, PA9001 (Custom infotype) and PA0006. But the logic does not take care of time intervals that are overlapping. so the data coming looks inconsistent.
For e.g.:
0EMPLOYEE (change of cost center)
01.01.2007 - 31.03.2007 000001 524000
01.04.2007 - 31.03.2008 000001 524001
PA9001 (change of job title)
01.01.2007 - 31.06.2007 000001 Manager
01.07.2007 - 31.12.2007 000001 Director
Wrong result (without time consolidation)
01.01.2007 - 31.03.2007 000001 524000 Manager
01.04.2007 - 31.03.2008 000001 524001 Manager
Correct result (with time consolidation)
01.01.2007 - 31.03.2007 000001 524000 Manager
01.04.2007 - 31.06.2007 000001 524001 Manager
01.07.2007 - 31.03.2008 000001 524001 Director
How do I get this resolved?
Kindly inform. Thanks.
Regards,
KP
Edited by: KK PP on Jan 8, 2008 6:35 AM
I referred a std FM 'HR_BIW_EXTRACT_IO_OCCUPANCY', which uses a ABAP statement PROVIDE for retrieval of consistent data based on the time intervals, but I am not sure how it works. Kindly help.
Regards,
KPPlease help.
-
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 -
Change output of abap logical database report
Hello
I have an abap report that is using a logical database to display some fields.My problem is that i have to change it and display more fields for output ,how can i control this?
Thank youHi,
We need to add the required (additional) fields to the internal table structure, fill the fields with relevant data and display them on the screen. How is the output fields related to using a LDB..?
Can you explain me a little bit more on the below stmt?
" I have an abap report that is using a logical database to display some fields."
I am not clear in understanding the relation b/w 'using LDB' and 'fields in output'. I dont think the fields displayed in the output screen will be restricted while using a LDB. Pls correct me if i understood wrong.
Thanks,
teja. -
Client proxy consuming web service provider using logical port issue
Hi All,
I have a proxy client having a logical port (configured using NWDS) to consume a web service in the provider system.
In the logical port, I have given target address, and logical port name. While moving this client proxy NWDI dev track to Q and prod,
how do I change this target address to point to Q and prod respectively. In other words, even though I am using Visual admin to configure the destination url for the logical port, to point to Q and prod, its still referring to the dev environment provider service after moving the proxy client to Q and prod. What is the suggested approach to take care of this issue
Thx
mikeHi Michael,
I can only help from that point of view that I believe this question belongs to the forum
Service-Oriented Architecture (SOA) and SAP
Please try to raise this question there.
Thanks and Regards,
Ervin
Maybe you are looking for
-
It won't pick up that my iPod is connected to iTunes whenever I plug it in.
-
I have had my iPhone 4s for one week. Now it won't turn off or on totally.
It just beeps, unless I turn the ringer to vibrate, then it keeps vibrating!! Any one else having these issues? Trying a restore right now.
-
F110 Performance Issue in Schedule Proposal Phase
Has anyone seen this issue and know a potential solution? When scheduling a proposal for a payment run we are immediately receiving the message "proposal has been released MM/DD/YY HH:MM:SS". This is a new issue, as Tuesday this was not happening at
-
(moderator - tried posting this in iPhone section but got no replies) I have 3 Macs: Mac Book Pro (iTunes sees iPhone) Home G4 867mhz running OSX 10.4.11 (iTunes sees iPhone) Work G4 867mhz running OSX 10.4.11 (iTunes does not see iPhone) The iPhones
-
How to sort photo albums by face on the new iPad?
I noticed at my friends house that he in his photo albums had a face album already built in, I have the same iPad as him but can't figure out how to get it! Someone help plz?