Skip to Content
avatar image
Former Member

How to fill target Fields from Start Routine?

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 11, 2015 at 09:39 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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