cancel
Showing results for 
Search instead for 
Did you mean: 

Routine with Return Table in ODS for currencies

Former Member
0 Kudos

Hi everyone,

I'm trying to extract two records from COPA into one in a custom cube for SEM.

<i>e.g. from COPA</i>

<u>CurType Currency Gross Sales</u>

10 EUR 1000

B0 USD 750

<i>in SEM cube </i>

Account becomes from KYF a CHAR and gets a # assigned

Based on CURTYPE in COPA I identify what fields I write currencies and amounts into.

(this is what I get, wher 'X' is empty field)

<u>LocC LocA GroupC GroupA Account</u>

X X USD 750 4550500

EUR 1000 X X 4550500

(would like to have)

<u>LocC LocA GroupC GroupA Account</u>

EUR 1000 USD 750 4550500

Any input? Thanks

Ramona

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Ramona,

just post your records like

LocC LocA GroupC GroupA Account

EUR 0 USD 750 4550500

EUR 1000 USD 0 4550500

You don't need a return table for this, this can easily be done with a simple routine with unit conversion.

regards

Siggi

Former Member
0 Kudos

Siggi,

The client want's the data in 1 record. Let me know if you have more input

Thanks

Ramona

Former Member
0 Kudos

You might first load them into an ODS where LocalCurr and GlobalCurr are in the data fields not in the key. Or you do a simple coding in the start routine of the update rules. It could look like this:

(Prerequisites: GAMOUNT,LAMOUNT,GCURR,LCURR are in the delivering InfoSource, but empty. If they aren't in the InfoSource or ODS, enter them as dummys.)

data: dp_line like line of data_package.

LOOP AT DATA_PACKAGE into DP_LINE.

if dp_line-curtype = 'B0'.

dp_line-/bic/GAMOUNT = dp_line-amount.

dp_line-/bic/GCURR = dp_line-currency.

else.

dp_line-/bic/LAMOUNT = dp_line-amount.

dp_line-/bic/LCURR = dp_line-currency.

endif.

clear dp_line-curtype.

modify DATA_PACKAGE from dp_line.

ENDLOOP.

Best regards

Dirk

Former Member
0 Kudos

Dirk,

Thanks for the advise. How do I define and where dummies?

Thanks, Ramona

Former Member
0 Kudos

Assuming doc# is the key for the data records in your example and that you are only dealing with these two currencies:

1- I would extract data records for each currency into a separate ODS. The two ODS would have data structure similar to your 'would like to have' layout.

2- You would map the fields from COPA to the ODS just as you wish.

3- Then, use the export data source of one ODS and map it to the second one to fill the remaining fields (this can only be done if you have the common key field i.e. doc#.

4- From this complete ODS you can then load your SEM cube.

It's not a sophisticated solution with a few assumptions but it should work for you without the ABAPing headache.

Message was edited by: Joe Nguyen