on 05-15-2015 6:42 AM
Hi Friends,
I wrote a lookup in transformations to get a field called assignment from FIAR DSO and put it in FIGL DSO. I wrote a end routine but it is throwing an error. Please look into it and let me know what i have done wrong.
The error is showing as "You cannot use an internal table as a work area" Please look into the screen shots for the code.
Thanks,
Global declarations below:
Logic below:
Thanks,
Karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1. Don't keep select inside loop. It should be outside the loop.
2. Write the code: select
Icoorder
.................
............................
........................ from /bic/azka_fiar00 into table it_fiar for all entries in result_package where <condition>.
3. Debug the code.
4. replace work area with field symbol<result-fields>. No needs to use modify the result-package.
Thanks,
Swapna Jain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthik,
Your lookup is completely done in the end routine, so there's no need to declare anything globally (leave the 1st and 2nd part global empty).
Try this:
TYPES: BEGIN OF ty_fiar,
COORDER TYPE /BI0/OICOORDER,
DOC_NUM TYPE /BI0/OIDOC_NUM,
COMP_CODE TYPE /BI0/OICOMP_CODE,
/BIC/ZIA_ASIGN TYPE /BIC/OIZIA_ASIGN,
END OF ty_fiar.
DATA: lt_fiar TYPE SORTED TABLE OF ty_fiar
WITH NON-UNIQUE KEY COORDER,
ls_fiar TYPE ty_fiar.
SELECT COORDER
DOC_NUM
/BIC/ZIA_ASIGN
FROM /BIC/AZKA_FIAR00
INTO CORRESPONDING FIELDS OF TABLE lt_fiar
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE COORDER EQ RESULT_PACKAGE-COORDER
AND COMP_CODE EQ RESULT_PACKAGE-COMP_CODE.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
IF NOT <RESULT_FIELDS>-COORDER IS INITIAL.
READ TABLE lt_fiar INTO ls_fiar
WITH KEY COORDER = <RESULT_FIELDS>COORDER.
IF sy-subrc = 0.
<RESULT_FIELDS>-/BIC/ZIA_ASIGN = ls_fiar-/BIC/ZIA_ASIGN.
ENDIF.
ENDIF.
ENDLOOP.
Hope it will work for you.
Rgds,
René
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The select statement needs to be modified:
SELECT .... INTO TABLE IT_FIAR.
Also, please look into the naming conventions and performance of the code. For instance, DISTINCT should be avoided, it degrades performance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthik,
Since you are selecting field values based on key field and you are putting in internal table it_fiar.
it's table. so you write the statement :
Select Icoorder
.................
............................
........................ from /bic/azka_fiar00 into table it_fiar.
Thanks,
Swapna Jain
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
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.