Skip to Content
0
p j
Dec 16, 2021 at 07:26 AM

Need a help in writing the end routine for psuedo code in Transformation self ADSO

74 Views

Hi All,

i am having an requirement where i already have data in a ADSO but we see few records having blank "Fund usage" in the data for the value category = 10 & posting type = 110 but for other combination we are getting the Fund Usage.

Now they want to fill the Blank Fund Usage based on the Other Fund usage value as in the system we have 2 values one with value and other is blank also the same need to be done for territory.

i have wrote a small code and i am not sure if the code is correct and i need your help.

Step 1. Create self-loop to DSO ZCBP*** and we will write END Routine.

Step 2. Build internal tables where fund usage and Territory is blank.

TYPES: BEGIN OF lty_FMFUGU,
CRM_FMFGU TYPE /BI0/OICRM_FMFGU, “Fund

CRM_FMFID TYPE /BI0/OICRM_FMFID, “Fund ID
CRM_TR TYPE /BI0/OICRM_TR, “Territory
CRM_FMFUGU TYPE /BI0/OICRM_FMFUGU, “Fund Usage
END OF lty_FMFUGU.

DATA: lt_FMFUGU TYPE STANDARD TABLE OF lty_FMFUGU,
wa_FMFUGU TYPE lty_FMFUGU,

lt_FMFUGU1 TYPE STANDARD TABLE OF lty_FMFUGU,

wa_FMFUGU1 TYPE lty_FMFUGU.

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

If <result_fields>-CRM_FMFGU NE Space and <result_fields>-CRM_TR = space and <result_fields>-CRM_FMFUGU = space.

wa_FMFUGU-CRM_FMFGU = <result_fields>-CRM_FMFGU.

wa_FMFUGU-CRM_FMFID = <result_fields>-CRM_FMFID.

wa_FMFUGU-CRM_TR = <result_fields>-CRM_TR.

wa_FMFUGU-CRM_FMFUGU = <result_fields>-CRM_FMFUGU.

Append wa_FMFUGU into lt_FMFUGU.

Clear wa_FMFUGU.

Endif.

ENDLOOP.

Step 3. Build internal table where fund usage and Territory is not blank.

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

READ TABLE lt_FMFUGU into wa_FMFUGU with key CRM_FMFID = <result_fields>-CRM_FMFID BINARY SEARCH.

If sy-subrc = 0

if <result_fields>-CRM_FMFUGU NE SPACE.

wa_FMFUGU1-CRM_FMFGU = <result_fields>-CRM_FMFGU.

wa_FMFUGU1-CRM_FMFID = <result_fields>-CRM_FMFID.

wa_FMFUGU1-CRM_TR = <result_fields>-CRM_TR.

wa_FMFUGU1-CRM_FMFUGU = <result_fields>-CRM_FMFUGU.

Append wa_FMFUGU1 into lt_FMFUGU1.

Clear wa_FMFUGU1.

Endif.

Endif.

ENDLOOP.

Step 3. Fill the fund usage and Territory.

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

READ TABLE lt_FMFUGU into wa_FMFUGU with key CRM_FMFID = <result_fields>-CRM_FMFID BINARY SEARCH.

if sy-subrc eq 0.

READ TABLE lt_FMFUGU1 into wa_FMFUGU1 with key CRM_FMFID = wa_FMFUGU-CRM_FMFID BINARY SEARCH.

if sy-subrc eq 0.

wa_FMFUGU-CRM_FMFUGU = wa_FMFUGU1-CRM_FMFUGU.

wa_FMFUGU-CRM_TR = wa_FMFUGU1-CRM_TR.

<result_fields>-CRM_FMFUGU = wa_FMFUGU-CRM_TR

<result_fields>-CRM_FMFUGU = wa_FMFUGU-CRM_FMFUGU.

Endif.

Endif.

ENDLOOP.


it will be really helpful if i get any quick suggestions on the code correction and betterment.


With Regards,

PJ.