cancel
Showing results for 
Search instead for 
Did you mean: 

modify fields

Former Member
0 Kudos

Dear Gurus,

I was trying to modify a KF data field (ODS) with following code to update on itself but the field is not modified apparently.

LOOP at data_package.

data_package-/BIC/KF2 = data_package-/BIC/KF1.

modify data_package transporting /BIC/KF2.

ENDLOOP.

This is in start routine. Subsequently, update rules will aggregate the records. Each record has more than 1 KF as data fields.

The aggregated record (new record) shows the change in field KF2 but the source records are not showing the change as KF2 remains with old values!

Any ideas how this can be explained? Have I missed something?

Should I have used internal data_package ?

What is the difference if I do not use it?

Must I refresh the package?

What is the difference between using the syntax 'transporting' and not using it?

Must I do anything to the other KFs if their values should remain unchanged?

Best Regards,

Suzie

Accepted Solutions (1)

Accepted Solutions (1)

udayabhanupattabhiram_cha
Active Contributor
0 Kudos

Hi Suzie:

You don't need the Clear statement.

What is does it, it will clear the current line from Work Area. There are times that you need it, not in this case within a loop becasue when the loop goes to new Record, it will overwrite the old record.

Also, it does different tasks depending on where you write it.

This line will add unnecessary additional time. So, don't use it.

Ram Chamarthy.

Message was edited by: Ram Chamarthy

Message was edited by: Ram Chamarthy

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You can try removing the 'Transporting' addition.

LOOP at data_package.

data_package-/BIC/KF2 = data_package-/BIC/KF1.

modify data_package.

clear data_package.

ENDLOOP.

Removing it wont affect the other data fields.

Regards,

Prema

Former Member
0 Kudos

Dear Prema,

By clearing the data_package within the loop, would that delete the whole data_package at 1 go or just delete 1 record at a time but still delete everything?

Thanks,

Suzie

udayabhanupattabhiram_cha
Active Contributor
0 Kudos

Hi Suzie:

Remove 'transporting /BIC/KF2'. You don't need it.

The Remaining Code is correct.

Ram Chamarthy.

Message was edited by: Ram Chamarthy

Former Member
0 Kudos

Hello Suzie,

When you say, source records are not showing changed value, where you are checking this value?

Please check this from F1 help on the syntax of modify

... TRANSPORTING comp1 comp2 ...

Effect

The TRANSPORTING addition has the effect that only the specified comp1 comp2 ... components of the work area are assigned to the corresponding components of the line(s) to be changed. For sorted tables and hashed tables, no table key components may be specified after TRANSPORTING.

The comp1 comp2 ... component specifications are made in accordance with the rules specified in Component specification, with the constraint that after TRANSPORTING, no attributes of classes can be addressed using the object component selector.

Regards,

Praveen

Former Member
0 Kudos

Dear Praveen,

I am checking on the same ODS. Its both the source and target as I am doing a update on itself.

Please give me more help.

I just want to modify a data field without creating additonal records. There are some other data fields but they should not be modified. So, no code is added for these.

So, it was right to use 'transporting'. Any idea why the field was not modified?

Thanks in advance,

Suzie

Former Member
0 Kudos

Hello Suzie,

Your code seems to be correct, it will update KF2 with the value of KF1. You are correct to use Transporting addition as you want to modify only KF2 keeping other fields as it is.

Please debug the code to check how it working.

Regards,

Praveen