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: 

field updating to db table

Former Member
0 Kudos

hi all,

I create a field on screen(from dictionary) named zvtrans-zsdate. and the value entered in this screen field should be update to zvtrans table.

but in the PAI of the screen if I write like this it is not working

PROCESS AFTER INPUT.

MODULE finalise.

MODULE finalise INPUT.

IF sy-dynnr = '0200'..

IF ok_code = 'SAVE'.

PERFORM refresh_screen_200.

PERFORM save_screen_200.

endif.

FORM save_screen_200

zvtrans-zsdate = zvtrans-zsdate.

MODIFY zvtrans.

endform.

7 REPLIES 7

Former Member
0 Kudos

Hi,

Change your modify statement to

MODIFY zvtrans from zvtrans.

former_member195383
Active Contributor
0 Kudos

Hi please see wat is the key fild of the table that u are using..

supose zkey is the field...

then inside the FM

FORM save_screen_200

zvtrans-zsdate = zvtrans-zsdate.

zvtrans-zkey = wf_zkey.

MODIFY zvtrans transporting zsdate.

endform.

wf_zkey ...is the value of the key in the program...that u will be using

alternatively u can declare a workarea of the type ztrans i.e wa_ztrans.

selct * into wa_ztrans

from ztrans

where zkey = wf_key.

FORM save_screen_200

wa_ztrans-zsdate = zvtrans-zsdate.

.

MODIFY zvtrans from wa_ztrans transporting zsdate.

endform.

this also will work....

Reward points if the soltn is helpful...

Edited by: Rudra Prasanna Mohapatra on Jun 18, 2008 12:41 PM

Former Member
0 Kudos

Hi

U should post the code of form refresh_screen_200, probably u clear the headerline of the table before saving it.

MAx

Former Member
0 Kudos

hi....

just check if you hae declared ok_code in the screen attributes.

and also in the top include of the program.

activate it and then check if the ok_code is getting assigned properly.

you can use the update functionality to update your table corressponding the screen field rather than modify if you dont have the key fields.

Former Member
0 Kudos

Hi,

Why don't you try UPDATE command.

Example :

UPDATE zvtrans-zsdate = zvtrans-zsdate
     SET  zvtrans-zsdate = zvtrans-zsdate
      WHERE  some condition....

        IF sy-subrc EQ 0.
          COMMIT WORK.
          l_error = 'X1'.
        ELSE.
           l_error = 'X2'.
           CLEAR l_error.
           ROLLBACK WORK.
         ENDIF.

Hope this will help you.

Plz reward if useful.

Thanks,

Dhanashri.

Former Member
0 Kudos

if i am giving zvtrans-zsdate eq sy-datum.

it is taking the current system date.

but if i am giving zvtrans-zsdate(table field) = zvtrans-zsdate(screen field).

it is not taking the database table.

0 Kudos

Check the format of the date , wht format it is using . kIndly change it to SAP standard format.