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: 

Table event in ECC 6.0

Former Member
0 Kudos
218

Hi,

I have used a table event to update the changed date and changed by in a custom table in SAP 4.7. It is working fine.

Now in ECC6.0, there is a similar requirement, but the similar code does not work. Can you please help?

The code I used in SAP 4.7 is given below.

*****************************************************************

FORM sub_update_user_date.

DATA: l_tabix TYPE sytabix.

DATA: BEGIN OF l_total.

INCLUDE STRUCTURE ZORF_XREF_3PL.

INCLUDE STRUCTURE vimtbflags.

DATA: END OF l_total,

l_record TYPE ZORF_XREF_3PL.

LOOP AT total INTO l_total.

IF l_total-vim_action = aendern

OR l_total-vim_action = neuer_eintrag.

MOVE-CORRESPONDING l_total TO l_record.

l_record-last_chng_by = sy-uname.

l_record-last_chng_dt = sy-datum.

READ TABLE extract WITH KEY l_total.

IF sy-subrc EQ 0.

l_tabix = sy-tabix.

ELSE.

CLEAR l_tabix.

ENDIF.

MOVE-CORRESPONDING l_record TO l_total.

MODIFY total FROM l_total.

CHECK l_tabix GT 0.

MODIFY extract INDEX l_tabix FROM l_total.

ENDIF.

ENDLOOP.

ENDFORM. "sub_update_user_date

*****************************************************************

JC

4 REPLIES 4

Former Member
0 Kudos
179

Hi,

Your code looks good...

But a small change, hope this should work.

READ TABLE extract WITH KEY l_total.
*IF sy-subrc EQ 0.*
*l_tabix = sy-tabix.*
*ELSE.*
*CLEAR l_tabix.*
*ENDIF.*
*l_total-last_chng_by = sy-uname.*
*l_total-last_chng_dt = sy-datum.*
*MODIFY total FROM l_total.*
MODIFY extract INDEX l_tabix FROM l_total.

Regards

Shiva

0 Kudos
179

But I am getting dump at line

LOOP AT total INTO l_total.

And the Error analysis is as follows:

The statement

"MOVE src TO dst"

requires that the operands "dst" and "src" are convertible.

Since this statement is in a Unicode program, the special conversion

rules for Unicode programs apply.

In this case, these rules were violated.

0 Kudos
179

Check the solution here

former_member680493
Participant
0 Kudos
179

Hi,

you should do like this:



    LOOP AT total.
      Field-symbols: <z_total_struc> type any.

      ASSIGN: total TO <z_total_struc> CASTING LIKE <vim_total_struc>.

      MOVE <z_total_struc> TO wa_your_tab.
      ...
" Fill wa_your_tab
      ...
      
       MOVE wa_your_tab TO <z_total_struc>.


I hope it helps you.

Gabriel