cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT Please - Create new records while uploading data

Former Member
0 Kudos

Hi Gurus

We are using BW 7.0 and data is loaded to a custom InfoCube using Transformations. PSA is used to store data intermediately.

We have a requirement that data records from source system will come for different value types. If source data records contain '20' as value type then we need to split-up this record into 2 new records. The new data records should have value types '25' and '30'. And we need to distribute the amount in original data record equally among the 2 newly created data records.

Can somebody please explain how can we do that?

I think, we might have to write some code in Start Routine of Update Rules to do this but I know very little ABAP. So your expert help would be appreciated.

Points guaranteed!

Regards

Adi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Adi,

Data : Ls_source_package like source_package.

Data : Ls_source_package1 like source_package.

Loop at source_package into ls_source_package.

If ls_source_package-<Value Type> = '20' .

ls_source_package1-<value type> = 25.

ls_result_package1-<Amount> = ls_source_package-<amount> / 2.

append ls_result_package1 to source_package.

ls_source_package1-<value type> = 30.

ls_result_package1-<Amount> = ls_source_package-<amount> / 2.

append ls_result_package1 to source_package.

endloop.

Please apply the above code in the start routine and check..

Thanks,

Former Member
0 Kudos

Hi Githen

I applied your code in Start Routine of Update Rules but unfortunately I am getting a syntax error as below:

E:"LS_SOURCE_PACKAGE" cannot be converted to the line type of

"SOURCE_PACKAGE".

Kindly help.

Best Regards

Adi

Former Member
0 Kudos

Hello Adi,

Try:

DATA: ls_source_package TYPE SOURCE_PACKAGE.

Hope that helps

Former Member
0 Kudos

Hi Adi,

In transformation End Routine you do this.

Sample Code:


Data : Ls_result_package like result_package.
Data : lt_result_package type standard table of ls_result_package.

Loop at result_package into ls_result_package.
       If ls_result_package-<Value Type> = '20' .
       ls_result_package-<value type> = 25.
       ls_result_package-<Key Figure_1> = ls_result_package-<Key Figure_1> / 2.
       ls_result_package-<Key Figure_2> = ls_result_package-<Key Figure_2> / 2.
       ls_result_package-<Key Figure_3> = ls_result_package-<Key Figure_3> / 2.
       .
       .
       .
<i>--> For First Record</i>
       append ls_result_package to lt_result_package.
<i>---> for secound record</i>
       ls_result_package-<value type> = 30.
       append ls_result_package to lt_result_package.
       clear ls_result_package.
Endloop.

<i>--> Clear Result_package table</i>
Refresh result_package.

--> Push data from Lt_result_table to Result_Table.
Insert lines of table lt_result_table from 1 into result_table.

P.S: This is sample code only, check for systax errors....

Hope it Helps

Srini

Former Member
0 Kudos

Hi Srini

I will try a code on the above lines and update you if it works for me or not.

Thanks for your help.

Regards

Adi