cancel
Showing results for 
Search instead for 
Did you mean: 

Calculations in Update rules

former_member374954
Participant
0 Kudos
87

Hi Gurus,


I have a requirement where I need to write a routine in Update rules. Its 3.5 data flow. I don't have SOURCE_PACKAGE and RESULT_PACKAGE structure available.


I looked around and whatever  examples I found were only 'Deleting' the entries from DATA_PACKAGE. My requirement is based on Two source Structure column, I have to pass results in Target structure column. This is to address 'an arithmetic error' in 2LIS_13_VDKON. I created another thread but there was no new answers hence creating new one and closed that one.


One of the answers which I got in my previous thread, suggested me to write a routine and I tried. (see below). But my question is how would I refer to Target Structure column in Update rules because DATA_PACKAGE is source structure.



DATA: WA_DATA_PACKAGE LIKE DATA_PACKAGE,


*      ZCRATE LIKE SY-TABIX.

*LOOP AT DATA_PACKAGE INTO WA_DATA_PACKAGE.

*  CLEAR ZCRATE.

*  ZCRATE = SY-TABIX.

*  IF  WA_DATA_PACKAGE-INV_QTY <>'0'.

*   DATA_PACKAGE-KPRICE = DATA_PACKAGE-KNVAL / DATA_PACKAGE-INV_QTY.

*    ELSEIF

*      DATA_PACKAGE-KPRICE = '0'.

*      ENDIF.

*      ENDLOOP.


Please help.


Regards

Prashant

Accepted Solutions (1)

Accepted Solutions (1)

FCI
Active Contributor
0 Kudos

Hi Prashant,


DATA_PACKAGE is the source and the target in the start routine. You just have to update it to make it work.


Your routine don't work because you don't update the internal table DATA_PACKAGE (you only update the header of the internal table).


Regards,

Frederic

former_member374954
Participant
0 Kudos

DATA_PACKAGE does not have the Target Field. How can I update DATA_PACKAGE?

former_member185132
Active Contributor
0 Kudos

Create a global internal table. This table should have all the key fields of the target DSO and also the target field.

Then, each time you LOOP at DATA_PACKAGE in your start routine, insert a record into this global itab, filling up the key fields and the target field.

Then write a field-level routine for the target field. It should lookup the global itab based on the key fields and get the value and populate it to the RESULT variable.

Answers (0)