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

Dynamic selection screen

Hi Experts,

I have 3 selection screen parameters are...

PARAMETERS: p_type AS LISTBOX VISIBLE LENGTH 15,

P_bukrs like t001-bukrs modif id M1,

P_werks like marc-werks modif id M2.

List box Type has 2 values are 'Company code Level' & 'Plant Level'. If i choose Company code Level from list box, then p_bukrs should be mandatory field & P_werks should be normal input parameter. Samething if i choose PlantLevel from list box, then P_werks should be mandatory field & p_bukrs should be normal input parameter. For this i coded like this.

AT SELECTION-SCREEN OUTPUT.

Case p_type.

when 'Company code Level'.

LOOP AT SCREEN.

IF screen-group1 = 'M1'.

screen-input = 1.

screen-required = 1.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'M2'.

screen-input = 1.

screen-required = 0.

MODIFY SCREEN.

ENDIF.

Endloop.

When ‘Plant Level’.

LOOP AT SCREEN.

IF screen-group1 = 'M1'.

screen-input = 1.

screen-required = 0.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'M2'.

screen-input = 1.

screen-required = 1.

MODIFY SCREEN.

ENDIF.

Endloop.

When others.

Endcase.

My doubt is if the user choose Company code Level from list box,immediately p_bukrs becomes mandatory field. in this case,user dont want to keen any inputs in selection parameters,suddenly user choose Plant level from list box. But still p_bukrs is mandatory field instead of p_werks . So user gets confused.

How to acheive this..Help it out

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jun 12, 2012 at 09:51 AM

    HI Kelvin,

    Put some Default value in p_bukrs such as Frequently used Company code .

    PARAMETERS: P_bukrs like t001-bukrs DEFAULT 'GB11' modif id M1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2012 at 09:53 AM

    Hi,

    In that case you can use a message to denote the BUKRS or WERKS is mandatory.

    Case p_type.

    when 'Company code Level'.

    IF p_bukrs is initial.

    "Error Message

    endif.

    When ‘Plant Level’.

    IF p_werks is initial.

    "Error Message

    endif.

    When others.

    Endcase.

    Thanks,

    Shambu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 12, 2012 at 10:14 AM

    Did you try to add a USER_COMMAND to the listbox parameter, that will trigger a PAI/PBO so code will go thru AT SELECTION-SCREEN OUPUT code.

    Also it would be easier to check in AT SELECTION-SCREEN code if mandatory field are filled, ignoring the check when the function associated to listbox is triggered.

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2012 at 11:15 AM

    Hi Kelvin,

    You just use below code...it will work....

    TYPE-POOLS : vrm.

    DATA : return_tab TYPE STANDARD TABLE OF ddshretval,

    wa_ret_tab TYPE ddshretval.

    TYPES : BEGIN OF ty_char,

    text TYPE char20,

    END OF ty_char.

    DATA : it_tab TYPE TABLE OF ty_char,

    wa_tab TYPE ty_char.

    SELECTION-SCREEN BEGIN OF BLOCK b1.

    PARAMETERS: p_type TYPE char20, "AS LISTBOX VISIBLE LENGTH 15,

    p_bukrs LIKE t001-bukrs MODIF ID m1,

    p_werks LIKE marc-werks MODIF ID m2.

    SELECTION-SCREEN END OF BLOCK b1.

    INITIALIZATION.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_type.

    IF p_type IS INITIAL.

    REFRESH : it_tab,return_tab.

    CLEAR : wa_tab,wa_ret_tab.

    wa_tab-text = 'COMPANY CODE LEVEL'.

    APPEND wa_tab TO it_tab.

    CLEAR wa_tab.

    wa_tab-text = 'PLANT LEVEL'.

    APPEND wa_tab TO it_tab.

    CLEAR wa_tab.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    * DDIC_STRUCTURE = ' '

    retfield = 'TEXT'

    * PVALKEY = ' '

    * DYNPPROG = ' '

    * DYNPNR = ' '

    * DYNPROFIELD = ' '

    * STEPL = 0

    * WINDOW_TITLE =

    * VALUE = ' '

    value_org = 'S'

    * MULTIPLE_CHOICE = ' '

    * DISPLAY = ' '

    * CALLBACK_PROGRAM = ' '

    * CALLBACK_FORM = ' '

    * MARK_TAB =

    * IMPORTING

    * USER_RESET =

    TABLES

    value_tab = it_tab

    * FIELD_TAB =

    return_tab = return_tab

    * DYNPFLD_MAPPING =

    * EXCEPTIONS

    * PARAMETER_ERROR = 1

    * NO_VALUES_FOUND = 2

    * OTHERS = 3

    .

    IF sy-subrc <> 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    IF sy-subrc = 0.

    READ TABLE return_tab INTO wa_ret_tab INDEX 1.

    p_type = wa_ret_tab-fieldval.

    CASE p_type.

    WHEN 'COMPANY CODE LEVEL'.

    LOOP AT SCREEN.

    IF screen-group1 = 'M1'.

    screen-input = 1.

    screen-required = 1.

    MODIFY SCREEN.

    ENDIF.

    IF screen-group1 = 'M2'.

    screen-input = 1.

    screen-required = 0.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    WHEN 'PLANT LEVEL'.

    LOOP AT SCREEN.

    IF screen-group1 = 'M1'.

    screen-input = 1.

    screen-required = 0.

    MODIFY SCREEN.

    ENDIF.

    IF screen-group1 = 'M2'.

    screen-input = 1.

    screen-required = 1.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    WHEN OTHERS.

    ENDCASE.

    ENDIF.

    ENDIF.

    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.