cancel
Showing results for 
Search instead for 
Did you mean: 

Coding in Update Rules

i807185
Associate
Associate
0 Kudos

Hi all,

I have a datasource that among other fields (Material, Month) delivers the following information

<b>Key Figure: Total Shipments (ZTOTSHIP) and

Characteristic: Shipment ID (ZSHIPID). Shipment ID can have the value 1 or 2</b>

I would like to implement the following logic in the update rules. Can you help with that?

<b>If in a datarecord

- Total Shipments (ZTOTSHIP) comes in combination with

Shipment ID (ZSHIPID) = '1' then update Key Figure A

(ZA).

If in a datarecord

- Total Shipments (ZTOTSHIP) comes in combination with

Shipment ID (ZSHIPID) = '2' then update Key Figure B

(ZB).</b>

Can you help with the coding for that in the update rules?

Thanks a lot

Christian

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Christian,

You can do this by using formula. Write following formula for Key Figure A(ZA):

If(ZSHIPID='1', ZTOTSHIP, 0)

Similarly use following formula for Key Figure B(ZB):

If(ZSHIPID='2', ZTOTSHIP, 0)

Regards,

Rohit

Former Member
0 Kudos

There is two ways to do it. One is update rule level or at the start routine of the update rule.

Update rule leve create a formula for the key figure ZTOTSHIP

then use if condition

IF( ZSHIPID = 1, ZTOTSHIP = 'za', ZTOTSHIP = 'zb' )

Or on your start routine use the following

Loop at Data_package

if Data_package-ZSHIPID = '1'

Data_package-ZTOTSHIP = 'ZA'

else

Data_Package-ZTOTSHIP = 'ZB'

endif.

Modify Data_package.

endloop.

Former Member
0 Kudos

if i got your requirement correctly.

please check this.

IF( communication_structure-ZSHIPID = 1).

communication_structure-ZA = communication_structure-communication_structure-ZTOTSHIP.

elseif (communication_structure-ZSHIPID = 2).

communication_structure-ZB = communication_structure-ZTOTSHIP.

endif.

check this and let me know. you can write this in the Update Rule.

All the best.