Skip to Content
author's profile photo Former Member
Former Member

Reg-Selection-Screen events

Hi,

In selection screen I have a parameter field P_STATUS. When I press F4 on P_STATUS it displays CREATE and REPROCESS. Is it possible to keep a dynamic push button based on my status selection.If I selected CREATE status it should display CREATE push button and If I selected REPROCESS status it should display REPROCESS push button.

Is it possible.Please suggest how to do.

Thanks and regards,

Umakanth

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jun 08, 2012 at 05:13 AM

    Hello,

    There s no need to create multiple push-button. Only 1 will do, you can use the combination of the parameter & the PB to decide what operation the program will perform!

    PARAMETERS: p_mode TYPE char20 AS LISTBOX
    USER-COMMAND mod
    VISIBLE LENGTH 15
    DEFAULT 'CREATE'.

    SELECTION-SCREEN: PUSHBUTTON /2(15) v_tx_but USER-COMMAND but.

    INITIALIZATION.
    v_tx_but = 'CREATE'. "Default value

    AT SELECTION-SCREEN OUTPUT.
    * Set the button text as per the mode selected
    CASE p_mode.
    WHEN 'CREATE'.
    v_tx_but = 'CREATE'.
    WHEN 'REPROCESS'.
    v_tx_but = 'REPROCESS'.
    ENDCASE.

    AT SELECTION-SCREEN.
    IF sy-ucomm = 'BUT'.
    CASE p_mode.
    WHEN 'CREATE'.
    MESSAGE 'Program will CREATE!!!' TYPE 'S'.
    WHEN 'REPROCESS'.
    MESSAGE 'Program will REPROCESS!!!' TYPE 'S'.
    ENDCASE.
    ENDIF.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_mode.
    TYPES:
    BEGIN OF ty_f4_val,
    mode TYPE char20,
    END OF ty_f4_val.

    DATA: gt_f4_val TYPE STANDARD TABLE OF ty_f4_val,
    gs_f4_val TYPE ty_f4_val.

    CLEAR gt_f4_val.

    gs_f4_val-mode = 'CREATE'. APPEND gs_f4_val TO gt_f4_val. CLEAR gs_f4_val.
    gs_f4_val-mode = 'REPROCESS'. APPEND gs_f4_val TO gt_f4_val. CLEAR gs_f4_val.

    * Call the F4 help
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'MODE'
    dynpprog = sy-repid
    dynpnr = sy-dynnr
    dynprofield = 'P_MODE'
    value_org = 'S'
    TABLES
    value_tab = gt_f4_val
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    * SUBRC check is not required
    ENDIF.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2012 at 04:04 AM

    hi,

    Check the sample program: demo_sel_screen_status

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2012 at 04:06 AM

    Hi UmaKanth,

    I am guessing you are using SELECTION SCREEN PUSHBUTTON to create the push buttons.

    You need to create 2 pushbuttons and hide them in AT SELECTION-SCREEN OUTPUT.

    Then depending on the value selected, you can display one in AT SELECTION-SCREEN.

    Thanks,

    Shambu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Use this sample code. Give the value as C or R and check.

      SELECTION-SCREEN:

      PUSHBUTTON 2(10) create USER-COMMAND cli3 MODIF ID bu1,
      PUSHBUTTON 12(10) reproc USER-COMMAND cli4 MODIF ID bu2.
      PARAMETER : p_status TYPE c.

      AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
      IF screen-group1 = 'BU1' OR screen-group1 = 'BU2'.
      screen-invisible = '1'.
      MODIFY SCREEN.
      ENDIF.
      IF p_status = 'C'.
      IF screen-group1 = 'BU1' .
      screen-invisible = '1'.

      MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BU2' .
      screen-invisible = '0'.
      MODIFY SCREEN.
      ENDIF.
      ELSEIF p_status = 'R'.

      IF screen-group1 = 'BU1' .
      screen-invisible = '0'.
      MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BU2' .
      screen-invisible = '1'.
      MODIFY SCREEN.
      ENDIF.
      ENDIF.
      ENDLOOP.

      Thanks,

      Shambu

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2012 at 05:13 AM

    Refer to these threads you may find it useful.

    http://scn.sap.com/thread/515678

    http://scn.sap.com/thread/1565809

    Regards,

    Jake

    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.