cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with the routine

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks all for the help. I cleared the issue with the help of my Abaper.

Answers (3)

Answers (3)

former_member214415
Active Participant
0 Kudos

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

0 Kudos

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é

former_member185132
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Suhas,

I am not bothered about performance currently. I just want to clear this error.

I modified the code but now it is showing a different issue. I am attaching screenshots.

Karthik

former_member214415
Active Participant
0 Kudos

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

RamanKorrapati
Active Contributor
0 Kudos

Hi,

Select statement after the loop, you mentioned wrong field name instead /BIC/ZIA_ASIGN.

So thats why you got unknown issue about field ZIA_ASIGN.

So please use /BIC/ZIA_ASIGN in select statement instead ZIA_ASIGN.

Thanks