on 11-07-2014 12:40 PM
Hello All,
I am having a requirement where i have to write an expert routine to load the data from Infocube to write optimized DSO.I have written below code in the expert routine and when i started loading the data i am getting GETWA_NOT_ASSIGNED error and load is getting failed.Please can some one look in to this code and give me your valuable suggestions.
TYPES : BEGIN OF INT_VISTEX,
SALESORG TYPE /BI0/OISALESORG,
DISTR_CHAN TYPE /BI0/OIDISTR_CHAN,
CLAIM TYPE /BI0/OICLAIM,
/BIC/ZOCVCLTYP TYPE /BIC/OIZOCVCLTYP,
/BIC/ZOCVCLITM TYPE /BIC/OIZOCVCLITM,
MATL_TYPE TYPE /BI0/OIMATL_TYPE,
MATERIAL TYPE /BI0/OIMATERIAL,
CUSTOMER TYPE /BI0/OICUSTOMER,
/BIC/ZOCVIDENT TYPE /BIC/OIZOCVIDENT,
/BIC/ZOCLMREF TYPE /BIC/OIZOCLMREF,
CUST_SALES TYPE /BI0/OICUST_SALES,
G_UVV9LD TYPE /BI0/OIG_UVV9LD,
AMOUNT TYPE /BI0/OIAMOUNT,
VOLUME TYPE /BI0/OIVOLUME,
END OF INT_VISTEX.
DATA: TEMP_INT_VISTEX TYPE INT_VISTEX,
WA_INT_CLAIM TYPE STANDARD TABLE OF /BI0/PCLAIM,
WA_INT_MATERIAL TYPE STANDARD TABLE OF /BI0/PMATERIAL,
WA_INT_CUSTOMER TYPE STANDARD TABLE OF /BI0/PCUSTOMER,
WA_INT_VISTEX TYPE STANDARD TABLE OF INT_VISTEX,
OBJVERS TYPE RSOBJVERS.
DATA: source_pkg LIKE LINE OF SOURCE_PACKAGE[],
result_pkg LIKE LINE OF RESULT_PACKAGE[].
IF ( WA_INT_CLAIM IS INITIAL ).
SELECT * FROM /BI0/PCLAIM INTO TABLE WA_INT_CLAIM WHERE OBJVERS = 'A'.
ENDIF.
IF ( WA_INT_MATERIAL[] IS INITIAL ).
SELECT * FROM /BI0/PMATERIAL INTO TABLE WA_INT_MATERIAL WHERE OBJVERS = 'A'.
ENDIF.
IF ( WA_INT_CUSTOMER[] IS INITIAL ).
SELECT * FROM /BI0/PCUSTOMER INTO TABLE WA_INT_CUSTOMER WHERE OBJVERS = 'A'.
ENDIF.
IF NOT SOURCE_PACKAGE[] IS INITIAL.
CLEAR :TEMP_INT_VISTEX.
LOOP AT SOURCE_PACKAGE[] INTO <SOURCE_FIELDS>.
READ TABLE WA_INT_CLAIM Transporting no fields
With key CLAIM = <source_fields>-CLAIM.
IF sy-subrc NE 0.
DELETE source_package index sy-tabix.
ENDIF.
READ TABLE WA_INT_MATERIAL Transporting no fields
With key MATERIAL = <source_fields>-MATERIAL.
IF sy-subrc NE 0.
DELETE source_package index sy-tabix.
ENDIF.
READ TABLE WA_INT_CUSTOMER Transporting no fields
With key CUSTOMER = <source_fields>-CUSTOMER.
IF sy-subrc NE 0.
DELETE source_package index sy-tabix.
ENDIF.
CLEAR : RESULT_PACKAGE[],
WA_INT_VISTEX.
TEMP_INT_VISTEX-SALESORG = <SOURCE_FIELDS>-SALESORG.
TEMP_INT_VISTEX-DISTR_CHAN = <SOURCE_FIELDS>-DISTR_CHAN.
TEMP_INT_VISTEX-CLAIM = <SOURCE_FIELDS>-CLAIM.
TEMP_INT_VISTEX-/BIC/ZOCVCLTYP = <SOURCE_FIELDS>-/BIC/ZOCVCLTYP.
TEMP_INT_VISTEX-/BIC/ZOCVCLITM = <SOURCE_FIELDS>-/BIC/ZOCVCLITM.
TEMP_INT_VISTEX-MATL_TYPE = <SOURCE_FIELDS>-MATL_TYPE.
TEMP_INT_VISTEX-MATERIAL = <SOURCE_FIELDS>-MATERIAL.
TEMP_INT_VISTEX-CUSTOMER = <SOURCE_FIELDS>-CUSTOMER.
TEMP_INT_VISTEX-/BIC/ZOCVIDENT = <SOURCE_FIELDS>-/BIC/ZOCVIDENT.
TEMP_INT_VISTEX-/BIC/ZOCLMREF = <SOURCE_FIELDS>-/BIC/ZOCLMREF.
TEMP_INT_VISTEX-G_UVV9LD = <SOURCE_FIELDS>-G_UVV9LD.
TEMP_INT_VISTEX-AMOUNT = <SOURCE_FIELDS>-AMOUNT.
TEMP_INT_VISTEX-VOLUME = <SOURCE_FIELDS>-VOLUME.
TEMP_INT_VISTEX-CUST_SALES = <SOURCE_FIELDS>-CUST_SALES.
COLLECT TEMP_INT_VISTEX INTO WA_INT_VISTEX.
ENDLOOP.
LOOP AT WA_INT_VISTEX INTO TEMP_INT_VISTEX.
READ TABLE SOURCE_PACKAGE[] INTO source_pkg WITH KEY
CLAIM = TEMP_INT_VISTEX-CLAIM
CUSTOMER = TEMP_INT_VISTEX-CUSTOMER
MATERIAL = TEMP_INT_VISTEX-MATERIAL.
IF SY-SUBRC = 0.
CLEAR : RESULT_PKG.
RESULT_PKG-/BIC/CDDOCNUM = TEMP_INT_VISTEX-CLAIM.
RESULT_PKG-/BIC/ZOCMTMSR = 'VISTEX'.
RESULT_PKG-/BIC/CGTRANTYP = TEMP_INT_VISTEX-/BIC/ZOCVCLTYP.
RESULT_PKG-/BIC/CDREFNUM = TEMP_INT_VISTEX-/BIC/ZOCLMREF.
RESULT_PKG-/BIC/CGPRODUCT = TEMP_INT_VISTEX-MATERIAL.
RESULT_PKG-SHIP_TO = TEMP_INT_VISTEX-CUSTOMER.
RESULT_PKG-/BIC/CDITMNUM = TEMP_INT_VISTEX-/BIC/ZOCVIDENT.
RESULT_PKG-/BIC/CDDSTACT = TEMP_INT_VISTEX-CUST_SALES.
RESULT_PKG-/BIC/KGAMOUNT = TEMP_INT_VISTEX-AMOUNT.
RESULT_PKG-/BIC/KGVOLUME = TEMP_INT_VISTEX-VOLUME.
RESULT_PKG-G_UVV9LD = TEMP_INT_VISTEX-G_UVV9LD.
APPEND RESULT_PKG TO RESULT_PACKAGE.
ENDIF.
ENDLOOP.
ENDIF.
Hi,
I just modifed a little bit of your code and this should improve performance. Only the red ones are modifications.
Also you can improve by defining claim, material and customer tables better with a hash table.
Please let me know if the changes improve performance a bit. Then we will improve it further.
Thanks
Amit
---------------------------------------------------------
TYPES : BEGIN OF int_vistex,
salesorg TYPE /bi0/oisalesorg,
distr_chan TYPE /bi0/oidistr_chan,
claim TYPE /bi0/oiclaim,
/bic/zocvcltyp TYPE /bic/oizocvcltyp,
/bic/zocvclitm TYPE /bic/oizocvclitm,
matl_type TYPE /bi0/oimatl_type,
material TYPE /bi0/oimaterial,
customer TYPE /bi0/oicustomer,
/bic/zocvident TYPE /bic/oizocvident,
/bic/zoclmref TYPE /bic/oizoclmref,
cust_sales TYPE /bi0/oicust_sales,
g_uvv9ld TYPE /bi0/oig_uvv9ld,
amount TYPE /bi0/oiamount,
volume TYPE /bi0/oivolume,END OF int_vistex.
DATA: temp_int_vistex TYPE int_vistex,
wa_int_claim TYPE STANDARD TABLE OF /bi0/pclaim,
wa_int_material TYPE STANDARD TABLE OF /bi0/pmaterial,
wa_int_customer TYPE STANDARD TABLE OF /bi0/pcustomer,
wa_int_vistex TYPE STANDARD TABLE OF int_vistex,
objvers TYPE rsobjvers.DATA: source_pkg LIKE LINE OF source_package[],
result_pkg LIKE LINE OF result_package[].IF ( wa_int_claim IS INITIAL ).
SELECT * FROM /bi0/pclaim INTO TABLE wa_int_claim FOR ALL ENTRIES IN source_package
WHERE claim = source_package-claim
AND objvers = 'A'. IF sy-subrc EQ 0.
SORT wa_int_claim BY claim.
ENDIF.ENDIF.IF ( wa_int_material[] IS INITIAL ).
SELECT * FROM /bi0/pmaterial INTO TABLE wa_int_material FOR ALL ENTRIES IN source_package
WHERE material = source_package-material
AND objvers = 'A'. IF sy-subrc EQ 0.
SORT wa_int_material BY material.
ENDIF.ENDIF.IF ( wa_int_customer[] IS INITIAL ).
SELECT * FROM /bi0/pcustomer INTO TABLE wa_int_customer FOR ALL ENTRIES IN source_package
WHERE customer = source_package-customer
AND objvers = 'A'. IF sy-subrc EQ 0.
SORT wa_int_customer BY customer.
ENDIF.ENDIF.IF NOT source_package[] IS INITIAL.
CLEAR :temp_int_vistex.
LOOP AT source_package[] INTO <source_fields>.
READ TABLE wa_int_claim TRANSPORTING NO FIELDS
WITH KEY claim = <source_fields>-claim BINARY SEARCH.
IF sy-subrc NE 0.
DELETE source_package INDEX sy-tabix.
ENDIF.
READ TABLE wa_int_material TRANSPORTING NO FIELDS
WITH KEY material = <source_fields>-material BINARY SEARCH.
IF sy-subrc NE 0.
DELETE source_package INDEX sy-tabix.
ENDIF.
READ TABLE wa_int_customer TRANSPORTING NO FIELDS
WITH KEY customer = <source_fields>-customer BINARY SEARCH.
IF sy-subrc NE 0.
DELETE source_package INDEX sy-tabix.
ENDIF.
CLEAR : result_package[],
wa_int_vistex.
temp_int_vistex-salesorg = <source_fields>-salesorg.
temp_int_vistex-distr_chan = <source_fields>-distr_chan.
temp_int_vistex-claim = <source_fields>-claim.
temp_int_vistex-/bic/zocvcltyp = <source_fields>-/bic/zocvcltyp.
temp_int_vistex-/bic/zocvclitm = <source_fields>-/bic/zocvclitm.
temp_int_vistex-matl_type = <source_fields>-matl_type.
temp_int_vistex-material = <source_fields>-material.
temp_int_vistex-customer = <source_fields>-customer.
temp_int_vistex-/bic/zocvident = <source_fields>-/bic/zocvident.
temp_int_vistex-/bic/zoclmref = <source_fields>-/bic/zoclmref.
temp_int_vistex-g_uvv9ld = <source_fields>-g_uvv9ld.
temp_int_vistex-amount = <source_fields>-amount.
temp_int_vistex-volume = <source_fields>-volume.
temp_int_vistex-cust_sales = <source_fields>-cust_sales.
COLLECT temp_int_vistex INTO wa_int_vistex.
ENDLOOP.
LOOP AT wa_int_vistex INTO temp_int_vistex.
READ TABLE source_package[] INTO source_pkg WITH KEY
claim = temp_int_vistex-claim
customer = temp_int_vistex-customer
material = temp_int_vistex-material.
IF sy-subrc = 0.
CLEAR : result_pkg.
result_pkg-/bic/cddocnum = temp_int_vistex-claim.
result_pkg-/bic/zocmtmsr = 'VISTEX'.
result_pkg-/bic/cgtrantyp = temp_int_vistex-/bic/zocvcltyp.
result_pkg-/bic/cdrefnum = temp_int_vistex-/bic/zoclmref.
result_pkg-/bic/cgproduct = temp_int_vistex-material.
result_pkg-ship_to = temp_int_vistex-customer.
result_pkg-/bic/cditmnum = temp_int_vistex-/bic/zocvident.
result_pkg-/bic/cddstact = temp_int_vistex-cust_sales.
result_pkg-/bic/kgamount = temp_int_vistex-amount.
result_pkg-/bic/kgvolume = temp_int_vistex-volume.
result_pkg-g_uvv9ld = temp_int_vistex-g_uvv9ld.
APPEND result_pkg TO result_package.
ENDIF.
ENDLOOP.ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit ,
I appreciate your help .Your suggestions did help in the performance of data load but i am having problem here.In the data load only one record per data package is getting loaded in to the DSO(In 50000 records only 1 is loaded in to DSO per package and another 1 record getting for another data packet)though there are multiple records in source which are satisfying the logic written in routine then why all records are not updating to DSO.
Hi Jacko,
I think there is some issue with the logic. During the loop of source_package we are deleting all the records with claim, customer and material. So I think source_pacakge is left with only very few records in this loop only. And again while updating in result_package we are reading source package for claim, customer and material which we already deleted from source_package. So that is why you are losing most of the data.
Try not deleting the source_package records in its loop. Also can you tell us what is the actual requirement for which you are using expert routine?
Thanks
Amit
Hi,
There could be multiple reasons for this:
1. The routine is populating only some of the key fields of the target. The key fields CDFLDPOS, CALDAY, CDRECNUM and ZOCPRODCD are not populated. See if you can populate these from the source package or wa_int_vistex.
2. The wa_int_vistex table is populated through COLLECT statement, it is essentially a summarization of the source records. So it is possible that the wa_int_vistex table contains only one record in each data packet. You can verify this by debugging.
Regards,
Suhas
Hello ,
Is this a dump. If yes check in st22 to see which line actually is giving the error.
I think you are trying to access a field-symbol that is not assigned.
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
That is a common error, at what step you are getting error.
-Sriram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.