Skip to Content

How to disable enable checbox at selection screen number

Hi all,
i need to disable and enable checkbox at the screen number 0012, how to make it work ?

after i call screen 0012.
i need to proses disable and enable checkbox, so where should i write code ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Aug 21 at 04:13 AM

    I try to summarize what you want technically:

    • When checkbox C_ARC is not checked, all other selection-screen elements should be visible and available for input
    • When checkbox C_ARC is checked, some other selection-screen elements need to be 'disabled', meaning they are visible (active = 1) but they are greyed out and not available for input (input = 0)
    • Based on your description, those other selection-screen elements should be the other checkboxes C_SAV and C_DEL. The select-options variables from screen 0012 as well as possible others should be untouched.

    Solution based on your current coding:

    • Your coding is currently missing the MODIFY SCREEN statement at the end of the LOOP AT SCREEN, which will update the settings for your screen elements. Currently you set values for screen elements only on header level of table SCREEN, but not in the actual table itself
    • Currently, (if MODIFY SCREEN would exist) you are making all selection screen elements other than C_ARC not available for input, because all others will not have the screen-group1 'AB' because they dont have the MODIF ID ab
    • A selection screen element does normally not need to be activated or made available for input, those are the standard settings that are set by default every time there is a new series of AT SELECTION-SCREEN events.
    • You cannot / dont have to address the screen elements by 'screen', eg. screen 0012
    • If you want to make a selection screen element invisible, you set screen-active = 0
    • If you want to make a selection screen element visible but not available for input, you set screen-input = 0
    • If you want to group several screen elements to a 'functional group', one of the options is to use the same MODIF ID xyz parameter when defining the element. You could also work with logical pre- or suffixes for creating groups with subgroups:

      PARAMETERS c_sav AS CHECKBOX MODIF ID abc.
      PARAMETERS c_arc AS CHECKBOX MODIF ID abx.
      PARAMETERS c_del AS CHECKBOX MODIF ID abc.

      ab* would be a logical 'group'
      abc would be a logical subgroup 1
      abx would be a logical subgroup 2

      So I would give all the selection-screen elements that you want deactivated because of C_ARC the same MODIF ID, e.g. AC, that way you can address them all at once with just screen-group1 = 'AC'
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF c_arc = abap_true.
          IF screen-group1 = 'AC'     " I assume you want C_DEL deactivated
          OR screen-name   = 'C_SAV'. " not sure if you want this one deactivatet too
            screen-input = 0.
            c_del = abap_false. " when deactivating, you should also set the value you want it to have
            c_sav = abap_false. " again, not sure
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    
    Add a comment
    10|10000 characters needed characters exceeded

    • Stedward McKnight, it doesnt really matter where you write that event, as long as the necessary elements are defined before it.

      So if you define your selection-screen elements in include zprogram_top, the screen events should be defined afterwards, either also in zprogram_top after the selection-screen elements, or in your main program zmainprogram after the include of zprogram_top.

      You can think of an include just as a place holder for the entire coding that is inside the include. Includes help you reorganize and reuse functionalities. Includes that are declared above other includes cannot access functionality (data, forms, classes) from coding or other includes defined after them. Includes can only access functionality from other includes or the main programm if that functionality is defined before that include.

      The main focus should be, that a developer can quickly find the different parts and logic of a program when looking and navigating through the main program:

      REPORT zmainprogram.
      
      INCLUDE zprogram_top. " Top-Include with global constants, data
      INCLUDE zprogram_sel. " Selection-Screen
      INCLUDE zprogram_evt. " Program-Events => you could also separate this and name it _pbo and _pai
      INCLUDE zprogram_f01. " main routines
      INCLUDE zprogram_f02. " sub routines<br>
  • Posted on Aug 21 at 05:01 AM

    I think you can write code anyplace.
    But for easy to maintain in future, i think you need to define which type of code inside include...
    Example: TOP include to store global variable, data type and screen, class definition
    PBO store process event PBO
    Main program to execute code
    Dont worry where you write it, back your project and check or define where you want to write inside

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 21 at 03:40 AM
    -1

    I have ways to resolve it

    LOOP AT SCREEN.

    .....IF C_ARC = ABAP_TRUE.

    .........IF screen-name = 'S_NO'.

    ...............screen-input = '0'.

    ...............modify screen.

    ..........endif.

    ....ENDIF.

    ENDLOOP.

    Write it inside event: AT SELECTION-SCREEN OUTPUT.
    If you want disable group, check screen-group1 and change screen-input to zero to disable it

    Could you try it.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.