09-28-2008 8:17 AM
Hi,
I'm getting the above error in unicode system for the below piece of code.
ASSIGN T_BUFFER to <T_BUFFER> .
INSERT INTO (<TABNAME>) VALUES <T_BUFFER>.
Issue is at the above INSERT statement where, <TABNAME> is
+FIELD-SYMBOLS: <TABNAME> type c.+ (Dynamic)
and, <T_BUFFER> is
FIELD-SYMBOLS: <T_BUFFER> type c.
Here structure differs for both the operands.What changes can I make to make them same to get the desired O/P.
Kindly help me with some inputs.
Regards,
Siva
09-28-2008 9:57 AM
since you defined the field-symbol as type c(single character). so use type any.
FIELD-SYMBOLS: <T_BUFFER> type c. "<---wrong
correction..
FIELD-SYMBOLS: <TABNAME> type c.
FIELD-SYMBOLS: <T_BUFFER> type any. "<-------Correction
ASSIGN T_BUFFER to <T_BUFFER> .
INSERT INTO (<TABNAME>) VALUES <T_BUFFER>.
09-28-2008 11:22 AM
Hi Vijay,
I tried that also.But still giving that same error.Kindly suggest me some other option
09-28-2008 4:55 PM
09-29-2008 4:10 AM
Hi Vijay,
Here is the subroutine code:
FIELD-SYMBOLS: <TABNAME> type c,
<T_BUFFER> type any.
FORM LOAD_HEADER_INTO_DATABASE.
ASSIGN T_BUFFER to <T_BUFFER> .
INSERT INTO (<TABNAME>) VALUES <T_BUFFER>. "dump error
IF SY-SUBRC = 0.
COUNT_INSERTS = COUNT_INSERTS + 1.
ELSE.
IF P_UPDTOK = 'X'.
UPDATE (<TABNAME>) FROM T_BUFFER.
IF SY-SUBRC = 0.
COUNT_UPDATES = COUNT_UPDATES + 1.
ENDIF.
ENDIF.
ENDIF.
IF SY-SUBRC <> 0.
IF COUNT_ERRORS EQ 0.
WRITE: / 'Failed inserts/updates:'.
SKIP 1.
ENDIF.
WRITE: /5 T_BUFFER(125).
COUNT_ERRORS = COUNT_ERRORS + 1.
T_ERRORS = STDIN.
APPEND T_ERRORS.
EXIT.
ENDIF.
ENDFORM. "LOAD_HEADER_INTO_DATABASE
Please check.
Regards,
Siva
09-29-2008 4:35 AM
Hello Siva
Still a crucial piece of information is missing - the structure of T_BUFFER.
Assuming that is just a C-container (e.g. TYPE TABLE OF string) then I would suggest the following changes:
FORM LOAD_HEADER_INTO_DATABASE.
DATA: ldo_data TYPE REF TO data.
FIELD-SYMBOLS: <ls_struc> TYPE any.
CREATE DATA ldo_data TYPE <tabname>.
ASSIGN ldo_data->* TO <ls_struc>.
"ASSIGN T_BUFFER to <T_BUFFER> . Replace by:
CALL METHOD cl_abap_container_utilities=>read_container_c
EXPORTING
im_container = T_BUFFER
IMPORTING
ex_value = <ls_struc>
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
INSERT INTO (<TABNAME>) VALUES <ls_struc>. "dump error
Please note that class CL_ABAP_CONTAINER_UTILITIES is available on SAP releases >= 6.20 (this information is missing as well from your posting).
Regards
Uwe
09-29-2008 5:07 AM
Hi Uwe,
Sorry for my previous message.
Your code is useful.
Now am getting a different dump saying " Work area is too small for ABAP/4 Open SQL work area operation."
at line
INSERT INTO (<TABNAME>) VALUES <ls_struc>.
Error ananlysis in dump.
Error analysis
The work area used to hold the values passed for the SQL work area
operation must be at least as wide as the database table you are
accessing.
In this particular case, the database table is 234 bytes wide,
In this particular case, the database table is 234 bytes wide,
but the work area is only 20 bytes wide.
How to overcome it.Pls guide me.
Thanks in adv,
Siva
Edited by: Siva on Sep 29, 2008 6:21 AM
09-29-2008 5:45 AM
Siva,
Can you please let me know how did you corrected the error "trying to access the unassigned field symbol"?
Thanks,
K.Kiran.
09-29-2008 5:48 AM
Hi Kiran,
Pls check Uwe's message.It's helpful.I applied the same logic.
/Siva
09-29-2008 10:29 AM
Hi,
Could anyone comment on the below dump..?
" Work area is too small for ABAP/4 Open SQL work area operation."
Checked and no Basis issue.
Pls let me know the cause and solution for this.
Thanks,
Siva