on 05-26-2014 10:31 AM
Hi ABAP experts
We need to fill up the results with master data from a source DSO. This source DSO has the following character:
ZZBRAR1 and ZZBRAR describe an interval, also ZZBRARW1 and ZZBRARW.
The source DSO which delivers the result package doesn't have an interval on these two characteristics, only a valid value which lies between the interval of the lookup DSO.
The following coding has been applied as endroutine. Execution of DTP ends in a short dump TSV_TNEW_PAGE_ALLOC_FAILED.
Any ideas where to optimize the coding?
Thanks
TABLES: /BIC/AZFC_DS9600.
DATA: ITAB TYPE STANDARD TABLE OF /BIC/AZFC_DS9600 WITH HEADER LINE.
DATA: WA LIKE LINE OF ITAB.
*$*$ end of 2nd part global - insert your code only before this line *
*---------------------------------------------------------------------*
* CLASS routine IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_transform IMPLEMENTATION.
*----------------------------------------------------------------------*
* Method end_routine
*----------------------------------------------------------------------*
* Calculation of result package via end routine.
* Note: Update of target fields depends on rule assignment in
* transformation editor. Only fields that have a rule assigned,
* are updated to the data target.
*----------------------------------------------------------------------*
* <-> result package
*----------------------------------------------------------------------*
METHOD end_routine.
*=== Segments ===
FIELD-SYMBOLS:
<RESULT_FIELDS> TYPE _ty_s_TG_1.
DATA:
MONITOR_REC TYPE rstmonitor.
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
* raise exception type CX_RSROUT_ABORT.
DATA: ITAB_REFRESH TYPE STANDARD TABLE OF _ty_s_TG_1.
DATA: ITAB_TARGET TYPE STANDARD TABLE OF _ty_s_TG_1.
DATA: WA_TARGET LIKE LINE OF ITAB_TARGET.
DATA: ICOUNT TYPE RSARECORD.
IF RESULT_PACKAGE[] IS NOT INITIAL.
ICOUNT = 1.
REFRESH ITAB.
SELECT * FROM /BIC/AZFC_DS9600 INTO TABLE ITAB.
REFRESH ITAB_TARGET.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
LOOP AT ITAB INTO WA.
IF WA-/BIC/ZZBRA1 <= <RESULT_FIELDS>-/BIC/ZZBRA3
AND WA-/BIC/ZZBRA >= <RESULT_FIELDS>-/BIC/ZZBRA3
AND WA-/BIC/ZZBRARW1 <= <RESULT_FIELDS>-/BIC/ZZBRARW
AND WA-/BIC/ZZBRARW >= <RESULT_FIELDS>-/BIC/ZZBRARW.
<RESULT_FIELDS>-/BIC/ZWWSIC = WA-/BIC/ZWWSIC.
<RESULT_FIELDS>-/BIC/ZWWPRD = WA-/BIC/ZWWPRD.
ICOUNT = ICOUNT + 1.
APPEND <RESULT_FIELDS> TO ITAB_TARGET.
ELSE.
"keep ZZWWSIC and ZZWWPRD initial and transfer result package.
ICOUNT = ICOUNT + 1.
APPEND <RESULT_FIELDS> TO ITAB_TARGET.
ENDIF.
ENDLOOP.
ENDLOOP.
REFRESH RESULT_PACKAGE.
RESULT_PACKAGE[] = ITAB_TARGET[].
ENDIF.
Hi,
First off, apply a WHERE clause on the SELECT statement. The conditions are the same as the ones used in the IF statement.
Second and most important, reduce the packet size in the DTP. You may need to do a few hit and trials to get at the correct size.
Regards,
Suhas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suhas
A "where" clause in the select statement is not wished as I also need the result fields which don't fulfill the IF condition.
I have commented this sequence of the code:
* ELSE.
"keep ZZWWSIC and ZZWWPRD initial and transfer result package.
* ICOUNT = ICOUNT + 1.
* APPEND <RESULT_FIELDS> TO ITAB_TARGET.
And the DTP works.
But I also need the result fields which don't fit with the IF conditions....probably this is the place of the code to get adjusted(?).
Thanks
Thomas
If you need to records that don't satisfy the condition, then it's fine if you leave the code as it is.
The DTP packet size however, must be reduced. The reason is that when your TRFN explodes the Result Package volume (as it does above) then you often have a situation where the RP is too big for the server to handle. To control that, you should reduce the packet size, because the output RP size is roughly proportional to the packet size.
Thanks Suhas
I am trying to replace the the second loop with a READ statement:
I have changed the SELECT statement ...and get the syntax check error:
Implicit key specification is no longer allowed in the OO context. You
must use an INDEX, KEY, or FROM specification. must use an INDEX, KEY
or FROM specification.
SELECT * FROM /BIC/AZFC_DS2600 INTO TABLE ITAB
WHERE
/BIC/ZZBRA1 <= <RESULT_FIELDS>-/BIC/ZZBRA3
AND /BIC/ZZBRA >= <RESULT_FIELDS>-/BIC/ZZBRA3
AND /BIC/ZZBRARW1 <= <RESULT_FIELDS>-/BIC/ZZBRARW
AND /BIC/ZZBRARW >= <RESULT_FIELDS>-/BIC/ZZBRARW.
REFRESH ITAB_TARGET.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
READ TABLE ITAB INTO WA.
.....
Can you help?
Hi,
I recommend you change loop into Reaad statement. You have to use key for ITAB, that why getting this error.
A Sample code.
Structure Definition.
TYPES: BEGIN OF STR_HDR,
Structure elements Definition.
END OF STR_HDR.
Internal table declaration
DATA: I_T_DATA_HDR TYPE SORTED TABLE OF STR_HDR WITH UNIQUE KEY <Ex:OI_EBELN>,
W_A_DATA_HDR LIKE LINE OF I_T_DATA_HDR.
Select Statement:
SELECT OI_EBELN DOCTYPE VENDOR /BIC/ZFRGKE DOC_CAT /BIC/ZZPOIC PUR_GROUP
FROM
/BIC/AZPUR_O0200
INTO TABLE I_T_DATA_HDR FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE OI_EBELN = SOURCE_PACKAGE-OI_EBELN.
Read Statement:
READ TABLE I_T_DATA_HDR1 INTO W_A_DATA_HDR WITH TABLE KEY OI_EBELN = SOURCE_FIELDS-OI_EBELN.
-Sriram
Hi
I have changed the coding as below, the SELECT statement gives an error saying that the where clause is not related to the FOR ALL ENTRIES table...?
TYPES
: BEGIN OF STR_HDR,
/BIC/ZZBRARW TYPE /BIC/OIZZBRARW,
/BIC/ZZBRA3 TYPE /BIC/OIZZBRA3,
/BIC/ZWWSIC TYPE /BIC/OIZWWSIC,
/BIC/ZWWPRD TYPE /BIC/OIZWWPRD,
END OF STR_HDR
.
DATA
: I_T_DATA_HDR TYPE SORTED TABLE OF STR_HDR
WITH UNIQUE KEY /BIC/ZZBRA3 /BIC/ZZBRARW,
W_A_DATA_HDR LIKE LINE OF I_T_DATA_HDR.
IF RESULT_PACKAGE[] IS NOT INITIAL.
ICOUNT = 1.
REFRESH ITAB.
SELECT /BIC/ZWWSIC /BIC/ZWWPRD FROM /BIC/AZFC_DS2600 INTO TABLE
I_T_DATA_HDR FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE
/BIC/ZZBRA1 <= <RESULT_FIELDS>-/BIC/ZZBRA3
AND /BIC/ZZBRA >= <RESULT_FIELDS>-/BIC/ZZBRA3
AND /BIC/ZZBRARW1 <= <RESULT_FIELDS>-/BIC/ZZBRARW
AND /BIC/ZZBRARW >= <RESULT_FIELDS>-/BIC/ZZBRARW
.
Hi,
Please try below.
DATA: I_T_DATA_HDR TYPE SORTED TABLE OF STR_HDR
WITH UNIQUE KEY /BIC/ZZBRA3 /BIC/ZZBRARW,
How should the READ clause be described in this case?
READ TABLE
I_T_DATA_HDR INTO W_A_DATA_HDR
WITH TABLE KEY
/BIC/ZZBRA3 = <RESULT_FIELDS>-"Field name
/BIC/ZZBRARW = <RESULT_FIELDS>-"Field name
Regards,
Gaurav
Hi,
You cannot write a READ statement that is equivalent to the original code. The reason is that the original code did not use equality operators, it used operators such as >=, which ABAP does not allow in the READ statement.
A read statement is also not logically equivalent to your original code. The read statement is not logically a substitute for Nested loops. Your code (the one with nested loops) will generate N records for each original RESULT_PACKAGE record. A READ-based logic will generate only 1 record for each RESULT_PACKAGE record. So please re-check the requirement to determine whether the READ-based logic is suitable.
Regards,
Suhas
Hi,
This is very costly code. It has loop inside a loop.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
LOOP AT ITAB INTO WA.
instead of second loop. Read the ITAB with the conditions that you used in ÏF".
IF WA-/BIC/ZZBRA1 <= <RESULT_FIELDS>-/BIC/ZZBRA3
AND WA-/BIC/ZZBRA >= <RESULT_FIELDS>-/BIC/ZZBRA3
AND WA-/BIC/ZZBRARW1 <= <RESULT_FIELDS>-/BIC/ZZBRARW
AND WA-/BIC/ZZBRARW >= <RESULT_FIELDS>-/BIC/ZZBRARW.
Example;
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
READ ITAB where WA-/BIC/ZZBRA >= <RESULT_FIELDS>-/BIC/ZZBRA3 and ...
some thing like above one. you have to write to optimize the code.
-Sriram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is data type of those fields? If this is key figure then your code would work.
If the data type is of CHAR then u should think some other way to find the difference in range.
Because <,> will not work in CHAR, ZZBRARW1 and ZZBRARW looks like it is not number.
Regards,
Poomagal S.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thomas,instead of Select * try fetching the fields which are required and declare the structure of the same fields.
Make use of hashed table if not then sorted table instead of standard table.
See if the above two pointers help in improving the performance of the code.
Regards,
AL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.