2010 Aug 16 11:46 AM
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
2010 Aug 16 12:00 PM
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
2010 Aug 16 12:34 PM
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.
2010 Aug 16 1:24 PM
2010 Aug 17 7:04 PM
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