cancel
Showing results for 
Search instead for 
Did you mean: 

SAP BW - transposing objects columns to rows

former_member557628
Discoverer
0 Kudos

Hi there,

we need a solution to this cenario:

source (object with atributes)

material  -  area - lifetime

    1             0         10

    1             1         20

    1             2         28

destination (into the same object with atributes)

material  -  area - lifetime - lifetime 1 - lifetime 2 - lifetime 3

    1             0         10        10              20            28 

    1             1         20        10              20            28 

    1             2         28        10              20            28 


this fields are all of type char.


is it possible to use group rules in the transformation to get this results?

thanks,

GPC

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In the start routine, copy source_package to temp_package. Loop thru source_package, and for each record, read the temp_package to pull the needed values to the 3 new columns.  The DTP will need semantic grouping by material to ensure all the rows for a material are in the same data package.

Answers (2)

Answers (2)

former_member202257
Contributor
0 Kudos

Can you try using an APD to perform this same function? Component : Transform Data Record into List

BenedictV
Active Contributor
0 Kudos

Hi Goncalo,

A few options come to mind. One is to use a rule group for each value of life time, provided you have only these three values for lifetime otherwise you will have to create too many rule groups and the transformation is executed 'n' times for 'n' lifetime values.

In rule group one update only 10, in two only 20....and so on.

Another option(if only three lifetime values) is to copy the SOURCE_PACKAGE to three different internal table(one with only 10, one with 20...better have a hashed table since you are only going to be reading) and read the tables for each record passing through the SOURCE_PACKAGE loop.

Third is to copy source to a sorted internal table like Kurt Johnson suggested above and have a loop with index inside the source package for each record.

You make have to make a choice based on the performance of the transformation

Benedict

former_member557628
Discoverer
0 Kudos

thanks for the responses. Some more information:

material anda area are keys... when im saying lifetime 1 is for area 0, lifetime 2  is for area 1 and lifetime 3 is for area 2

source (object with atributes)

material  -  area - lifetime

    1             0         10

    1             1         20

    1             2         28

destination (into the same object with atributes)

(KEY)     (KEY)              (for area 0) (for area 1) (for area 2)

material  -  area - lifetime - lifetime 1 - lifetime 2 - lifetime 3

    1             0         10        10              20            28

    1             1         20        10              20            28

    1             2         28        10              20            28


with this new information i can use the rule group, rigth?


BenedictV
Active Contributor
0 Kudos

If these are the only fields in the transformations then you can very well use rule groups, but if you have like 15-20 fields in your source and target then executing the transformation for each rule group would be a burden..then you can think of other options like LOOP or READ inside routines.

former_member557628
Discoverer
0 Kudos

and how will be the rules group....

something like:

rules 1

source           target

material ----- material

area      ------ area

lifetime ------ lifetime 1

rules 2

source           target

material ----- material

area      ------ area

lifetime ------ lifetime 2

not sure if this is going to work like this...

BenedictV
Active Contributor
0 Kudos

There are a lot of documents and discussions on rule group. I would encourage you to search for documents on rule groups and try it.

One hint is in your case have the same key in target as in source. In your first rule group(default) have lifetime2 and 3 as no update and so on for every rule group.

anindya_bose
Active Contributor
0 Kudos

This message was moderated.

Loed
Active Contributor
0 Kudos

Hi,

Something like this..

rules 1

source           target

material ----- material

area      ------ 0 (constant)

lifetime ------ lifetime 1

rules 2

source           target

material ----- material

area      ------ 1 (constant)

lifetime ------ lifetime 2

rules 3

source           target

material ----- material

area      ------ 2 (constant)

lifetime ------ lifetime 2

Regards,

Loed