Skip to Content
0
Former Member
Feb 11, 2011 at 12:18 AM

End Routine - populating Target Field based on Master Data

151 Views

Hi,

I have an issue with my End Routine in BI 7.0. The scenario is as follows....

The Target-Fields ZSALES_OFFICE , 0SALES_CHANNEL etc. are being mapped 1:1 from their respective source fields. In addition to these target fields I have a target field 0SALESORG which I need to populate based on the values from 0COMP_CODE which is an attribute of ZSALES_OFFICE. The values of 0COMP_CODE are 9000, 9001, 9002 and 9003 respectively. The end routine condition needs to be implemented as follows...

For every 0COMP_CODE which has value 9000, 0SALESORG should be populated with the value "EAST". Similarly for every 0COMP_CODE which has value 9001, 0SALESORG should be populated with the value "WEST", for every 0COMP_CODE which has value 9002, 0SALESORG should be populated with the value "NORTH" and for every 0COMP_CODE which has value 9003, 0SALESORG should be populated with the value "SOUTH". I tried the following code but it doesnt seem to work. Could you pls help!!

Thanks,

SD

DATA: it_tab4 TYPE TABLE OF /BIC/PZF31SALOFF,

wa_tab4 TYPE /BIC/PZF31SALOFF.

SELECT *

FROM /BIC/PZF31SALOFF

INTO CORRESPONDING FIELDS OF TABLE it_tab4.

sort it_tab4 by /BIC/ZF31SALOFF.

LOOP AT RESULT_PACKAGE

INTO <result_fields>.

read table it_tab4

with key /BIC/ZF31SALOFF = <result_fields>-/BIC/ZF31SALOFF

into wa_tab4

binary search.

if sy-subrc eq 0.

CASE wa_tab4-comp_code.

WHEN '9000'.

<result_fields>-salesorg = 'EAST'.

WHEN '9100'.

<result_fields>-salesorg = 'WEST'.

WHEN '9200'.

<result_fields>-salesorg = 'NORTH'.

WHEN '9300'.

<result_fields>-salesorg = 'SOUTH'.

MODIFY it_tab4 FROM wa_tab4.

ENDCASE.

endif.

ENDLOOP.