How to make a parameter mandatory ONLY if a certain radiobutton is clicked

Hello experts,
I have 3 radiobuttons. Now I modified it in such a way that if I clicked the 3rd radiobutton which is named pr_edit the parameter p_code will accept input. Now, what I want to modify it again that when I click on the pr_edit radiobutton, the parameter will be mandatory but the problem is this, if I click on other radiobuttons the parameter p_code is still mandatory which is wrong. Anyway, below is my code:
SELECTION-SCREEN BEGIN OF BLOCK box1 WITH FRAME TITLE text-001.
PARAMETERS: pr_upld RADIOBUTTON GROUP grp MODIF ID id3
                                          USER-COMMAND ucomm.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 03(30) text-a11 FOR FIELD p_flnme MODIF ID id3.
PARAMETERS: p_flnme LIKE rlgrap-filename DEFAULT 'C:\' MODIF ID id3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(32) text-002 FOR FIELD p_dcode MODIF ID id1.
PARAMETERS: p_dcode LIKE vbak-kunnr MODIF ID id1,
            p_name1 LIKE kna1-name1 MODIF ID id1.
SELECTION-SCREEN END OF LINE.
PARAMETERS: pr_list RADIOBUTTON GROUP grp MODIF ID id4,
            pr_add  RADIOBUTTON GROUP grp MODIF ID id2,
            pr_edit RADIOBUTTON GROUP grp MODIF ID id5.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 03(30) text-a12 FOR FIELD p_code MODIF ID id2.
*PARAMETERS: p_kunnr LIKE zts0001-kunnr.
PARAMETERS: p_code LIKE zts0001-cdseq MODIF ID id6.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK box1.
AT SELECTION-SCREEN OUTPUT.
IF v_compflag EQ space.
    LOOP AT SCREEN.
      IF screen-group1      = 'ID1'.
        screen-input        = '0'.
        screen-output       = '1'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID2'.
        screen-active       = '1'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID3'.
        screen-active       = '0'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID4'.
        screen-active       = '1'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID5'.
        screen-active       = '1'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID6'.
        screen-active       = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF v_compflag NE space.
    LOOP AT SCREEN.
      IF screen-group1      = 'ID1'.
        screen-active       = '0'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID2'.
        screen-active       = '0'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID3'.
        screen-active       = '1'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID4'.
        screen-active       = '1'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID5'.
        screen-active       = '0'.
        MODIFY SCREEN.
      ELSEIF screen-group1  = 'ID6'.
        screen-active       = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
  LOOP AT SCREEN.
    IF screen-name   = 'P_CODE'.
      screen-input   =  '0'.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
  IF pr_list = 'X' OR
     pr_add = 'X'  OR
     pr_upld = 'X'.
    LOOP AT SCREEN.
      IF screen-group1   =  'ID6'.
        screen-input     =  '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
  IF pr_edit  =  'X'.
    LOOP AT SCREEN.
      IF screen-group1   =  'ID6'.
        screen-input     =  '1'.
        screen-required  =  '1'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
Again, thank you guys!

Hi,
As i said earlier put your logic in AT SELECTION-SCREEN.
<b>Replace this logic :
IF pr_edit = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'ID6'.
screen-input = '1'.
screen-required = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
     with:</b>
LOOP AT SCREEN.
IF screen-group1 = 'ID6'.
IF pr_edit = 'X'.
screen-input = '1'.
ELSE.
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Then
IF p_edit = 'X' and P-code is initial.
message "Enter the code".
endif.

Similar Messages

  • How to lock a customer master and how to make a parameter checkbox as defau

    how to lock a customer master and how to make a parameter checkbox as default checked?

    The Account Groups is the one which maintains the field status for the customer master. In case you want to change the field status (i.e. changage the mandatory field to optional field) you need to maintain the same (i.e. changage the mandatory field to optional field) by navigating to the field status screen and then to the general data tab. Here you can change the status of the your field by selecting the 'OPTIONAL' radio button for the respective field and then save the transaction.
    Reward Points if useful.

  • Make a parameter mandatory when you choose a particular value from pameter2

    Hello,
    How do I make a parameter mandatory in sql script?
    I have 2 optional parameters:
    1) parameter1 (&1)
    2) parameter2 (&2)
    parameter1 has 4 values:
    1) East
    2) West
    3) North
    4) South
    paramete2 has 3 values:
    1) 123
    2) 456
    3) 789
    when I choose a value (North) from parameter1 the parameter2 has to become mandotory. If i choose any values from parameter1 other than North, parameter2 should be optional.
    Any help would be greatly appreciated.
    Thank you

    We do not currently support mandatory parameters in the standalone release. Its in the works thou
    tim

  • How to make a parameter grey

    How to make a parameter(text box) uneditable by enduser.

    Hhi,
    SELECTION-SCREEN COMMENT [/]pos(len) comm [FOR FIELD f]
                                              [MODIF ID key].
    This statement writes the comm comment on the selection screen. For comm, you can specify a text symbol or a field name with a maximum length of eight characters. This character field must not be declared with the DATA statement, but is generated automatically with length len. The field must be filled before the selection screen is called. You must always specify the pos(len) addition. Only if there are several elements in one line can you omit pos.
    The text comm  will be displayed, starting in column pos, for a length of len. If you do not use a slash (/), the comment is written into the current line; otherwise a new line is created.
    You use FOR FIELD f to assign a field label to the comment. f can be the name of a parameter or a selection criterion. As a result, if the user requests help on the comment on the selection screen, the help text for the assigned field f is displayed.
    Regards
    Sudheer

  • How to make a field Mandatory in a Table view?

    How to make a field Mandatory in a Table view?
    The requirement is, the user should not be able to append a new Row, unless and untill he enteres the data in the column SOLD-TO. Now how do i acheive making this field madatory. Normally in Edit form view, we can go in customizing and flag Mandatory, for table view we don't have this option.
    Please can anyone of you guide me in this approach?
    Jagadish.G

    Hi Jagadish,
    have a look in this thread, part of the code you can use in eh_insert method or logic to write enable/disable insert button.
    Re: Assignment Block Mandatory
    regards
    Ismail
    Edited by: Ismail Shaik on Oct 21, 2009 11:36 AM

  • How to make a field mandatory in billing

    How to make a field mandatory in billing document,if m right with the help of incomplition log but how.....
         plz reply the full configuration.

    Hi Mohan,
    We normally create a billing document with reference any other document say Order or delivery.
    so, all the necessary information in the invoice will be taken from preceeding doucments. Thats way in the order level we check for incompletion log. If any important data is missing in the order level then the succeding documents will not be created.
    Thats way in the billing documents all the necessary information will come automatically either from preceeding documents or from master data.
    Still you want to make any field mandatory, you can do these by modifieing Billing documents user exists,you can make which ever the fields are mandatory and to be checked before saving. so when you are going to save the invoice, it will check if these fields are maintained or not.
    Hope this is clear.
    Reward if helpful.
    Thanks,
    Praveen

  • How to make all fields mandatory in sales order T- code VA01 initial screen

    Dear all,
    how to make all fields mandatory in sales order T- code VA01 initial screen itself
    The fields are
    Sales Organization
    Distribution Channel
    Division
    Sales Office
    Sales Group
    Regards,
    Amar Reddy

    Hi,
    You can use Transaction Variant to achieve this functionality.Please go through the following link which helps you in creating the same.
    [Link|http://wiki.sdn.sap.com/wiki/display/Snippets/TransactionVariant-AStepbyStepGuidefor+Creation]
    Regards,
    Phani Prasad

  • How to make Business place mandatory

    Hi, SAP Gurus,
    How to make business place mandatory in "MIRO ". As i know there are two ways
    1) Through Screen Variant T/code: SHD0
    2) Validation
    But here  i Never worked on sreen variant level and validation, I need step by step to make business place mandatory in MIRO
    bY USING ABOVE T/CODES,
    Regards,
    Prabhakar

    Hi Bhanu,
    Use T.Code GGB0 - Validation maintenance - Change Validation overview.
    Choose Financial Accounting in Application area. Select Line Item and click Validation create icon.
    Give a Validation ID BP and text Business Place Mandatory and save.
    Click Step icon - Step 01 - now the prerequisites; check and message will come in margin panel.
    Give text for the step 01. Click Prerequisites. You can see the Table Fields  Structure BKPF, BSEG, and SYST.
    If you double click on this you view individual fields relating to these master tables.
    Your prerequisite may be like this :
    Company Code is = XYZ ; T.Code = MIRO & F-43; Posting key = 31 ( Credit Vendor)
    Double click BKPF > double click  BKPF-BUKRS>  click "=" >  click constant > a pop up box will open
    here fill up your company Code XYZ.  This will automatically come in the top box.  Click "AND". Now  there is a back arrow
    button in the table field panel and come back to the original display of master tables.  Here double click SYST
    Click SYST-TCODE > click "=" > click Constant > in the pop up box enter tcode MIRO. If you want to add F-43,
    you have to click "AND" after this and repeate SYST-TCODE = F-43. Now click back arrow and double click BSEG and
    click BSEG-BSCHL > Click "=" > Click Constant > in the popup window enter 31 and save the prerequisites.
    (For the above requisites, the system will check if  Business Place is 1000 is filled up during transaction and if not it has to
    give a error message.)
    Now Click Check in the right margin below prerequisites menu. Again the table list will be seen with BKPF, BSEG and SYST
    Double click BSEG > click BSEG-BUPLA > Click "=" > Click constant and in the pop up box fill the business place 1000 and save
    the check menu.
    In the right margin now double click message.  Here you can create a message text of your own "Business Place mandatory"
    Save the Message and come back and finally save the Validation so created.
    Now use T.Code OB28 and enter your Company Code > give call point 2 > and Activation level 1 and save the entries.
    Now you can check for the transaction in MIRO where without filling the Business Place field you cannot save the entries.
    Hope the above steps will be clear for you.  If you have any doubt please revert back.
    Best Regards,
    Sadashivan

  • How to make relationship block mandatory?

    Hi,
    Please let me know how to make relationship block mandatory to create a business partner?
    Vinay

    Hi Vinay,
    Did you try to set the flag mandatory in the configuration of the relationship view for a field (e.g. relationship).
    Just go to the view in the component workbench, select your configuration, mark a field and go to Show Field Properties.
    Hope this helps.
    Regards, Thea

  • How to make characteristic as Mandatory

    Dear All,
    In Batch Management, for a class, how to make particular characteristics as a "Required Entry".
    In class, I can see "Required Entry" check box, but it is greyed out. How to make it as Mandatory.
    Because, we have maintained "LOBM_HSDAT" characteristic for a class.
    But while doing MIGO and MB1C, it is not asking to Manufacturing date.
    Please let me know how to make it as mandatory field in a Class.
    Regards,
    Mullairaja

    Not sure this would help you but you can try,
    In t.code CT04, enter the characteristic LOBM_HSDAT and click on change button. Go to basic data tab. Check the box required entry, which you can find on the right hand side and then save. Test again. You must also test in t.code MSC1N apart from MIGO.
    MullaiRaja, I must take a step back. The above solution proposed will not hold good for MIGO. To force the user to enter the manufacturing date/expiry date, then in material master ->Plant data/Stor.1 view, maintain the settings for min.shelf life, total shelf life and Period indicator for SLED. If these data are maintained, then when the user does MIGO and if there is no batch master already maintained, then the system will force the user to enter the manufacturing or expiry date.
    Regards,
    Edited by: Shiva Ram on Jan 5, 2011 11:27 AM

  • How to make a checkbox mandatory

    Hello,
    I created  a checkbox where I want the user to check that they have read and acknowledged a privacy statement.
    I am curious how I make the checkbox mandatory, as I dont see an option in the Object Pallete.
    Thanks in advance!
    Nik

    Write the following line code on initialize event of the CheckBox to make it mandatory.
    this.mandatory = 'error'
    Nith

  • How to make a filed mandatory of an editable ALV

    Hi Guru,
    Pls tell me how to make a filed mandatory of an editable ALV so that while a new records is inserted the mandatory fields are filled.

    hi,
    You can make fields as mandatory fields using data changed event.
    validate the entered or blank entries of a column in data changed event and call method 'add_protocol_entry' to raise errors.
    Check the program : BCALV_EDIT_03 & BCALV_EDIT_04for more details.
    Refer to this link....
    about field in alv
    obligatory field editable in ALV

  • How to make selection parameter gray out, not changeble mode

    Hi Experts,
      Selection screen having parameters, I am putting default values in that parametrs.
    How to make this parameter gray out, not changeable mode.
    Thanks in advance
    mahahe.
    See comments below
    Edited by: Rob Burbank on Jul 1, 2009 12:43 PM

    Hi,
    For the parameters required, while declaring them use the MODIF ID, lets say you have choosen the modif id as SC1.
    i.e. parametes: p_mat type matnr DEFAULT '100' MODIF ID SC1.
    Then in the initialization event, code as below.
        LOOP AT SCREEN.
          IF screen-group1 = 'SC1'.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    It will work.
    Regards,
    Nangunoori.

  • How do you stop auto play only go to next slide on click once published Version 7

    How do you stop auto play only go to next slide on click once published Version 7? I mean to stop the play slide bar moving down the bottom?

    Thank you, I already have click boxes and buttons on every slide - the slider at the bottom still automatically moves, it doesn't go to next slide until button or box is clicked. I want to stop it moving if possible?
    Update: looks like it does the same on the old versions - I'm assuming its the time set to play each slide. I will just even these up so the don't look so inconsistent.

  • How to make Select Options Mandatory?

    Hi Guys,
                  Can anybnody tell me how to Declare  Selection Options for some of them mandatory.
    Select-Options : v_PurOrg for EKKO-EKORG default '2000',
                             v_GRDate for Sy-Datum ,
                             v_GRPrd  for MSEG-GJAHR.
             In these i have to make v_PurOrg Manadatory.
    Thanks,
    Gopi.

    Hi Gopi,
    In order to make select-options mandatory we add OBLIGATORY in the statement like the below.
    Selection-Screen.
    Select-Options : v_PurOrg for EKKO-EKORG default '2000' OBLIGATORY.
    In this case, only the first option will have the default value of 2000.But if you want both the options low and high of select-options, means you have to add the below code in your program in the initialization event.
    Initialization.
    v_PurOrg-low    =   1000. 
    v_PurOrg-high    =   2000. 
    append v_PurOrg.
    Hope this helps.
    Please reward if useful.
    Thanks,
    Srinivasa

Maybe you are looking for