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

Table Maintaince Generator Using Single Step Problem

Former Member
0 Likes
702

Hai ,

I am using table maintaince generator in single step , I am using events for updating the back ground entries like created by and changed by and I am using the total structure , the Table is getting updated in case of create and if the same entry is being modified in same screen the value it is over wrriting and the created field in the data base it is not populating for this i am using the event befor save .

below is the code that i have used .

LOOP AT total INTO l_wa_total.

*

IF l_wa_total-action EQ 'N'.

l_wa_total-createdon = sy-datum .

l_wa_total-createdby = sy-uname .

endif .

IF l_wa_total-action EQ 'U'.

l_wa_total-changedon = sy-datum .

l_wa_total-changedby = sy-uname .

ENDIF.

MODIFY TOTAL FROM l_wa_total.

regards,

K.Vinay Kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
667

Hi,

Modify your code as below:

LOOP AT total INTO l_wa_total.

*

IF l_wa_total-action EQ 'N'.

l_wa_total-createdon = sy-datum .

l_wa_total-createdby = sy-uname .

MODIFY TOTAL FROM l_wa_total transporting createdon createdby.

endif .

IF l_wa_total-action EQ 'U'.

l_wa_total-changedon = sy-datum .

l_wa_total-changedby = sy-uname .

MODIFY TOTAL FROM l_wa_total transporting changedon changedby.

ENDIF.

Thanks,

Navneeth K.

Endloop.

5 REPLIES 5
Read only

Former Member
0 Likes
668

Hi,

Modify your code as below:

LOOP AT total INTO l_wa_total.

*

IF l_wa_total-action EQ 'N'.

l_wa_total-createdon = sy-datum .

l_wa_total-createdby = sy-uname .

MODIFY TOTAL FROM l_wa_total transporting createdon createdby.

endif .

IF l_wa_total-action EQ 'U'.

l_wa_total-changedon = sy-datum .

l_wa_total-changedby = sy-uname .

MODIFY TOTAL FROM l_wa_total transporting changedon changedby.

ENDIF.

Thanks,

Navneeth K.

Endloop.

Read only

Former Member
0 Likes
667

DO these:

1. Use clear whenever necessary.

2. Use different workarea . not as you are using at present . Use one for loop and second for new values.

3. Use sy-index to modify your table. It is faster and accurate.(AS, per my understanding this will solve your issue)

Read only

Former Member
0 Likes
667

Have you checked the help for event 01? It's explained there.

Rob

Read only

Former Member
0 Likes
667

Hi Vinay,

There is a workarea exist with the same name of the table .So use that work area in your code.

Any ways if its while creation or update you want to fill the sy-datum and sy-uname.

Just use the update the value of the ZTABLE-changedon and Ztable-changedby.

The standard code of the table maintainance will handle the rest of the thing.

I hope this will help you.

Read only

Former Member
0 Likes
667

hai ,

I have solved the problem thanks for your information .

Regards

K Vinay Kumar