cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill target Fields from Start Routine?

sherif_elkoumy
Participant
0 Kudos

Hello Abaper,

¨

I need to fill two fields in target DSO from DataSource that is including only one Field. The other 2 Fields are already existing in another DSO. I know I can achieve that using Read from DSO in Rule Type but I need to know how to achieve that using Start Routine only. Why do not wanna use Rule Type Read from DSO ? Because in many cases we have more than one conditions for lookup which cannot be implemented using rule type Read from DSO.

I wrote the following code, how can I populate the data in target fields and how can I add the target fields into source_package or source_fields,


DATA: ITAB  TYPE STANDARD TABLE OF /BIC/AZSE1DSO00,

         WA_ITAB LIKE LINE OF ITAB.


SELECT  /BIC/ZSECOMPC CURRENCY TXTMD

         FROM /BIC/AZSE1DSO00 INTO CORRESPONDING FIELDS OF TABLE ITAB

         FOR ALL ENTRIES IN RESULT_PACKAGE

         WHERE /BIC/ZSECOMPC = RESULT_PACKAGE-/BIC/ZSECOMPC.

         SORT ITAB ASCENDING BY /BIC/ZSECOMPC.

         LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.

         LOOP AT ITAB INTO WA_ITAB WHERE

             /BIC/ZSECOMPC = <RESULT_FIELDS>-/BIC/ZSECOMPC.

         IF SY-SUBRC = 0.

           <RESULT_FIELDS>-CURRENCY = WA_ITAB-CURRENCY.

           <RESULT_FIELDS>-TXTMD = WA_ITAB-TXTMD.

         ENDIF.

         ENDLOOP.

         ENDLOOP.


regards,


sherif

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

  • It is directly not possible. Declare a internal table as the result structure in the global area.
    • In the start routine populate the internal table
    • In the  end routine read that table to populate / move all the data to the result package and clear your internal table.
  • In the second case, create a internal table in Global area.
    • In the start routine fetch data
    • In the field routine read that internal table and populate your value to result.

Thanks.

sherif_elkoumy
Participant
0 Kudos

Hello Jugal,

I just wannted to avoid Fieldroutine in case you have many packages a 50k for instance. For this reason I asked about populating directly from Startroutine package by package.

Are you sure, that I would not work directly in Startroutine, I mean somehow declare targets fields in start routine and fill them?

rgds,

Sherif

Former Member
0 Kudos

My opinion NO . even if you declare them they are local inside that method (you can see this when you refer the generated program of your transformation).

For example in a class you have two method and inside that you have two variable with the same name. The value of one local is not be the same in another method ? .

In the field routine if you use binary search with the read statement it should be ok, else you can also go with using a # table and read the same in the field routine.

Thanks

Answers (0)