Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

inserting data to database through screen fields

Hi friend iam passing a value from one field and if i press a push button 'SAVE' the value should update in the database . I tried with some coding . But it come with some error like the workare is not long enough .

TABLES : vbak .

TYPES: BEGIN OF t_data,

vbeln TYPE vbak-vbeln,

erdat TYPE vbak-erdat,

erzet TYPE vbak-erzet,

ernam TYPE vbak-ernam,

END OF t_data.

DATA : x_data TYPE T_DATA,

it_data TYPE TABLE OF t_data .

DATA : ok_code LIKE sy-ucomm .

DATA : so_no LIKE vbak-vbeln .

CONTROLS tc TYPE TABLEVIEW USING SCREEN 100 .

CALL SCREEN 100 .

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CASE ok_code.

WHEN 'DISPLAY'.

SELECT vbeln erdat erzet ernam FROM vbak INTO TABLE it_data WHERE vbeln = so_no .

CLEAR ok_code .

WHEN 'EXIT'.

LEAVE PROGRAM.

CLEAR ok_code.

WHEN 'UPDATE'.

LOOP AT it_data INTO x_data.

UPDATE vbak SET ernam = x_data-ernam

WHERE vbeln = x_data-vbeln.

ENDLOOP.

COMMIT WORK.

WHEN 'SAVE'.

X_DATA-VBELN = SO_NO .

<b><b>INSERT VBAK FROM X_DATA.

  • VBAK-VBELN = X_DATA-VBELN.</b></b>

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module UPDATE INPUT

&----


  • text

----


MODULE update INPUT.

MODIFY it_data FROM x_data INDEX tc-current_line TRANSPORTING vbeln ernam.

ENDMODULE. " UPDATE INPUT

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question