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: 

Unable to save current data

Former Member
0 Kudos

Hi all

I am badly stuck , I have a form that contain 2 button, one is edit and the other is exit, when I press edit button and input apartment no (its akey field) then system read data and fill the screen and if i change some data and press exit button then system show me a dialog box data has been changed by using ask_save builten function and when i press yes then system leave the screen and cannot save my current data means updated data, please advice

MODULE exit_0100 INPUT.
  CASE ok_code.
    WHEN 'EXIT'.
      IF sy-datar IS INITIAL AND flag IS INITIAL.
* no changes on screen 100
        LEAVE PROGRAM.
*        MOVE-CORRESPONDING ZUT_APARTMENT TO ls_newapartment.

      ELSE.
*        ls_newapartment  = ZUT_APARTMENT.
*        MOVE-CORRESPONDING ZUT_APARTMENT TO ls_newapartment.
*       IF  ls_newapartment  NE ls_oldapartment.
*        PERFORM check_for_updation_100.
        MOVE-CORRESPONDING zut_apartment TO ls_newapartment.
        IF  ls_newapartment  NE ls_oldapartment.
          PERFORM ask_save_0100 USING answer.
          CASE answer.
            WHEN 'J'.
              ok_code = 'SAVE&EXIT'.
            WHEN 'N'.
              LEAVE PROGRAM.
            WHEN 'A'.
              CLEAR ok_code.
              SET SCREEN 100.

          ENDCASE.


        ENDIF.
        LEAVE PROGRAM.
      ENDIF.

3 REPLIES 3

Former Member
0 Kudos

You are simply trying to change the value of the OK_CODE in a CASE statement. I'm not sure if this would work or not. But you have to actually do the SAVE if the answer is yes, not change the OK_CODE.

Rob

0 Kudos

Thanks for the reply, I thought the ask_save function can takecare of my code, but, When i refer to your answers then I realize that I need to define subroutine for save or update . Please advice me that can i put my saving or updation code like this.

PERFORM ask_save_0100 USING answer.
          CASE answer.
            WHEN 'J'.
              ok_code = 'SAVE&EXIT'.
*modify zut_apartment from zut_apartment*
            WHEN 'N'.
              LEAVE PROGRAM.
            WHEN 'A'.
              CLEAR ok_code.
              SET SCREEN 100.
 
          ENDCASE.

Really need your expert advise because i am new in Abap.

Edited by: muzokh on Nov 10, 2011 5:27 AM

surajarafath
Contributor
0 Kudos

you change code as,

......
.....
PERFORM ask_save_0100 USING answer.
          CASE answer.
            WHEN 'J'.
              ok_code = 'EXIT'. "Or LEAVE PROGRAM.
            WHEN 'N'.
              LEAVE PROGRAM.
            WHEN 'A'.
              CLEAR ok_code.
              SET SCREEN 100.
...
....

And perform ask_save_0100 does this subroutine saves the record??

and where you put your code for saving