Module pool in table control

Hi
I have created table control.in that editable row can add the new value also created.after adding new value
in will auto incremented based on sales numer in heighest number + 1 like that u can add.
after increment update the table in data base.
can u tell me the after enter the data in table control tall me the 'save' button functionality and it will auto incremented
based on one field
for example sales order number.
great for me
please tell me

Hi Venkat,
I think you have already posted this query with the subject line "Table control" with the thread below today.
table control
Try with the online link we have provided you will learn that way on your own.
Nobody here will write the whole logic for you.
Try to put in your efforts.
Regards
Abhii
Edited by: Abhii on Sep 8, 2010 3:13 PM

Similar Messages

  • Module pool Program table control

    Hi,
        In Module pool programming, table control i have 10 items out of which in the same colum i want to put them in edit mode and certain in disply mode.
    Regards

    Hi,
    You can use loop at screen,
    MODULE passdata OUTPUT.
      READ TABLE it_revision INTO wa_rev INDEX tab_clc-current_line.
      IF sy-subrc = 0.
        LOOP AT SCREEN.
          IF screen-group1 = '111'.      " 111 IS THE GROUP NAME
            screen-input = 1.          " input mode
            screen-active = 1.         " input mode.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-group1 = '111'.       "GROUP NAME
            screen-input = 0.           " display mode
            screen-active = 1.          " DISPLAY MODE.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDMODULE.                 " PASSDATA  OUTPUT
    Make the group of those field ,that you want in input mode
    Hope it will Solve your problem
    Thanks
    Arun kayal.

  • Sort up and sort Down push buttons in module pool with table control wizard

    hi,
    i have created 2 buttons for Sort up and sort Down push buttons in module pool with table control wizard
    please any one can help me.
    regards

    Hi
    Following code is to enable and disable the tbl control using two buttons. Just alter the code and for each button write the sort code.
    REPORT  YJAN27_SCREEN                                               .
    TABLES: SFLIGHT, YFLIGHT_28.
    TYPES: BEGIN OF struct1,
          carrid like sflight-carrid,
          connid like sflight-connid,
          fldate like sflight-fldate,
           END OF struct1.
    CONTROLS TBL1 TYPE TABLEVIEW USING SCREEN 2700.
    DATA: OK_CODE LIKE SY-UCOMM,
          CARRID LIKE SFLIGHT-CARRID,                                    "cols in tbl ctrl
          CONNID LIKE SFLIGHT-CONNID,
          FLDATE LIKE SFLIGHT-FLDATE,
          itab TYPE TABLE OF STRUCT1 WITH HEADER LINE,
          cols like line of TBL1-COLS,
          FLAG TYPE I.
    FLAG = 1.
    CALL SCREEN 2700.
    *&      Module  STATUS_2700  OUTPUT
    *       text
    MODULE STATUS_2700 OUTPUT.
      SET PF-STATUS 'BACK'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_2700  OUTPUT
    *&      Module  USER_COMMAND_2700  INPUT
    *       text
    MODULE USER_COMMAND_2700 INPUT.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
      WHEN 'BACK'.
        LEAVE PROGRAM.
      WHEN 'DIS'.                                                         "write code for sort up
        loop AT TBL1-COLS INTO COLS.
           COLS-SCREEN-INPUT = 0.
            MODIFY TBL1-COLS FROM COLS.
        ENDLOOP.
        FLAG = 2.
      WHEN 'ENA'.                                                       "write code for sort down
        loop AT TBL1-COLS INTO COLS.
            COLS-SCREEN-INPUT = 1.
            MODIFY TBL1-COLS FROM COLS.
        ENDLOOP.
        FLAG = 1.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_2700  INPUT
    *&      Module  GET_DATA  OUTPUT
    *       text
    MODULE GET_DATA OUTPUT.
      select carrid connid fldate from SFLIGHT into table itab.
    ENDMODULE.                 " GET_DATA  OUTPUT
    *&      Module  POPULATE_TBL  OUTPUT
    *       text
    MODULE POPULATE_TBL OUTPUT.
        MOVE-CORRESPONDING ITAB TO SFLIGHT.
    ENDMODULE.                 " POPULATE_TBL  OUTPUT
    *&      Module  CHANGE_SCREEN  OUTPUT
    *       text
    MODULE CHANGE_SCREEN OUTPUT.    " use this module if you want to hide the other button
    CASE FLAG.
      WHEN 1.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_ENA'.
            SCREEN-INVISIBLE = 1.
             MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_DIS'.
            SCREEN-INVISIBLE = 0.
             MODIFY SCREEN.
          ENDIF.
       ENDLOOP.
      WHEN 2.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_DIS'.
            SCREEN-INVISIBLE = 1.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_ENA'.
            SCREEN-INVISIBLE = 0.
             MODIFY SCREEN.
          ENDIF.
       ENDLOOP.
    ENDCASE.
    ENDMODULE.                 " CHANGE_SCREEN  OUTPUT
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_2700.
    MODULE CHANGE_SCREEN.     " use this if you want to display one button at a time
    MODULE GET_DATA.
    loop at itab WITH control TBL1.
        MODULE POPULATE_TBL.       " populate tbl ctrl
    endloop.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_2700.    " do the sort operations
    loop at itab.
      endloop.
    Hope this helps
    Regards,
    Jayanthi.K

  • Select-option in module pool  with table Control

    HI,
    How to use the select-option in Module Pool and how Can i use the Table control in it.
    Can any body give me some Clues.
    with rgds
    Ranjith

    Hi ..
    PBO.
    LOOP at <table contriol>
    module --- Inside the module
    DATA: g_uti TYPE REF TO cl_fobu_input_util.
      if rollname <> space.
         CREATE OBJECT g_uti
           EXPORTING typename =rollname.
    *....convert to external pattern
         CALL METHOD g_util->output_convert
           EXPORTING
             field_value_int = p_value                 " This is Tablecontrol-low
           IMPORTING
             field_value_ext = p_value.              " Retrun value for Low
    ENDLOOP.
    lly you have code in PAI
    DATA: g_util_1 TYPE REF TO cl_fobu_input_util.
      if rollname <> space.
         CREATE OBJECT g_util_1
           EXPORTING typename = rollname.
    *....convert to internal pattern
         CALL METHOD g_util_1->input_convert
           EXPORTING
             field_value_ext   = p_value
           IMPORTING
             field_value_int_c = p_value.
    The above code should be written for tablecontrol-high aswell..
    you can also refer: Inlcude LSE16NF10 line no 341 & 434 (SE16n)
    Nag

  • Module pool program, table control edit

    Hi,
    I am doing module pool programming with table control.  I have a table control on my screen which is assigned to scarr table with ‘New’, ‘Modify’, ‘Save’, and ‘Delete’ buttons.  When I click on ‘New’ and ‘Save’, the new record is adding to the table where as for ‘Modify’, I selected a row, edited, and clicked on save.  Only the internal table is getting modified at the time but not the original table.  How to update the table in database? Delete is also not working.  Please give some idea on this or links related to table control with sample code.
    Thanks in advance.

    Hi,
    modify <table name>.
    it will do it
    Regards

  • Problem in module pool with table control scrolling

    hi,
    i am using the table control in module pool,in the table control i have radion button for all the rows.
    After i got the data into the table control ,if i select radio button and if i press vertical scroll bar button, that radio button is deselecting,how to solve this issue.
    Please help me.

    Hi
    Generally we don't keep radiobuttons in table control for selecting the records
    We keep check boxes for selecting the records
    Radio button is used to select a single from a group of records and at a time only one is selected, where as checkboxes at a time you can select a single or multiple.
    So use checkboxes and code correctly see the doc for Table control
    syntax:
    CONTROLS .
    if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.
    u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.
    Go through this urls.
    www.****************
    www.sap-img.com
    Check the below links.
    http://www.planetsap.com/howdo_a.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm
    http://sap.niraj.tripod.com/id25.html
    Reward points if useful
    Regards
    Anji

  • Module Pool Progrmaing Table Control

    Hi Experts,
    I Have Created a Module pool Program, In that I have add a table Control.
    i have write all logic and i have to update to the database also. Now my Requirement is when i am enter the data in the table control in first field after that i press enter it will go to the next field this is my requirement..
    example : in my table control i have 3 fields
    matnr maktx meins
    i have enter the  value of matnr after i press tab button  it will go to the next field like that i need in replacing of tab button i press enter it will go  to the next field.
    Thanks
    Sankar

    Hi ,
    Initialy  you have to set the cursor inside the table control required filed using SET cursor statement inside the PBO , each user interaction in PAI you have to capture the line of table control where cursor is currently set using GET CURSOR and again in PBO SET the cursor for your required filed .
    Regards,
    Ratheesh BS

  • Module pool in table control wizared

    Hi
    I have created in module pool table control wizared created insert and delete rows in output.
    insert the data in table control the colume is not save.
    can u tell me the save the data in table control.
    pls tell me the flow of save button.
    after insert the record how to save the data in table control wizard in module pool.
    can u tell me the save button functionality.
    after save data will add in table.

    Hi Venkat,
    I think you have already posted this query with the subject line "Table control" with the thread below today.
    table control
    Try with the online link we have provided you will learn that way on your own.
    Nobody here will write the whole logic for you.
    Try to put in your efforts.
    Regards
    Abhii
    Edited by: Abhii on Sep 8, 2010 3:13 PM

  • Module pool question -table control related

    Hi All,
    I have table control with field mark some input enabled fields in it Now the problem is  when i change the content of one row and select that row then control goes to modue in PAI which is called on ON REQUEST but the changed vaule is not capturing in it only slected row with previous content come in that module . Can u suggest some solution or neccessary setting to be done in attribute of tabe control?
    If possible provide code for it
    Thanks
    Parag

    Hi,
       Please go through the following code below to solve your issue.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA: cols LIKE LINE OF flights-cols,
          lines TYPE i.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    *SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.*
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      DESCRIBE TABLE itab LINES lines.
      flights-lines = lines.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
      ENDCASE.
    ENDMODULE.

  • Module Pool with Table Control.

    Hi,
    I have developed two screens .
    in the first screen the user enters the data and press the Next Push button then
    in the second screen it should display data in the table control.
    For that purpose I have written code.
    when the user press Next Button then I wrote like this.
    case ok_code.
       when 'NEXT'.
            CALL SCREEN '9001'.
    ENDCASE.
    AND In the PBO Event of the Screen 9001 I have written a Function Module to Popup the data
    in the table control.
    But the problem is when the user press the Next Button it is displaying table control without
    data. But when the press the Back button and again he press the Next Button then it is displaying.
    So, Where is the Problem ?
    How can I correct it ?
    Bye,
    Satya.

    Hi
    IN PAI
    case ok_code.
    when 'NEXT'.
    select the data into an internal table using the entered fields in the first screen.
    so data is there in ITAB.
    CALL SCREEN '9001'.
    ENDCASE.
    in PBO.
    between loop..
    MOVE the internal table data to the table control fields
    endloop.
    see the help for TC
    syntax:
    CONTROLS .
    if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.
    u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.
    Go through this urls.
    www.****************
    www.sap-img.com
    Check the below links.
    http://www.planetsap.com/howdo_a.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm
    http://sap.niraj.tripod.com/id25.html
    Reward points for useful Answers
    Regards
    Anji

  • Comparing screen input in program in module pool programming(table control)

    Experts,
    I am a newbie in ABAP. I am working dialog programming where I am replicating PR creation. I am asking user to enter item number, material number and plant. I am validating material number and plant using chain and endchain. This validation is working fine and it throws error message if user enters invalid input. I am able to see corresponding details (corresponding details like unit of measure, delivery date and short text etc. if values entered are correct.) when user clicks on ADD button. Now I have one problem. If user enters same item number twice it should throw error message. I am not able to figure out how it should be done. I thought to set flag = 'X' after user enters item number.
    I am using table control. The validation part for material number(matnr) and plant (werks) work fine. I am getting problem while checking entered item number to check duplication.
    User should not enter the same item number again.
    In my structure i have defined a variable called checkflag(1) type c. and i am doing it now following way. Right now my checkflag code is commented.
    Following is my snippet for the same.
    Please let me know your ideas/suggestions and advices.
    DATA : counter TYPE i,
             itmno1 TYPE i.
      SELECT SINGLE matnr
           FROM mara INTO matno WHERE matnr = it_pr-matnr.
      SELECT SINGLE werks
             FROM t001w INTO plant WHERE werks = it_pr-werks.
      SELECT SINGLE matnr werks
             FROM marc INTO (matno,plant)
        WHERE matnr = it_pr-matnr AND werks = it_pr-werks.
      itmno1 = it_pr-bnfpo.
      IF ok_code = 'ADD'.
        IF it_pr-matnr <> matno OR it_pr-werks <> plant AND it_pr-bnfpo = ''.
          MESSAGE 'Not a Valid material number or plant. Please enter valid values.' TYPE 'E'.
        ELSEIF it_pr-matnr = matno AND it_pr-werks = plant AND it_pr-bnfpo <> ''.
          SELECT SINGLE maktx FROM makt INTO stext WHERE matnr = it_pr-matnr.
          SELECT SINGLE meins FROM mara INTO tmeins WHERE matnr = it_pr-matnr.
          SELECT SINGLE lpein FROM eban INTO tlpein WHERE matnr = it_pr-matnr.
    *      if it_pr-bnfpo = itmno1.
    *        it_pr-checkflag = 'X'.
    *      endif.
          READ TABLE it_pr WITH TABLE KEY
          checkflag = it_pr-checkflag
          bnfpo = it_pr-bnfpo
          maktx = it_pr-maktx
          matnr = it_pr-matnr
          eindt = it_pr-eindt
          meins = it_pr-meins
          werks = it_pr-werks
          lpein = it_pr-lpein.
    *      if it_pr-checkflag = 'X'.
    *          message 'Please enter another item number.' TYPE 'E'.
    *          endif.
          IF sy-subrc <> 0.
            it_pr-bnfpo = itmno1.
            it_pr-maktx = stext.
            it_pr-lpein = tlpein.
            it_pr-meins = tmeins.
            APPEND it_pr.
          ENDIF.
          IF sy-subrc = 0.
            MESSAGE 'Please enter another item number.' TYPE 'E'.
          ENDIF.
        ENDIF.
      ENDIF.

    Indeed thank you very much @medha24 and @gargi sarkar.
    If I use current-line, I will have to skip first entry as first entry should be appended. Then only I would be able to compare it with newly entered value. I will have to use loop end loop within the PAI. I have already written this code in the validation PAI  itself.
    I am not getting how I should use loop endloop effectively so that control will go to the next iteration effectively. Right now with this code, I am getting partial success if I enter item number in bulk (more than one item number as input at same time). later, even though I enter correct values I get error message as it doesn't find next entry in the table. It only appends first records only. Therefore, I am looking to enter first entry without any check and later entries should be compared and appended. I would appreciate your ideas/suggestions.
    Thank you.
    Best reagrds.

  • Module pool in table control how to add the data

    Hi
    I have created the table contrl.
    In table control editable rows, when ever i have enter the data than save it will update the data in data base.
    in table control 4 fields like
    sales number,sales director,sales manager,sales hirarchy.
    in three fields or editable
    first field or non editable only for numaric values disply.
    that way i have entered three fields.
    first field automatically reganarate heighest value +1.
    like that automatically reganarate.
    whn ever enter the new vaule
    first field autogenarate remaining i will enter the data.after save it will update the data in database.
    can u tell me logic for this.

    Hi Venkat,
    I think you have already posted this query with the subject line "Table control" with the thread below today.
    table control
    Try with the online link we have provided you will learn that way on your own.
    Nobody here will write the whole logic for you.
    Try to put in your efforts.
    Regards
    Abhii
    Edited by: Abhii on Sep 8, 2010 3:13 PM

  • Module pool with table controlls

    Hi all.
    I have an  Issue in module pool program.
    I am developing it to update a d/b table.in that I have
    a total of 40 fields are there.in those 10 are to be entered and save.
    I am using table controlls.Can any body help me to solve
    1.the manual entry fields are date fields.I am getting those from my internal table.I want f4 help for those date filds.it is not comming here.
    but in the d/b table fot that corresponding field it is comming.
    2.in the attributes of the table controll ,it is giving the option to freeze the number of columns.but this numbering is from left to right.
    but I want to freeze coloumns in between.
    is it possible.
    3.can any body tell me the logic for table controll to update the d/b table.Because there is no row selection(left side pushbuttons to the table controll).
    how to capture the data what I entered in the rows.
    Thanks in advance,
    Regards,
    Eswar

    venkat,
    We cannot freeze the columns in the middle.
    Check for F4 what attribute is set for the field in screen layout. ( field attributes programs tab->Poss. entries)
    Refer this example for tablecontrol
    http://www.sappoint.com/abap/dptc1.pdf
    Regds
    Man

  • Module Pool: Internal Table

    HI Experts,
    I am having an issue regarding the table control's internal table.
    I have a table control in which I am getting data from PBO. But when I press enter and see the data in the internal table the internal table is filled with total lines of the tabcontrol. I mean if there are 155 lines in the tabcontrol all the lines get appended. But I cant see this in the TabControl in the screen.
    When I press enter the first lines disappears and in the back end as I said all the lines get appended.
    Any solution?

    Sir,
    Can you post the coding Regarding  PAI .
    Regards,
    Venkat

  • Table Control in Module Pool Programming

    In my Module Pool program I have created a Table Control on my screen. In my Table one column is the Checkbox. When I make changes in any of the Checkbox and scroll the Table or scroll with mouse,the data is lost.I am updating the database table and for that I have created a 'SAVE' button.But to make the changes I have to Scroll the Table on the screen and the changed data is lost.
    Please guide me or if possible then tell me the Flow Logic of Module Pool with Table Control??
    Thanks for the Help....

    PROCESS BEFORE OUTPUT.
    MODULE INITIALIZE.
    *&spwizard: pbo flow logic for tablecontrol 'TBLALLOC_CYC'
      module TBLALLOC_CYC_change_tc_attr.
    *&spwizard: module TBLALLOC_CYC_change_col_attr.
      loop at   GT_NEW_ALLOC
           into GT_NEW_ALLOC_WA
           with control TBLALLOC_CYC
           cursor TBLALLOC_CYC-current_line.
        module TBLALLOC_CYC_get_lines.
    *&spwizard:   module TBLALLOC_CYC_change_field_attr
      endloop.
    MODULE STATUS_9003.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_9003.
    *MODULE USER_COMMAND_9003.
    *&spwizard: pai flow logic for tablecontrol 'TBLALLOC_CYC'
      loop at GT_NEW_ALLOC.
        chain.
          field GT_NEW_ALLOC_WA-/BIC/ZALLOCCYC.
          field GT_NEW_ALLOC_WA-/BIC/UFACT_FLG.
          field GT_NEW_ALLOC_WA-CHANGEDBY.
          field GT_NEW_ALLOC_WA-CH_ON.
          field GT_NEW_ALLOC_WA-/BIC/ECHAT.
          module TBLALLOC_CYC_modify on chain-request.
        endchain.
      endloop.
    module TBLALLOC_CYC_user_command.
    *&spwizard: module TBLALLOC_CYC_change_tc_attr.
    *&spwizard: module TBLALLOC_CYC_change_col_attr.
    module TBLALLOC_CYC_user_command.
    MODULE USER_COMMAND_9003.
    MODULE INITIALIZE OUTPUT.
    At the time of initialization of the screen data is to be displayed
    by calling Function Module ZUFACTS_FETCH_ALLOC_CYC.
    CALL FUNCTION 'ZUFACTS_FETCH_ALLOC_CYC'
      TABLES
        T_ALLOC       = GT_NEW_ALLOC
    Pass the value displayed in Internal Table GT_OLD_ALLOC.
    GT_OLD_ALLOC[] = GT_NEW_ALLOC[].
    MOVE GT_OLD_ALLOC TO GT_OLD_ALLOC.
    *****Initialize the ok_code.
    CLEAR OK_CODE .
    ENDMODULE.                 " INITIALIZE  OUTPUT
    MODULE USER_COMMAND_9003 INPUT.
    CASE : OK_CODE.
      WHEN 'SAVE'.
        CALL FUNCTION 'ZUFACTS_UPDATE_ALLOC_CYC'
          TABLES
            T_OLD_ALLOC                 = GT_OLD_ALLOC
            T_NEW_ALLOC                 = GT_NEW_ALLOC
          EXCEPTIONS
            NO_FIELD_UPDATED            = 1
            UNSUCCESSFUL_UPDATION       = 2
            OTHERS                      = 3
        IF SY-SUBRC = 1.
          MESSAGE I005 .
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        IF SY-SUBRC = 2.
          MESSAGE E006.
        ENDIF.
      WHEN 'CANCEL' OR 'BACK' OR '%EX' OR 'RW'.
        LEAVE TO SCREEN 0.
      ENDCASE.
      CLEAR OK_CODE.
    ENDMODULE.                 " USER_COMMAND_9003  INPUT

Maybe you are looking for