‎2008 Mar 05 8:51 AM
when i m clicking the save button on the screen , the data should get saved in the database table.
i'm doing the followin but still i am not getting the desired output.
case 'OK_CODE'.
WHEN 'SAVE'.
perform fill_data on commit.
ENDCASE.
and in perform following is written.
form FILL_DATA .
MODIFY zemployee542 FROM ZEMPLOYEE.
COMMIT work.
MESSAGE S001(ZCA).
LEAVE TO SCREEN 1002.
endform. " FILL_DATA
zemployee is my internal table nad zeployee542 is my database table tht i have made using se11 transaction.
‎2008 Mar 05 8:56 AM
case 'OK_CODE'.
WHEN 'SAVE'.
perform fill_data on commit.
Commit work.
ENDCASE.
and in perform following is written.
form FILL_DATA .
MODIFY zemployee542 FROM ZEMPLOYEE.
MESSAGE S001(ZCA).
LEAVE TO SCREEN 1002.
endform. " FILL_DATA
you need to write commit work outside the perform to trigger the subroutine(on commit).
Neeraj
‎2008 Mar 05 8:56 AM
see i have used
modify z11_vivek_tab from table it_table.
and it was working fine without commit statement.
i think problem is with your perform logic.
do one thing write logic without using perform.
there might b second case that u have kept maintenance not allowed
attribute for your database table . so make it allowed without any restriction
plz reward if useful
vivek
‎2008 Mar 05 9:00 AM
First find the sy-ucomm of the "save" button on your GUI status.
then u can update your data base table using Insert statement.
case sy-ucomm.
When 'SAVE'.
Insert dbtable from itab.
endcase.
Check for sy-subrc on debugging and let me know if this doesn work.
‎2008 Mar 05 9:00 AM
Hi Friend,
Try this.
"Declaration.
data : begin of zemployee.
Include structure zeployee542.
data : end of zemployee.
*in screen give field name as <zemployee-Fieldname>
case 'OK_CODE'.
WHEN 'SAVE'.
perform fill_data.
ENDCASE.
form FILL_DATA .
move-corresponding zemployee to zeployee542.
insert zeployee542.
clear : zemployee, zeployee542.
endform. " FILL_DATA
Reward if you find usefull
‎2008 Mar 05 9:02 AM
Hi,
Put a break point at MODIFY statement and check the sy-subrc VALUE.
form FILL_DATA .
MODIFY zemployee542 FROM ZEMPLOYEE.
IF sy-subrc IS INITIAL.
COMMIT work.
MESSAGE S001(ZCA).
LEAVE TO SCREEN 1002.
*ELSE.
MESSAGE e002(ZCA). "Data base updation failed.
ENDIF.*
endform. " FILL_DATA
Thanks,
Vinod.