Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

cdhdr & cdpos

Former Member
0 Likes
895

Hi,

In user-exit i am changing the plant status .Example - 'P1' is the intial value and then on certain condition it has been changed to 'SO' and later on to 'CC' , at the end of the process i want to assign the orginal value 'P1' to the status.

how can i get the original value , i think the maximum changenr logic in cdhdr cannot be applied here .

Thanks & Regards.

Syed

7 REPLIES 7
Read only

Former Member
0 Likes
828

Hi,

another way of achieving this requirement is,

1) turn on tabble logging for the table whichis having plant status field.

2) when this field value is changed, then entries will be created in DBTABPRT r/3 table.

3) based on table name, key (sy-mandt concatenated with other key elements of the table to whcih tabble logging is turned on), change dt (AS4DATE) fields, you can retrieve data from DBTABPRT r/3 table.

4) sort records retrieved by table name, key, date and time fields. The first record will be having the original value for plant status before change.

Note: Some time you maybe getting more than one records with same value specified in point 4. in this situation you have to considar counter field value also.

best way is after reading first record, loop the internal table with the index and compare the current plant status value with dbtab prt records value.

hope this will help.

regards,

sundaramj

Read only

0 Likes
828

Hi,

thanks for ur reply , how can i turn on the table logging , i am using mstae field in mara , i am using 4.6 c .

Regards

Syed

Read only

0 Likes
828

Table logging is usually done by the BASIS team..

~Suresh

Read only

0 Likes
828

hi ,

i think in the technical setting there is log data changes , if the flag is set , will this work or other settings are required ?

Regards

Syed

Read only

0 Likes
828

not that I know of..

~Suresh

Read only

Former Member
0 Likes
828

Yes sayed.

we have check table logging checl box intechnical settings. This will be done by basis (access key is required to change r/3 table technical settings).

tegards,

sundaramj

Read only

former_member186741
Active Contributor
0 Likes
828

you might be able to use an import/export approach to save and restore the initial value. On the first time the exit is entered, ie. when a save variable is initial, set the variable to the value of the field you are dealing with (mara-mstae) and then 'export' it.

eg,

data l_old_status type mara-mstae.

*... retrieve status

IMPORT l_old_status FROM MEMORY ID 'mara-mstae'.

*... if there is already a non-blank one - keep it

CHECK l_old_status IS INITIAL.

*... save status for later use

EXPORT l_old_status FROM mara-mstae TO MEMORY ID 'mara-mstae'.

In your code when you want to restore the mara-mstae:

*... restore original status

IMPORT l_old_status = mara-mstae FROM MEMORY ID 'mara-mstae'.