Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Transformations - end routine

Former Member
0 Likes
415

Hi,

My Question is wrt. Transformations in BW.

I have an end routine where I want to fill some keyfigures in the target cube based on some condition. For eg Keyfigure1 has to be filled only if the org is usa or canada or if the org value exists as entry in a zorg field in a ztable after reading the table.

Only for these selected orgs, keyfigure is to be populated.

I tried by myself and wrote some code but I dont know why the code is not being executed at all.

Please help me in writing the code. I would be happy if anyone can write along with the declaration.

I will assign points.

Thanks,

Aryaman

2 REPLIES 2
Read only

Former Member
0 Likes
392

Where are you writing the code?

In the end routine, you need to work on RESULT_PACKAGE internal table as this is the output of the transformation.

Send your code from the end routine, it will help us to help you.

Thanks

Sanjeev

Read only

Former Member
0 Likes
392

Hi Sanjeev,

Thanks for your quick response.

Here is my code:

(The whole logic is if the org is usa or can or any of the values in the field zstorg in table zretail, amount1 has to be zero and amount2 has to be same as the amount3 in result fields)

TYPES : BEGIN OF t_rorg,

rorg TYPE zretail_org-zstorg

END OF t_rorg.

DATA: i_rorg TYPE STANDARD TABLE OF t_rorg.

DATA: w_rorg TYPE t_rorg.

DATA: i_result TYPE STANDARD TABLE OF tys_TG_1.

DATA: w_result TYPE tys_TG_1.

loop at RESULT_PACKAGE assigning <RESULT_FIELDS>.

if w_result-/bic/zorg = 'USA' or

w_result-/bic/zorg = 'CAN'

<RESULT_FIELDS>-/bic/zamount1 = 0.

<RESULT_FIELDS>-/bic/zamount2 = <RESULT_FIELDS>-/bic/amount3.

Elseif.

READ TABLE i_rorg INTO w_rorg

WITH KEY rorg = RESULT_FIELDS>-/bic/zorg

BINARY SEARCH.

IF sy-subrc = 0.

<RESULT_FIELDS>-/bic/zamount1 = 0.

<RESULT_FIELDS>-/bic/zamount2 = <RESULT_FIELDS>-/bic/zamount3.

endif.

Endif.

endloop.

REFRESH result_package.

Please correct me if I am wrong.

Thanks,

Aryaman

Edited by: Aryaman Krishna on Dec 29, 2007 12:14 AM

Edited by: Aryaman Krishna on Dec 29, 2007 12:14 AM