Application Development 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: 

Unicode Conversion Issue - ABAP, modification in database table.

Rangan
Explorer
0 Kudos
210

Facing unicode conversion issue in modify statement.

mod_tab.png

mod_tab1.png

 

Here's the code

DATA: datum TYPE sy-datum.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_date TYPE datum.
SELECTION-SCREEN END OF BLOCK b1.

CONSTANTS:lc_tabname TYPE tabname VALUE 'ztfre_layout'.

IF p_date IS INITIAL.
p_date = sy-datum - 1.
ENDIF.

IF p_date IS NOT INITIAL.

SELECT min_stock,
zvalto
FROM ztfre_layout
WHERE ( min_stock IS NOT INITIAL AND zvalto LT @p_date )
OR min_stock IS INITIAL
INTO TABLE @DATA(layout_tab).
IF sy-subrc = 0.

LOOP AT layout_tab ASSIGNING FIELD-SYMBOL(<layout>).
<layout>-min_stock = 0.
ENDLOOP.


IF layout_tab IS NOT INITIAL.

CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = lc_tabname
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
MODIFY ztfre_layout FROM TABLE layout_tab.
MESSAGE: 'Records updated successfully' TYPE 'S'.
COMMIT WORK AND WAIT.

CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = lc_tabname.
ENDIF.
ENDIF.

ENDIF.
ENDIF.

2 REPLIES 2

Rangan
Explorer
0 Kudos
166

Hi,

It's urgent, can anyone help.

M-K
Active Participant
0 Kudos
128

Hi Rangan,

for MODIFY, your internal table should correspond to the database table structure. So try to select from ztfre_layout with " * " instead of "min_stock, zvalto"

In this case, an UPDATE on ztfre_layout with "SET min_stock = 0" should work too, without selecting the data beforehand. Check the documentation here.