Doubt in Radiobutton handling in Module-pool

Hi Experts,
I have requirement in where in a module pool screen I am creating two Radio-buttons say R1 and R2 under one group.
When I do this the first radio button R1 is by default gettimg checked. What is that I need to do for making secand radiobutton R2 by default getting cheked.....?
Kindly help me out in this aspect.
Regards,
Rama Murthy.P

Hi,
You can try out the following.
In you ABAP code declare a Global Data Element of the same type as the Screen Element. Then create a Module in the PBO of the calling screen. There you write the following statement.
<data element2> = 'X'.
Then after the execution of the PBO the ABAP and screen elements will automatically gets transfered. This will mark the second radio button as checked.
Let me know if require any more details.
Thanks,
Samantak.
Rewards points for useful answers.

Similar Messages

  • Doubt in Radiobutton handling in Module-pool program

    Hi Experts,
    I have requirement in where in a module pool screen I am creating two Radio-buttons say R1 and R2 under one group.
    When I do this the first radio button R1 is by default gettimg checked. What is that I need to do for making secand radiobutton R2 by default getting cheked.....?
    Please note that it is in Module-pool not a Report.
    Kindly help me out in this aspect.
    Regards,
    Rama Murthy.P

    Hi,
    You can set check/uncheck value of radio buttons in PBO.
    But that check box button should be declared in main program(se38) also.
    for e.g
    data: R1 type c,
            R2 type c.
    declare above in your main program.
    now go to se51. In layout go to Dictionary/Program fields or press F6.
    Now click on Get from program button and drag R1,R2 to your layout.
    Now right click on it and under convert option you will get radio button.
    In main program under PBO make that radio button check.
    Loop at screen.
    if screen-name = 'R2'.
        R2 = 'X'.
    endloop.
    Modify Screen.
    Regards,
    SUDHIR MANJAREKAR

  • Error handling in module pool program

    hi,
    in module pool program after enabling a field if the user enters an invalid value iam giving a error message.
    message 'something' type 's' display like 'E'.
    then again it should go to the previous screen where the user enters the value for that enabled filed.
    can u guys share some ideas.

    Hi ,
    if it is a ascreen field use the below syntax
    Field <fieldname> module <module_validate>.
    in the module validate write the validation and throw error message ,the screen will be in error position
    if the field is in Table control
    Loop at <table control>.
       chain.
          field <fieldnamemodule <module_validate>.
                                                    "in the module validate write the validation and throw error message ,the screen will be in error position
      endchain.
    Endloop.
    Prabhudas

  • UP AND DOWN ARROW KEY HANDLING IN MODULE POOL PROGRAM

    HI GURUS,
    I HAVE A STRANGE REQUIREMENT ....I AM DISPLAYING  TWO TABLE CONTROLS IN A SCREEN
    WHERE IN THE 1ST TABLE CONTROL IS DISPLAYING ALL THE SALES ORDER NO'S  WHEN ENTER KEY IS PRESSED.
    THE SECOND TABLE IS DISPLAYING THE ITEMS FOR THE SELECTED SALES ORDER...
    THIS IS HAPPENING WHEN I DOUBLE CLICK THE SALES ORDER NO IN THE FIRST TABLE CONTROL..
    NOW THE CLIENT SAYS HE WILL NOT DOUBLE CLICK IT...HE SAYS THAT THE ITEM DISPLAY IN THE SECOND TABLE SHOULD BE DONE WHEN HE USES THE ARROW KEYS..

    Yes!
    Create a class like this:
    CLASS lcl_click_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
                       IMPORTING e_row_id e_column_id.
    ENDCLASS.             
    Write the implementation for this class which meets your needs.
    Declare it:
    DATA: obj_click_handler TYPE REF TO lcl_click_handler.
    Create and use it:
    CREATE OBJECT obj_click_handler.
    SET HANDLER obj_click_handler->handle_hotspot_click  FOR your_obj_grid.
    Regards
    Jordi

  • Exception error handling in module pool program

    Hi all,
    I have developed a screen in which I am calculating one of field value using two fields from same table.following is sample code.
    zfi_proposal-zpro_value =  zfi_proposal-zinv_rate  *  zfi_proposal-zno_of_shares.
    here, field zinv_rate has domain type quan length 10 and decimal places = 4, and field zno_of_shares has domain type numc length 4. while zpro_value has domain type quan length 10 and decimal places = 4.
    If zinv_rate > six digit value and zno_of_shares = two digit number system is giving conversion error.
    can anyone provide solution to rectify this error.Thanks in advance.
    Regards,
    Harshada

    You can catch the exception cx_sy_arithmetic_overflow
    Please refer example coding
    PARAMETERS: pa_rate TYPE p DECIMALS 4,
                pa_shar TYPE n LENGTH 4,
                pa_pro  TYPE p DECIMALS 4.
    AT SELECTION-SCREEN ON pa_rate.
      TRY .
          pa_pro = pa_rate * pa_shar.
        CATCH cx_sy_arithmetic_overflow.
          MESSAGE 'Sorry the rate is too high, please correct the entry' TYPE 'E'.
      ENDTRY.
    AT SELECTION-SCREEN ON pa_shar.
      TRY .
          pa_pro = pa_rate * pa_shar.
        CATCH cx_sy_arithmetic_overflow.
          MESSAGE 'Sorry the no_shares is too high, please correct the entry' TYPE 'E'.
      ENDTRY.
    Regards
    Marcin

  • 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.

  • Module pool Program Doubt

    Hi Xperts,
    I am Working an object on module pool.I have a small doubt regarding that.
    tables:lfa1.
    data:begin of itab occurs 0,
    lifnr like lfa1-lifnr,
    land1 like lfa1-land1,
    name1 like lfa1-name1,
    end of itab.
    case sy-ucomm.
    when 'disp'.
    select lifnr land1 name1 from lfa1 into itab where lifnr = lfa1-lifnr.
    append itab.
    endselect.
    when 'exit'.
    leave program.
    endcase.
    Here comes the doubt.Why do we use the statement underneath and why is this always under PBO.As lfa1 is an SAP standard table how can we move anything into that.
    Move-corresponding itab to lfa1.
    Query#2: Suppose a Z table was used.We pulled the fields onto the layout.For only retrieving of database values, do i need to declare an internal table like the way i defined here.
    Thanks in advance.Hope i get my queries resolved.
    --Ranjith.T.

    Hi,
    The declaration "tables:lfa1" means you are declaring a work area of type lfa1. Anything you change in this workarea does not change the filed in the actual database table.
    PBO means Process before output. It contains declarations and some initializations.
    Yes you need an internal table and use that internal table to populate your values.
    Regards,
    Subramanian

  • Module Pool Error handling

    Hi friends,
    This issue regarding Module Pool Error Handling
    How to handle the multiple error on the same screen ,
    For example in the below code you could see "Carrid is Invalid"  when carrid is entred wrongly
    "in the same way i also need " Connid is invalid" When the customer entres the wrong Connid
    *Select single * from sflight into e_sflight*
    where carrid = e_sflight-carrid AND
    connid = e_sflight-connid AND
    fldate = e_sflight-fldate.
    IF NOT sy-subrc IS INITIAL.
    MESSAGE ID 'ZADT' TYPE 'E'
    NUMBER '002' WITH 'Carrid is invalid'.
    Kindly let me know your feedback\
    Thank you
    Sandy

    Hi Sandy,
    in PAI. " Also try to close your Questions as currently 8 out of 8 are unresolved
    Chain. " For More info take F1 help on this Key word
    field : carrid, connid. " These are the Screen Field names
    module validate on chain-request.
    endchain.
    in Program.
    module validate.
    select single carrid into carrid
         from scarr
          where carrid = carrid.
    if sy-subrc = 0.
    select single connid into connid
              from sflight
              where connid = connid,
    if sy-subrc NE 0.
    message 'Enter Valid Connid' type 'E'.
    endif.
    else.
    message 'Enter Valid Carrid' type 'E'.
    endif.
    endmodule.
    Cheerz
    Ram
    Edited by: Ramchander Krishnamraju on Apr 12, 2010 11:48 AM

  • Doubt in Module-pool

    Hi Experts,
                 I have requirement in where in a module pool screen I am creating two Radio-buttons say R1 and R2 under one group.
    When I do this the first radio button R1 is by default gettimg checked. What is that I need to do for making secand radiobutton R2 by default getting cheked.....?
    Kindly help me out in this aspect.
    Regards,
    Rama Murthy.P

    At Screen Painter set two radio button (ZRADIOBUTTON1 and ZRADIOBUTTON2),select bothor and click Edit->Grouping->Radio Button Group->Define.
    REPORT  Z_TEST_YW.
    DATA: OK_CODE TYPE SY-UCOMM,
          ZRADIOBUTTON1(1),
          ZRADIOBUTTON2(1).
    START-OF-SELECTION.
    CALL SCREEN '100'.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS '100'.
    SET TITLEBAR 'xxx'.
      ZRADIOBUTTON2 = 'X'.  "set the second radiobutton selected
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE:OK_CODE.
        WHEN:'BACK' OR 'EXIT' OR 'CANCEL'.
          LEAVE TO SCREEN 0.
        ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT

  • How to handle The Back button on Module Pool screen

    Hi Gurus,
                  I have created a module pool screen. In that screen I have used some input/output fields(text box) which i have marked mandatory by making the input field as "required" under program tab.
    now when running the screen if no data is entered into these mandatory input field then BACK button does not work. First I have to enter some data into the input filed only then the BACK button works. How should i code so that the back button works even without entering the data into these mandatory fields.

    hi,
    use AT EXIT-COMMAND with the module.
    eg. module user_command at exit command.
    then there will be no problem.

  • Doubt regarding module pool program

    Hi experts,
    I need to use bapi in module pool program
    can we use it ? I hope we can use,
    Please any body give some sample code
    Thanks in advance
    Ranga

    bapi like another function module can be used in module pool based ojn ur desire
    a sample code is :
    case sy-ucomm.
    when 'create'
    call bapi u require
    end case
    hope it gives u an idea
    regards
    navjot
    reward accordingly

  • Handling Cursor in module pool

    Hi All,
         I have created a Screen 100. in that I have few text box and a Table Control. When i Enter some data in Table Control and hit enter the Cursor starts blinking in Textbox1, How can I control this I want the Cursor to be there in that Table Control.
    Thanks in Adv

    hi,
    check with these links
    Re: cursor position on screen data in module pool programming(urgent)
    module pool
    Cheers
    Alfred
    Reward points for helpful answers.

  • Selection screen in module pool programming..

    hi,
    I designed some screen elements for KUNNR and MATNR and handled their value selection thru POV request.
    I want to select data from my table using these values. Will a simple select statement with AND condition on these values work ? I doubt as even if the user does not enter value for one of these, my select is giong to fail. for e.g. he enters value for KUNNR but not for MATNR.
    If that is so then shud i need to design a screen which must display select options like for KUNNR, MATNR etc ? if yes then the value that is displayed there when user selects F4 must be controlled by me. how to design this in module pool ?? where to write statements related to selection screen definition and how to handle its selection ?
    thks

    it is possible.
    I am involved in this topics check my post for one method .
    https://forums.sdn.sap.com/click.jspa?searchID=14529204&messageID=1412188
    https://forums.sdn.sap.com/click.jspa?searchID=14529204&messageID=1501162
    in the above post there is alternative by Rich. that is simple and easy.
    Regards
    Vijay Babu Dudla

  • Can we use Initilization event in module pool program?

    Hi All,
    Can we use Initialization event in module pool program? If not why?
    Thanks In Advance!!!!!!!!!

    The runtime environment creates the INITIALIZATION event and calls the corresponding event block (if it has been defined in the ABAP program).
    http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb2d67358411d1829f0000e829fbfe/content.htm
    SEE THE ABOVE LINK...THINK IT WILL SOLVE ALL YOUR DOUBTS
    REGARDS
    RACHEL

  • Regarding selection-screen in module pool

    hi
    experts,
    i am having doubt in module pool programing...
      i want create selection screen(pop screen with field)  in modulepool., before the display screeen deatils
    ex :   if i want display the   record   details  for  that particular
    record number.......
    while  i am click on display..
      pop-up-selection screen will come  with record number field..
    i f enter the record no, display s the  details...
    Ananand

    Please see Rich's answer here:
    [Dialog programming - How to place a select-option field in a dialog screen;
    Rob

Maybe you are looking for