How to fill target Fields from Start Routine?
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.
- 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.