Module pool program - populating values for columns in Table control

Hi all,
In my module pool program Table control i  am having 10 columns fields.
in one of the column field i have used 'PROCESS ON VALUE-REQUEST'   to get the material no.
in that F4 search help list is having releated information of the material like material group, company code, description etc.
user while searching for material  they will use F4 search help and in that list they will select the material .
From the list I need releated information of the materials like material group, company code, description etc
to be populated in other columns while selecting the material .( User is not ready to enter all the values for the fileds)
I appended the releated values for the material in the Table control Internal table in the Process on value-request  Module.
(after selecting material by the user from F4 search help)
even then I am not getting the data in the screen.
kindly help me how to proceed  to get the data in other columns.
Thanks in advance,
sharma

Hi Himanshu Verma ,
Thanks for fast reply.
but i tried with field names available in F4  Internal table.
even then I am not getting.
T_DYNPFLD_MAPPING-FLDNAME = ' MTART.
APPEND T_DYNPFLD_MAPPING TO ITAB_DYNPFLD_MAPPING.
T_DYNPFLD_MAPPING-FLDNAME = 'MBRSH'.
APPEND T_DYNPFLD_MAPPING TO ITAB_DYNPFLD_MAPPING.
  SELECT
  MATNR
MTART
MBRSH
MATKL
BISMT
MEINS
BSTME
  FROM MARA
  INTO TABLE INT_F4
  up to 5000 rows
  CLEAR INT_F4.
****function module to get pop-up window of f4.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD        = 'MATNR'
      DYNPPROG        = W_PROGNAME
      DYNPNR          = W_SCR_NUM
      DYNPROFIELD     = 'V_TAB-MATNR'
      VALUE_ORG       = 'S'
    TABLES
      VALUE_TAB       = INT_F4
      RETURN_TAB      = RETURN_VALUES
      DYNPFLD_MAPPING = ITAB_DYNPFLD_MAPPING
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.
  IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE .
    V_TAB-matnr = RETURN_VALUES-FIELDVAL.
endif.
I have used the above code.  I am not getting the field values available in ITAB_DYNPFLD_MAPPING.
kindly help me how to get the exact row for the F4 table.
Thanks in advance.
sharma

Similar Messages

  • Not setting selected value in column of table control

    Hi,
    I have MATNR field in table control.
    In PAI code is as follow.
    PROCESS AFTER INPUT.
      MODULE CANCEL AT EXIT-COMMAND.
      MODULE VALIDATE.
      LOOP WITH CONTROL TC_FORMV.
      FIELD /SISLEMCU/CNVADTL-MATNR SELECT *
                          FROM  /SISLEMCU/CNVA01
                          WHERE WERKS = TXT_PLANT
                          AND CHARG =
                          /SISLEMCU/CNVADTL-CHARG.
                         INTO /SISLEMCU/CNVADTL.
      MODULE read_table_control.
      ENDLOOP.
    MODULE USER_COMMAND_0500.
    When i take the help in MATNR column the above query works fine but when i select the entry from help MATNR is not gets set in column in table control.
    Plz help me regarding this.
    Thankx in adv.
    Regards,
    Deepak.

    When you select a value, PBO as well as PAI gets triggered. When PAI gets triggered, your query gets executed which gives sy-subrc <> 0 and due to this it might not filling the data selected..

  • How to write module pool program

    hai,
    what is the module -pool program ?
    what are the procedures to write the module-pool program.
    plz give the simple program for module-pool programs?
    regards
    surender

    Hi
    This component though is not attached to the screen painter, plays important role in transaction. Normally, for reports, on line executable programs are written but for transaction, Module Pool Programs are written. The module pool program contains only modules to handle various events associated with screen and data declaration statements.
    System divides the module pool program into several include program. These are global field, PBO modules, and PAI modules. It is entirely user’s decision whether to use these modules or write directly into main program.
    Creation of Module Pool Program
    You can create module pool program either through
    Object browser
    System automatically creates the module pool program and for these program which are created through object browser, system creates the include modules.
    Or
    ABAP/4 editor
    It is similar to normal program creation. Type of program should be given ‘M’ and is not created by system.
    Communication between Dynpro and Module Program
    For each screen, the system executes the flow logic, which contains corresponding events. The control is passed to Module Pool Program. Module Pool Program handles the code for these events and again passes back control to the flow logic and finally to screen. Unlike on line program, in this case, the control remains with flow logic. The switching of control between flow logic and module pool program and back is common process when user executes transaction.
    Creation of a Complete Transaction
    Steps involved to create a complete transaction
    •     Create module pool program.
    •     From screen painter create screens.
    •     Write flow logic for each screen.
    •     Write code for all the events in module pool program.
    •     Check for any error in screen and flow logic.
    •     Generate each and every component of screen i.e. flow logic and screen.
    •     Single screen can be tested using Screen Painter.
    •     Create transaction code through object browser.
    •     Generate the transaction code.
    •     User can execute the transaction by entering the transaction code in the command field.
    Handling Function Code
    The function code or OKCODE is the last field of Field list. Function code can be handled as follows:
    During the Designing of the screen, a function code is assigned to pushbutton.
    •     In field list, developer needs to specify OKCODE as last field.
    •     In module program it is a global field and can be evaluated in the PAI event.
    •     A function code is treated in the same way, regardless it comes from pushbutton, menu item or any other GUI element.
    When the user clicks on the Display button, you want to display details of sflight, with corresponding carrid and connid (which is entered by the user).
    Module pool program to handle this particular screen is as follows:
    Program YVTEST7.
    TABLES: SFLIGHT.
    DATA: OKCODE (4).
    MODULE INPUT1 INPUT,
    CASE OKCODE.
       WHEN ‘DISP’.
         SELECT * FROM SFLIGHT
                WHERE CARRID =  SFLIGHT – CARRID AND
                               CONNID = SFLIGHT – CONNID.
         ENDSELECT.
         LEAVE TO SCREEN 200.
       WHEN ‘EXIT’.  LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.               “INPUT1 INPUT
    MODULE USER_COMMAND_0200 INPUT.
    CASE OKCODE.
    WHEN ‘BACK’. LEAVE TO SCREEN 100.
    ENDCASE.
    ENDMODULE.                    “USER_COMMAND_0200 INPUT
    When the user clicks on display, control is transferred to screen no. 200 on which you display sflight details & on the same screen, when user clicks on BACK button, he comes back to main screen.
    Flow logic for screen 100 is as follows:
    PROCESS AFTER INPUT.
    MODULE INPUT.
    Flow logic for screen 200
    PROCESS AFTER INPUT.
    USER_COMMAND_0200.
    MODULES: Modules are handled in module pool program.
    You need to write flow logic for screen 200 and design screen 200.
    In case of transaction transfer of data from program to screen is automatic i.e. you need not transfer the data from program to screen explicitly. The fields, which you define in the screen receives the data from program and displays the same.
    The Field Checks
    As already mentioned Transaction is the only method, which SAP recommends to update the database tables. Data entered in the database table should be valid and correct. Data entered is validated at each and every point. ABAP/4 offers various methods to validate data and those are as follows:
    •     Automatic field checks
    •     Checks performed in the flow logic
    •     Checks performed in the ABAP/4 module pool program
    Automatic Field Checks
    These checks are based on the field information stored in the dictionary. These checks are performed by the system automatically when the user enters the data for the screen field. System performs these checks before PAI event is triggered. Types of field checks performed by system are as follows:
    •     Required input
    While designing the screen, for particular screen field if you click the Req. Entry checkbox, the field becomes mandatory. When the transaction is executed if user leaves this particular field blank, the system displays error message. User cannot proceed until the user enters some data.
    •     Proper Data Format
    Each field has its own data format whether it is table field or screen field. Whenever data is entered, system checks for the proper format of the data. For example date. Each user has its own format for date, which is defined in the user master record. If the date defined in the user master record is in the format DD/MM/YYYY, if the user enters the date, say, in YY/DD/MM, the user displays the error message. System also checks for the value of month or days. For example if month entered is greater than twelve then the error message is displayed.
    •     Valid Value for the Field
    In data dictionary two tables are related by Primary key-Foreign key relationship.  Whenever the user enters the data, the system checks for the check table values.   Also in Domain, if you have fixed values, then the system checks for these values.
    Automatic field checks are repeated each time the user enters the data.
    About at Exit – Command
    Automatic field checks can be avoided by AT EXIT-COMMAND, which works exactly the same way as Cancel works on application tools bar. In the R/3 screen, if you want to quit the processing of that particular screen without entering the mandatory fields, user can click the Cancel button. Same functionality can be incorporated in the user-defined transaction by using AT EXIT-COMMAND. This module can be called before the system executes the automatic field checks and it goes without saying that before PAI event. Code for AT EXIT-COMMAND in flow logic and in module pool program can be written as follows:
    In Flow Logic
    Process After Input.
    Module exit AT EXIT-COMMAND.
             In module pool program.
    Module exit.
    Case okcode.
    When ‘Exit’.
    Leave to screen 0.
    To achieve this kind of functionality a pushbutton or menu item should be assigned a function type ‘E’. It tells the system to process this particular module before carrying out any field checks.
    Flow Logic Validations
    Consider the case where you want user to enter only ‘LH’ and ‘SQ’ for sflight-carrid. In this case, you are restricting value of a screen field. This cannot be achieved by automatic field check. Hence there is a need of additional validation. It can be done in flow logic by using following statement:
    Field -
    Values
    Syntax
    PAI.
    Field sflight-carrid values (‘LH’).
    For multiple values
    PAI.
    Field sflight-carrid values (‘LH’ ‘SQ’).
    Field sflight-price values (between 1000 and 2000).
    In this case when the user enters the value, PAI is triggered  and field is checked for  that particular value. If the value entered happens to be wrong, that field is enabled for user to enter. If you have multiple Field statements in your flow logic, it is sequential execution.
    Consider the following case:
    PAI.
    Module  assign.
    Field sflight-carrid values (‘LH’ ‘SQ’).
    In ABAP/4
    Module  assign.
    Data: carrid1 like sflight-carrid.
    Carrid1 = sflight-carrid.
    Endmodule.
    In this case, Sflight-carrid is used in the flow logic before the field statement. The system will give invalid value or some previous value as the field sflight-carrid is used in module before it is checked i.e., field statement is after the module in which sflight-carrid is being used. The field is not available to the system unless it executes the field statement. Field statement transfers the values to the program and is done only once. If you don’t have Field statement in your flow logic, transfer of values takes place in PAI event.
    Consider one more case where you have multiple field statement
    PAI.
    Field Sflight-carrid values (‘LH’).
    Field Sflight-connid values (‘0400’ ‘0500’).
    In this case if the user enters only carrid wrong, then this particular field is enabled and rest of the fields are disabled for user to input. Many times if the user enters wrong value for one field, then you might want to give option to user to enter all the fields, which is not possible by using Field statement only. This functionality can be achieved by CHAIN – ENDCHAIN.
    Syntax
    Chain.
    Field sflight-carrid value (‘LH’).
         Field sflight-connid values (between ‘200’ and ‘500’).
    Endchain.
    Field sflight-price values (‘100’ ‘1000’).
    In this case, if the user enters wrong value only for carrid, both the fields i.e. carrid and connid are enabled as they are grouped together in the Chain statement. The field price will be disabled for input. Usually, logically related fields are grouped together with Chain-Endchain statement.
    Module Pool Program Validations
    Checking fields ABAP/4 program includes
    •     Field statement in flow logic.
    •     Module statement in ABAP/4 module pool Program.
    Syntax
    PAI.
    Field sflight-carrid module <name>.
    This module can be handled in the main program i.e. module pool program.
    In ABAP/4 program
    Module Check.
    Select single * from sflight where carrid = sflight-carrid.
    If sy-subrc ne 0.
         Message e001.
    Endif.
    In this case, field sflight-carrid is checked in the table for its existence.
    Dynamically Calling the Screens
    About Displaying Next Screen
    Transaction is a sequence of screens, which are displayed one after the other. The next screen displayed depends upon the attributes of first screen. In attributes you need to give Next Screen number i.e. if next screen displayed should be 200 screen, then this number should be given in next Screen attributes. These are static attributes of the screen. By default, if nothing is specified in the program, the system branches out to the screen number, which is specified in the attribute screen.
    In this case, if user selects MARA pushbutton, then fields from Mara table are displayed. When the user clicks on the MARD, then the fields from MARD table are displayed. Depending upon users selection, the screen is branched out and this has to be done during runtime. This functionality can be achieved by dynamically calling the screen in module pool program.
    The screen can branch out to new screen depending upon user selection. Following command in module pool program can do this:
    •     SET SCREEM
    •     CALL SCREEN
    •     LEAVE TO SCREEN <NUMBER>
    All these commands override the specifications given in the attributes. This overriding is temporary. The values stored in the attribute are not changed.
    Set Screen
    Syntax
    Set screen <number>.
    In module pool program
    Case okcode.
         When  ‘DISP’.
              Set screen 200.
         When ‘LIST’.
              Set screen 300.
    Endcase.
    In this case, the entire processing of current screen takes place and then the system branches out to next screen. If you want to branch out to the next screen without processing the current screen, LEAVE SCREEN should be used along with the SET SCREEN.
    For Example:
    Case okcode..
         When  ‘DISP’.
              Set screen 200.
              Leave Screen.
         When ‘LIST’.
              Set screen 300.
              Leave Screen.
    Endcase.
    When SET SCREEN is used, control cannot be transferred to the main screen or previous screen, unless you write code for the same.
    Call Screen
    Usually used for pop up screens. Many times, there is a need for user to enter additional information or secondary information on another screen or pop up screen. Once the user enters the data, he should be able to go back to main screen or to the screen where he started. This is not possible by using SET SCREEN. CALL SCREEN achieves this functionality.
    Syntax
    Call Screen 200.
    Will simply call a screen number 200 from a main screen. Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.
    To call screen as pop up screen the syntax is
    Call screen starting at <col.no.> <line no>
                         Ending at <col no> <line no>.
    In this case window will be popped as window and user can close it by using BACK button.
    Leave to screen
    To SET a new screen without processing current screen, you need to use the following two statements together:
    SET SCREEN 200.
    LEAVE SCREEN.
    Or a Single statement
    LEAVE TO SCREEN 200.

  • Simple Module Pool Program

    Hello all,
    can any one give one simple program for                Insert Update Delete
    i have taken 9 fields and in a simple screen.
    and have 3 button. through this i want to Insert Update and Delete Data in customize table.
    Thaks.
    Rajesh.

    * MODULE POOL                                                          *
    PROGRAM  YP_BOOKMASTER_MAINTENANCE  MESSAGE-ID ZZ.
    *                       TABLES                                         *
    TABLES ZBKMA.                                         "book master table
    *                      VARIABLES                                       *
    DATA : V_NUMBER(5) TYPE N,            "variable to store random number
           V_LINE TYPE I,                 "variable to get total no of lines
           V_FLAG LIKE SY-TABIX.          "variable for checking
    *                     INTERNAL TABLE                                   *
    * internal table to store book numbers (i.e random numbers)
    DATA : BEGIN OF IT_RANDOMNUMBERS OCCURS 0,
           BKNUM LIKE ZBKMA-BKNUM,                   "book number
           END OF IT_RANDOMNUMBERS.
    * internal table to store only numeric part of book number
    * eg : if book no is HUM00100 ,this table will only store 00100
    DATA : BEGIN OF IT_NUMBERS OCCURS 0,
           NUMBER(5) TYPE N,                          " a number
           END OF IT_NUMBERS.
    *internal table to store book details
    DATA : BEGIN OF IT_BOOKMASTER OCCURS 0,
           BKNUM LIKE ZBKMA-BKNUM,            "BOOK NUMBER
           BKNAM LIKE ZBKMA-BKNAM,            "BOOK NAME
           AUTHR LIKE ZBKMA-AUTHR,            "AUTHOR
           SRCHT LIKE ZBKMA-SRCHT,            "SEARCH TERM
           PUBSH LIKE ZBKMA-PUBSH,            "PUBLISHER
           YRPUB LIKE ZBKMA-YRPUB,            "YEAR OF PUBLISHING
           VERNO LIKE ZBKMA-VERNO,            "VERSION NUMBER
           DATPR LIKE ZBKMA-DATPR,            "DATE OF PURCHASE
           BKCOD LIKE ZBKMA-BKCOD,            "BOOKCODE
           END OF IT_BOOKMASTER .
    *& Module  STATUS_0090  OUTPUT
    *  PBO OF SCREEN 090(screen contains three buttons ADD , DELETE , MODIFY)
    MODULE STATUS_0090 OUTPUT.
      SET PF-STATUS 'BOOKMASTER_FIRST'.
      SET TITLEBAR 'BOOKMASTER'.
    ENDMODULE.                 " STATUS_0090  OUTPUT
    *&      Module  USER_COMMAND_0090  INPUT
    *      PAI OF SCREEN 90
    MODULE USER_COMMAND_0090 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN '0'.            "go back
        WHEN 'EXIT'.
          LEAVE PROGRAM.                  "exit the program
        WHEN 'CANCEL'.
          leave to screen '0'.             "cancel the screen
        WHEN 'ADD'.
          CLEAR IT_BOOKMASTER.             "clears the contents of the fields.
          CALL SCREEN '0100'.
        WHEN 'DELETE'.
          CLEAR IT_BOOKMASTER.             "clears the contents of the fields.
          CALL SCREEN '0200'.
        WHEN 'MODIFY'.
          CLEAR IT_BOOKMASTER.             "clears the contents of the fields.
          CALL SCREEN '0300'.
      ENDCASE.        "end sy-ucomm
    ENDMODULE.                 " USER_COMMAND_0090  INPUT
    *&      Module  STATUS_0100  OUTPUT
    *       PBO OF 100 ( ADD THE BOOKS )
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'BOOKMASTER'.
      SET TITLEBAR 'UPDATE BOOKMASTER'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *         PAI OF 100 ( ADD THE BOOKS )
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.            "check the screen 100 actions
        WHEN 'BACK'.
          LEAVE TO SCREEN '0'.      "go back
        WHEN 'EXIT'.
          LEAVE PROGRAM.            "exit the program
        WHEN 'CANCEL'.
          LEAVE to screen '0' .      "cancel the screen 100
        WHEN 'ADD'.
    *      add the books to the master records
          PERFORM FORM_ADDBOOK.      " add the
        WHEN 'RESET'.
          CLEAR IT_BOOKMASTER.        "reset the screen
          SET SCREEN '0100'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  FORM_ADDBOOK
    *       ADDING THE BOOKS
    FORM FORM_ADDBOOK .
    *TO ASSIGN BOOK NUMBER
      PERFORM FORM_ASSIGN_BOOKNO.
    * INSERTING THE BOOKS
      ZBKMA-BKNAM = IT_BOOKMASTER-BKNAM.
      ZBKMA-AUTHR = IT_BOOKMASTER-AUTHR.
      ZBKMA-SRCHT = IT_BOOKMASTER-SRCHT.
      ZBKMA-PUBSH = IT_BOOKMASTER-PUBSH.
      ZBKMA-YRPUB = IT_BOOKMASTER-YRPUB.
      ZBKMA-VERNO = IT_BOOKMASTER-VERNO.
      ZBKMA-DATPR = IT_BOOKMASTER-DATPR.
      ZBKMA-BKCOD = IT_BOOKMASTER-BKCOD.
    IF NOT IT_BOOKMASTER-BKNAM IS INITIAL.  "if the book number is not initial
      INSERT ZBKMA.
    ENDIF.   "endif check initial
      IF SY-SUBRC = 0.
        MESSAGE S003(ZCHA) WITH IT_BOOKMASTER-BKNUM.
      ENDIF.    "endif success
    ENDFORM.                    " FORM_ADDBOOK
    *&      Form  FORM_DELETEBOOK
    *       delete books from the master data
    *  -->  p1        text
    *  <--  p2        text
    FORM FORM_DELETEBOOK .
    * check the it is initial
      IF NOT IT_BOOKMASTER-BKNUM IS INITIAL.
    *get the book numbers present already
        SELECT SINGLE BKNUM
               FROM ZBKMA
               INTO ZBKMA-BKNUM
               WHERE BKNUM = IT_BOOKMASTER-BKNUM.
    *check if select is successful
        IF SY-SUBRC = 0.
          DELETE FROM ZBKMA WHERE BKNUM = IT_BOOKMASTER-BKNUM.
          MESSAGE S004(ZCHA) WITH IT_BOOKMASTER-BKNUM.      "if book deleted
        ELSE.
          MESSAGE S005(ZCHA) WITH IT_BOOKMASTER-BKNUM.      "if book not found
        ENDIF.
      ENDIF.
    ENDFORM.                    " FORM_DELETEBOOK
    *&      Form  FORM_MODIFYBOOK
    *       MODIFING THE BOOK
    FORM FORM_MODIFYBOOK.
    *validiate the book number
      SELECT SINGLE BKNUM
                FROM ZBKMA
                INTO ZBKMA-BKNUM
                WHERE BKNUM = IT_BOOKMASTER-BKNUM.
    *check for the success
      IF SY-SUBRC NE 0.
        MESSAGE S005(ZCHA) WITH IT_BOOKMASTER-BKNUM.
      ENDIF.
      ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.
      ZBKMA-BKNAM = IT_BOOKMASTER-BKNAM.
      ZBKMA-AUTHR = IT_BOOKMASTER-AUTHR.
      ZBKMA-SRCHT = IT_BOOKMASTER-SRCHT.
      ZBKMA-PUBSH = IT_BOOKMASTER-PUBSH.
      ZBKMA-YRPUB = IT_BOOKMASTER-YRPUB.
      ZBKMA-VERNO = IT_BOOKMASTER-VERNO.
      ZBKMA-DATPR = IT_BOOKMASTER-DATPR.
      UPDATE ZBKMA.      "update the book master table
      IF SY-SUBRC = 0.
        MESSAGE S006(ZCHA) WITH IT_BOOKMASTER-BKNUM.
      ENDIF.
    ENDFORM.                    " FORM_MODIFYBOOK
    *&      Form  FORM_ASSIGN_BOOKNO
    *       TEXT
    FORM FORM_ASSIGN_BOOKNO .
    *select the books already there from bookmaster
      SELECT BKNUM
             FROM ZBKMA
             INTO TABLE IT_RANDOMNUMBERS
             WHERE BKCOD = IT_BOOKMASTER-BKCOD.
    *if the book is first book i.e. first entry
      IF IT_RANDOMNUMBERS[] IS INITIAL.
        V_NUMBER = 1.                          "start with 1
        CONCATENATE IT_BOOKMASTER-BKCOD  V_NUMBER INTO IT_BOOKMASTER-BKNUM.
        ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.      "assign booknumber
        EXIT.
      ENDIF.        "check for initial
      CLEAR IT_NUMBERS[].        "clear the temporary table
      CLEAR IT_NUMBERS.
    * check for the book numbers if there is no book start from first in other
    * cases look for first gap and assign that number
      LOOP AT IT_RANDOMNUMBERS.
        IT_NUMBERS-NUMBER   = IT_RANDOMNUMBERS-BKNUM+3(5). "get the last 5 digits
                                                            "and store it in it_number
        APPEND IT_NUMBERS.
      ENDLOOP.
      SORT IT_NUMBERS BY NUMBER.          "sort
      DESCRIBE TABLE IT_NUMBERS LINES V_LINE.    "get no. of lines in table
    *check for book number gap
      LOOP AT IT_NUMBERS.
        V_FLAG = SY-TABIX.
    * if the book number is not equal to the index of table i.e. some gap in book number
    * or only one record
        IF IT_NUMBERS-NUMBER NE SY-TABIX OR V_LINE = 1.
           V_NUMBER = SY-TABIX.          "fill the gap
            if v_line = 1.                "if only one record
                  v_number = v_line + 1.   "increment the book number
            endif.          "only one record check
              CONCATENATE IT_BOOKMASTER-BKCOD  V_NUMBER INTO IT_BOOKMASTER-BKNUM.
              ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.      "assign
              EXIT.
       ENDIF.      "check for gap
    *if no gap in book number assign next number
                  IF V_FLAG = V_LINE.
                         V_NUMBER = IT_NUMBERS-NUMBER + 1.
                         CONCATENATE IT_BOOKMASTER-BKCOD  V_NUMBER INTO IT_BOOKMASTER-BKNUM.
                        ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.
                        EXIT.
                  ENDIF.      "book number increment
      ENDLOOP.        "check number gap
    ENDFORM.                    " FORM_ASSIGN_BOOKNO
    *&      Module  STATUS_0200  OUTPUT
    *       PBO OF SCREEN 200 ( DELETE BOOKS)
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'DELETE'.
      SET TITLEBAR 'DELETE'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *       PAI OF SCREEN 200 (DELETE BOOKS)
    MODULE USER_COMMAND_0200 INPUT.
      CASE SY-UCOMM.        "check for screen 200 actions
        WHEN 'BACK'.
          LEAVE TO SCREEN '0'.        "go back
        WHEN 'EXIT'.
          LEAVE PROGRAM.              "leave program
        WHEN 'CANCEL'.
          LEAVE to screen '0'.        "cancel screen
        WHEN 'DELETE'.
    * delete the book from master data
          PERFORM FORM_DELETEBOOK.
        WHEN 'RESET'.                  "reset the screen
          CLEAR IT_BOOKMASTER.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  STATUS_0300  OUTPUT
    *       PBO OF SCREEN 300 ( FOR MODIFYING )
    MODULE STATUS_0300 OUTPUT.
      SET PF-STATUS 'MODIFY'.
      SET TITLEBAR 'MODIFY'.
    ENDMODULE.                 " STATUS_0300  OUTPUT
    *&      Module  USER_COMMAND_0300  INPUT
    *       text
    MODULE USER_COMMAND_0300 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN '0'.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE TO SCREEN '0'.
        WHEN 'MODIFY'.
          PERFORM FORM_MODIFYBOOK.        "update the record
        WHEN 'RESET'.
          CLEAR IT_BOOKMASTER.            "screen reset
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0300  INPUT
    *&      Module  MODULE_CANCEL  INPUT
    *       ACTIONS AT EXIT COMMAND
    MODULE MODULE_CANCEL INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN '0'.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " MODULE_CANCEL  INPUT
    Message was edited by: Chandrasekhar Jagarlamudi

  • Disable columns in table control based on condition

    Hello Gurus,
         I am having a table control in my module pool program.Out of 25 columns , I am having 12 columns on months wise like (jan, feb, march....).Now my concern is based on current month I want to enable the column of month rest all months will be in disable mode.So that the user can enter his/her time of work.Could you please tell me any way.I tired to read tc-cols and stored in col with index but its not working I wrote this code for first month without any condition
    READ TABLE tC-COLS INTO col INDEX 22.
       col-SCREEN-INPUT = 0.
       MODIFY tC-COLS FROM col INDEX 22.
    but its not working.I wrote this code in PBO as well as i tried in PAI as wellstill my columns is in enable mode.Also when user clicks on button then only the table control required fields should start working like months enable/disable process.for eg. I am having 2 button one is Create and other is Search on both these buttons after click the condition for enable/disable months should work.
    Thanks
    Gaurav

    Hi,
    In my scenario, I have used months as radio buttons. A month is selected and "enable" button must be clicked so that only the corresponding column of the month turns into an editable mode.
    I have attached the output.
    The field can be disabled or enabled by using the line type of <table_control_name>-cols.
    It contains the screen elements. For disabling / enabling, use active element in screen.
    This must be written in PBO event of the corresponding screen containing the table control.
    Coding:
    * Type-Pools
    TYPE-POOLS: abap.
    *   Types
    TYPES: BEGIN OF ty_month_emp,
             jan   TYPE char30,
             feb   TYPE char30,
             mar   TYPE char30,
             apr   TYPE char30,
             may   TYPE char30,
             jun   TYPE char30,
             jul   TYPE char30,
             aug   TYPE char30,
             sep   TYPE char30,
             oct   TYPE char30,
             nov   TYPE char30,
             dec   TYPE char30,
             id    TYPE char10,
             name  TYPE char10,
             age   TYPE char10,
            END OF ty_month_emp,
            ty_t_month_emp TYPE STANDARD TABLE OF ty_month_emp.
    *   Data
    DATA: gs_month_emp  TYPE ty_month_emp,
           gt_month_emp  TYPE ty_t_month_emp,
           ok_code       TYPE sy-ucomm,
           r1            TYPE char1 VALUE abap_true,
           r2            TYPE char1,
           r3            TYPE char1,
           r4            TYPE char1,
           r5            TYPE char1,
           r6            TYPE char1,
           r7            TYPE char1,
           r8            TYPE char1,
           r9            TYPE char1,
           r10           TYPE char1,
           r11           TYPE char1,
           r12           TYPE char1.
    *   Table Controls
    CONTROLS: tc TYPE TABLEVIEW USING SCREEN 9000.
    *   Field-Symbols
    FIELD-SYMBOLS: <fs_cols> LIKE LINE OF tc-cols.
    *   Initialization
    INITIALIZATION.
       CALL SCREEN 9000.
    *&      Module  ENABLE_COLUMN  OUTPUT
    *       text
    MODULE enable_column OUTPUT.
       LOOP AT tc-cols ASSIGNING <fs_cols>.
         PERFORM enable_col USING: r1 'GS_MONTH_EMP-JAN' CHANGING <fs_cols>,
                                   r2 'GS_MONTH_EMP-FEB' CHANGING <fs_cols>,
                                   r3 'GS_MONTH_EMP-MAR' CHANGING <fs_cols>,
                                   r4 'GS_MONTH_EMP-APR' CHANGING <fs_cols>,
                                   r5 'GS_MONTH_EMP-MAY' CHANGING <fs_cols>,
                                   r6 'GS_MONTH_EMP-JUN' CHANGING <fs_cols>,
                                   r7 'GS_MONTH_EMP-JUL' CHANGING <fs_cols>,
                                   r8 'GS_MONTH_EMP-AUG' CHANGING <fs_cols>,
                                   r9 'GS_MONTH_EMP-SEP' CHANGING <fs_cols>,
                                  r10 'GS_MONTH_EMP-OCT' CHANGING <fs_cols>,
                                  r11 'GS_MONTH_EMP-NOV' CHANGING <fs_cols>,
                                  r12 'GS_MONTH_EMP-DEC' CHANGING <fs_cols>.
       ENDLOOP.
    *  LOOP AT tc-cols INTO ls_cols.
    *    IF r1 = 'X'.
    *      ls_cols-screen-active = 1.
    *    else.
    *      ls_cols-screen-active = 0.
    *    ENDIF.
    *    modify tc-cols FROM ls_cols INDEX sy-tabix.
    *  ENDLOOP.
    ENDMODULE.                 " ENABLE_COLUMN  OUTPUT
    *&      Form  ENABLE_COL
    *       text
    *      -->P_0170   text
    *      -->P_0171   text
    *      <--P_<FS_COLS>  text
    FORM enable_col  USING    p_radio              TYPE c
                               value(p_screen_name) LIKE screen-name
                      CHANGING pa_cols              LIKE LINE OF tc-cols.
       IF p_radio = abap_true.
         IF pa_cols-screen-name = p_screen_name.
           pa_cols-screen-active = 1.
         ELSE.
           pa_cols-screen-active = 0.
         ENDIF.
       ENDIF.
    ENDFORM.                    " ENABLE_COL
    Thanks & Regards,
    T. Prasanna Kumar

  • Reg : Variant saving for Module Pool Programming

    Hey Friends,
       Plz help me in how to create variant for Module Pool Programming as in normal reports.Thanx in advance.

    Hi,
    You can create variants for Module pool program using the transaction SHD0. You can create Screen variants for your screens using this Tcode.
    Go to SHD0 -> Give the Transaction code(ZTRAN) for which you want to create a variant -> name of some variant (ZVAR) -> create -> takes you to your transaction -> Give the values that you want to be displayed as variants -> Click on Save -> Opens a pop up to confirm the screen entries -> Check the check boxes of those fields that you have entered the data with (the column with check boxes that says W.Content) -> Exit and Save -> Save the variant -> You can see a screen variant created (ZVAR_0100)
    Now Goto -> Create variant transaction -> Give your transaction variant name (ZVAR) -> Select Transaction with variant -> Takes you to SE93 transaction -> Give the transaction variant name  -> save. Run with the created transaction.
    Edited by: Nitwick on Jul 27, 2009 4:49 PM

  • How to validate the field values in module pool program?

    Hi Guys
         I am working with module pool programming.
         Here I want to validate the fields like below.
         with out filling all the fields if I click SAVE option it has to show a message that all fields has to be filled.  This can be done by checking all the fields individually.
         I think it can be done through <b>LOOP AT SCREEN ......ENDLOOP</b>. sequence.
         If it is possible, can anyone help me?

    You need to write the Module in between the CHAIN and ENDCHAIN statment in SE51
    If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:
    CHAIN.
    FIELD: <f1>, <f 2>,...
    MODULE <mod1>.
    FIELD: <g1>, <g 2>,...
    MODULE <mod2>.
    ENDCHAIN.
    all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.
    Look at the DEMO program DEMO_DYNPRO_FIELD_CHAIN.
    ashish

  • Online Background job for Module pool program

    Hi,
        I need to process the dialog program in background. Normally for any executable report programs by default we will have that functionality. But i need the same functionality for my module pool program. User needs 2 execute buttons - one is for direct excute (foreground execute) and the other one is for back ground processing.
       I tried with the 3 function modules job_open, job_submit & job_close. But i am keep on getting some issues and i am not sure how those will work because i wrote all the validations in direct exucte user command, now if user clicks on Background how that logic will be called and how it will be processed.
    Can any one give your valuable suggestions.
    regards
    Jaya

    Hi
    Create a Transaction code for this Program.
    Then implement the BDC Code to Process the SCreens with the Required input Values.
    Schedule this BDC Session in Backgound using RSBDCSUB.
    Reward if usefull

  • How to access screen field value in a module pool programming?

    Hi Experts,
       I have create a module pool program SAPMYDLG. It contains two screens 100 and 200.
       The first screen contains Employee_ID field. This field is not a dictionary field.
       In the second screen 200, I want to access the value of Employee_ID field from first screen.
       For this I created a global variable v_empid in TOP include.
       Then in the PAI of the screen 100 I have assigned the screen field value to global variable.
       v_empid = Employee_ID.
       But this gives an error saying " Field  Employee_ID not defined".
       What am I doing wrong? How can I access the screen field value?
    Thanks
    Gopal

    Hi,
    Employee_ID field also must u define in the top include when u define that 100 screen and 200 screen will access.
    regards,
    muralii

  • F4 help for the screen fields in module pool program

    Hi All,
      I have a requirement that, i want to provide F4 help for the 2 fields in module pool program. the fields are document number and fiscal year from rbkp table.
    i could provide search help for two fields.
    but how to select matching fiscal year for that document number.
    problem: i am getting fiscal year as first four digits of document number.
    please help me to solve this problem.
    Thanks & Regards,
    Namratha.V

    Hi,
       If your requirement is after selecting the document no from f4 help then the corresponding year should be updated in the document year field then use FM --> DYNP_VALUES_UPDATE
    In  this function module pass the screen no program & field for which u want to update value

  • Send me one link for module pool programming !

    Send me the link Where i can get the screen shots step by step to create a simple module pool programming !

    hi,
    pls Go through this link for module pool programming
    http://www.allsaplinks.com/dialog_programming.html
    http://sap.mis.cmich.edu/sap-abap/abap09/
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    http://sap.mis.cmich.edu/abap-00/
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
    http://www.sapgenie.com/links/abap.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://help.sap.com
    http://www.sapgenie.com/abap/example_code.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
    http://www.allsaplinks.com/dialog_programming.html
    http://www.sapbrain.com/TUTORIALS/default.html
    http://www.sappoint.com/abap/spmp.pdf
    http://sappoint.com/abap.html
    http://www.sap-img.com/abap.htm
    http://sap.ittoolbox.com/code/archives.asp?i=10&t=450&a=t
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/abap/
    http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
    http://www.sap-img.com/
    http://www.sappoint.com/faq/faqdiapr.pdf
    http://www.allsaplinks.com/dialog_programming.html
    Reward Points if usefull
    Regards
    Fareedas

  • Reusing Standard Classes for Module pool Programming using Abap Objects

    Hi.,
        I debugged the ME21n transaction and found a number of classes such as
             CL_BASIC_MODEL_VIEW_MM
             CL_GENERIC_MODEL_VIEW_MM
             CL_GENERIC_VALUE_MODEL_MM
             CL_MODEL_CONTAINER_MM
             CL_MODEL_CONTROL_VIEW_MM
             CL_MODEL_VIEW_MM
             CL_TABLE_MODEL_MM
             CL_TABLE_MODEL_TREE_VIEW_MM
             CL_VALUE_MODEL_MM
             CL_VALUE_MODEL_VIEW_MM
             CL_BASIC_MODEL_VIEW_MM
            CL_COMPOSITE_SCREEN_VIEW_M
            CL_CUSTOM_CONTROL_VIEW_MM
            CL_EXPAND_BUTTON_VIEW_MM
            CL_EXPAND_VIEW_MM
            CL_FOREIGN_APPLICATION_VIE
            CL_GENERIC_MODEL_VIEW_MM
            CL_GRID_VIEW_MM
            CL_MODEL_CONTROL_VIEW_MM
           CL_MODEL_VIEW_MM
           CL_SCREEN_VIEW_MM
          CL_SETUPVIEW_BUILDER_MM
            CL_SIMPLE_TREE_VIEW_MM
             CL_TABLE_MODEL_TREE_VIEW_M
             CL_TABLE_VIEW_CONTAINER_MM
             CL_TABLE_VIEW_MM
             CL_TABSTRIP_VIEW_MM
             CL_TC_BUTTON_VIEW_MM
             CL_TC_ITEM_VIEW_MM
             CL_TOGGLE_VIEW_MM
             CL_VALUE_MODEL_VIEW_MM
             CL_DEFAULT_CONTROLLER_MM
             CL_CONTROLLER_MM
             CL_ATP_CONTROLLER_MM
             CL_DRAG_DROP_CONTROLLER_MM  ..
                   How we can reuse these classes to build a custom module pool program which supports MVC architecture as used in enjoy SAP transactions .I am very much confused from where to start .
    Guide me on this.I want to create a simple module pool program with Subscreens, Table Controls and Tabstrips ..
    Regards.,
    S.Sivakumar

    Have you got any solution on this.
    because i want to use CL_GRID_VIEW_MM->handle_on_data_changed for one of my development related to ME51N.

  • Tutorial for Screen programming & Module-Pool programming

    Hi Experts,
    I have no previous knowledge of Screen programming & Module-pool programming.
    Please provide me good tutorials on those so that I can master those in a couple of days as I need to use those in my current assignment.
    I require those badly.
    Rewards assured.
    Thanks.
    Anirban.
    Moderator message: please do not ask for documents or tutorials, search for available information, do not use terms that assign a higher priority to your issue compared to all others, do not promise rewards.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    Edited by: Thomas Zloch on Nov 15, 2010 2:14 PM

    hai guru,
    use abapdocu----- tcode give ur keyword and search it.
    or
    sap technical .
    search in sap sdn ok.
    thanks.
    anji

  • Entering values in MARA table using module pool programming

    Hi All,
    I need a help from you all. I want to enter the values in the MARA table using module pool programming.
    Can you please give me the detailed approach and if possible then code also as i am new to ABAP.
    Thanks in Advance

    Create the screen fields with ref to field in MARA table, once data is entered on screen by user then fill appropriate structure of FM BAPI_MATERIAL_SAVEDATA. If call to Fm BAPI_MATERIAL_SAVEDATA is successful then call FM BAPI_TRANSACTION_COMMIT to make changes permanent in database .

  • BADI's being used in MP000100 (module pool program for Infotype 1)

    Hi,
    In module pool program MP000100( for Infotype 1 i.e. HR related), what are the BADI's being used in PBO module of screen no- 2000 ?
    I need to add some codes, if there is no BADI then where i can add codes as i need to default organizational field according to position ID field ?
    Thanking you in anticipation.

    >
    Vaibhav Kumar wrote:
    > I need to add some codes, if there is no BADI then where i can add codes as i need to default organizational field according to position ID field ?
    > Thanking you in anticipation.
    Why do you need a BAdI for that? Your Business/Functional Analyst should be able to handle it using a feature via the Tcode PE03.
    BTW, HRPAD00INFTY is one that can be useful.
    ~Suresh

Maybe you are looking for

  • Explode LUMF material in scheduling agreement

    Hi SAP experts, In short: Is it possible to have LUMF materials explode in a scheduling agreement? At our company we have a lot of projects. We are in the process of selecting an appropriate way to handle these in SAP. We came to the conclusion that

  • Problem with retrieving data from Oracle 10g / PHP4.3 / Apache 1.3.27

    Hi, I re-open a new thread following the opened post 'Getting RPMs for php-oracle for PHP4.3 on RHEL 4.0 and issue with OCI8 ' I could re-installed PHP4.3 and apache 1.3.27 from the normal tar package (./configure then make) - I had some issues with

  • Cannot view a requisition order from the Requisition summary window.

    When i query a requsition order from the requsition summary window without entering the operating unit but just the requisition order no, it shows the following error: APP-FND-01016: Routine FDFRKS: Unknown structure ID 0 for flexfield code GL# with

  • PR Release Strategies and Authorisations

    Hi Guru's My client is trying to set up their item-level Purchase Requisition Release Strategy to include Cost Centre (of which there are about 800), but they would also like to minimise the number of release strategies to cut down on maintenance of

  • Instance Status Yellow on SAP MMC Console

    Dear Experts, We are installing NW 7.0 dialog instance on Windowsx64 bit platform, Central instance is running on Aix64 bit, NW 7.0 Java add-in has installed on Central instance, I want to start only abap instance on new windows application server, i