‎2006 Nov 27 1:47 PM
Hello guys,
I am trying to figure out SM30 table events. I have lots of coding samples from the forum, but most of them doesn't work, because of a unicode short-dump.
I am trying to implement a Before save event (01) in this form:
FORM update_user_date_time.
DATA: f_index LIKE sy-tabix.
DATA: BEGIN OF l_total.
INCLUDE STRUCTURE zztable.
INCLUDE STRUCTURE vimtbflags.
DATA END OF l_total.
DATA: s_record TYPE zztable.
LOOP AT total INTO l_total.
IF l_total-vim_action = aendern OR
l_total-vim_action = neuer_eintrag.
MOVE-CORRESPONDING l_total TO s_record.
s_record-zz_user = sy-uname.
s_record-zz_date = sy-datum.
s_record-zz_time = sy-uzeit.
READ TABLE extract WITH KEY l_total.
IF sy-subrc EQ 0.
f_index = sy-tabix.
ELSE.
CLEAR f_index.
ENDIF.
MOVE-CORRESPONDING s_record TO l_total.
MODIFY total FROM l_total.
CHECK f_index GT 0.
MODIFY extract INDEX f_index FROM l_total.
ENDIF.
ENDLOOP.
ENDFORM. " UPDATE_USER_DATE_TIME
The short dump is this:
Runtime Error UC_OBJECTS_NOT_CONVERTIBLE
Date and Time 27.11.2006 14:28:10
ShrtText
Data objects in a Unicode program are not convertible.
on this line:
>>>>> LOOP AT total INTO l_total.
Can someone help me please?
Thank you!
‎2006 Nov 27 2:55 PM
Hi,
U can give a try with this:
Declare a field symbol of type VIM_TOTAL_KEY as given in the docu.
Loop at total assigning <fiel symbol> .
after this we can do one to one dat transfer to s_record or if the structur eof both s_rcord and field symbol is same then we can directly use the MOVE-corresponding statement.
Hope this helps.
‎2006 Nov 27 2:07 PM
hi,
As per my knowledge the problem would be in the declaration of "toal" and "l_total".
Can you please send me the declaration of data object "total"?
So that I can understand the problem more clearly and will try to find a solution.
Regards,anjireddi
‎2006 Nov 27 2:19 PM
Total is a Global data object in that event.
More details here:
http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm
‎2006 Nov 27 2:20 PM
‎2006 Nov 27 2:24 PM
I saw that document, thank you.
But no example there for event 01 ( Before save ) , or with total data object.
‎2006 Nov 27 2:09 PM
i think local internal table definition should be
DATA: BEGIN OF l_total OCCURS 0.
INCLUDE STRUCTURE zztable.
INCLUDE STRUCTURE vimtbflags.
DATA END OF l_total.
OCCURS 0 will create an implicit work area with the name same as internal table name. Award points if it helps.
Regards,
Amol
‎2006 Nov 27 2:16 PM
Thank you for reply!
I tried your solution, but same result, I don't know what is the problem....
‎2006 Nov 27 2:55 PM
Hi,
U can give a try with this:
Declare a field symbol of type VIM_TOTAL_KEY as given in the docu.
Loop at total assigning <fiel symbol> .
after this we can do one to one dat transfer to s_record or if the structur eof both s_rcord and field symbol is same then we can directly use the MOVE-corresponding statement.
Hope this helps.
‎2006 Nov 28 8:28 AM
Hi again,
VIM_TOTAL_KEY is not a type, is a <fs> type ANY .
I can use a <fs> type ANY , bun I cannot access the individual components of table line total...