0
Former Member
Sep 22, 2005 at 06:01 AM

Update Routine ... Help me Please--VERY URGENT

32 Views

Hi All ,

I Moving data from Cube to ODS . Let me explain abt the records in the cube .

There are 6 key figures in the cube as well as dimensions, UNIQKEY TRANSACTION is One Dimension and ARTICLE is another dimension which is having an Navigational attribute called CORE ELEMENT.

I am showing the data with those two dimension and the key figures which are to be used in the routine.

Charc----

Key Figures

UNIQKEY -ARTICLE -Coreelement --

billqty

-

in base unit

A00N---- 1006330 -- 1 --

10.5

A00M -

1006320---- 2 --

2.5

A00P---- -1006330 -- 1 --

10.5

A00P---- -1006320 -- 2 --

2.5

A00Q---- -1006320 -- 2 --

2.5

A00Q---- -1006340 -- 3 --

10.5

Now Lets see what the core element numbers mean,

core element 1 means -- fuel .

Core elemnet other 1 -- food .

I need to move these data into ODS Which will have an extra field called No of items in the transaction --ITEMS.For this i need to write a routine .

The Logic is ...

1.if Materail is of type 1(Means if the core element - 1)

I need to Populate the No of items in tnx = 1 .--ITEMS.

2.If Material is of type(Means if the core element)2or 3 I need to populate the billing quantity to the no of transcations.--ITEMS

3. If the Uniqkey tanscation contains two line items as suppose that you have 20 litres of fuel and 2 cans of coke, then No of Items in the transaction should be 3 and Billing Quantity in BUoM 22

billing quantity in BUoM = 20 litres for the first line item and 2 for the second line item...

then as the first line item is fuel, field No OF Items in the Transcation should be 1 (replacing the 20) + 2 = 3

so the final result in the ODS should be billing quantity in BUoM = 22 and The Items in the Transcation= 3

So the ODS Data should look like this.

UNIQKEY--

billqty--

ITEMS

-

in base unit

A00N--

10.5--

1

A00M--

2.5--

2.5

A00P--

13--

3.5

A00Q--

13--

12.5

NOTE : IN the ODS only the UNIQKEY IS THE KEY FIELD and the rest are DATA FIELDS.

I Posted this one before also. But didnt get proper responses.

I am Pasting the piece of code which I have written . This code will work for the first two records in the cube , But it is failing for the UNIQKEY Transcation having Line items.

PROGRAM UPDATE_ROUTINE.

\$\$ begin of global - insert your declaration only below this line -

TABLES: /BI0/PMATERIAL.

DATA: TITEMS LIKE /BIC/AZPOCODS00-/BIC/ZTITEMS,

CORE_ELEMENT like /BI0/PMATERIAL-RPA_WGH1.

\$\$ end of global - insert your declaration only before this line -

FORM compute_data_field

TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring

USING COMM_STRUCTURE LIKE /BIC/CS8ZPOCTUS04

RECORD_NO LIKE SY-TABIX

RECORD_ALL LIKE SY-TABIX

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS

CHANGING RESULT LIKE /BIC/AZPOCODS00-/BIC/ZTITEMS

RETURNCODE LIKE SY-SUBRC "Do not use!

ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update

*

\$\$ begin of routine - insert your code only below this line -

• fill the internal table "MONITOR", to make monitor entries

check not COMM_STRUCTURE-material is initial.

select SINGLE RPA_WGH1

INTO CORE_ELEMENT

from /BI0/PMATERIAL

where

material = COMM_STRUCTURE-material

and OBJVERS <>'D'.

IF CORE_ELEMENT EQ '1'.

TITEMS = '1'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = titems

IMPORTING

OUTPUT = titems

.

ELSE.

TITEMS = COMM_STRUCTURE-BILL_QTY.

ENDIF.

• result value of the routine

RESULT = TITEMS..

• if abort is not equal zero, the update process will be canceled

ABORT = 0.

\$\$ end of routine - insert your code only before this line -

PLease give me ideas on how to acheive this . As I am not Aware of ABAP very well.. PLease try to give me the code. I hope one of you may got the same requirement before.

Its very urgent and I need to deliver it today itself.

Thanks in advance , you can mail me to nagarjuna_bw@yahoo.co.in. If anybody intersted to discuss this Issue they can reach at +91 9845922955.