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

Drop down list in Module Pool

Hi Friends,

I am trying to use drop down list in module pool program.

REFRESH v.

CLEAR vw.

vw-key = '1'.

vw-text = 'C Form Entry'.

APPEND vw TO v.

vw-key = '2'.

vw-text = 'C Form Display'.

APPEND vw TO v.

vw-key = '3'.

vw-text = 'C Form Update'.

APPEND vw TO v.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'C_FORM_MENU'

values = v

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

Using above program I can put value in list box in PBO.

But how can I know which value is selected by user in PAI.

Please guide me.

Thank you

Amit Sontakke

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 08:57 AM

    Hi,

    This example will help you in retrieving values from list box.

    DATA: g_name1  TYPE vrm_id,
          g_list1  TYPE vrm_values,
          g_wa_list LIKE LINE OF g_list1,
          g_value_1 LIKE LINE OF g_list1.
    
    DATA: g_status(20) TYPE c.
    
    CONSTANTS: c_status TYPE string VALUE 'G_STATUS',
                         c_to_be_sub TYPE string VALUE 'TO BE SUBMITTED',
                        c_sub TYPE string VALUE 'SUBMITTED',
                        c_chg_needed TYPE string VALUE 'CHANGE NEEDED',
                        c_app TYPE string VALUE 'APPROVED'.

    In PBO we populate list box.

    MODULE f4_scr OUTPUT.
    
    
      REFRESH g_list1.
      g_name1 = c_status.
      g_value_1-key = c_to_be_sub.
      g_value_1-text = c_to_be_sub.
      APPEND g_value_1 TO g_list1.
    
      g_value_1-key = c_sub.
      g_value_1-text = c_sub.
      APPEND g_value_1 TO g_list1.
    
      g_value_1-key = c_chg_needed.
      g_value_1-text = c_chg_needed.
      APPEND g_value_1 TO g_list1.
    
      g_value_1-key = c_app.
      g_value_1-text = c_app.
      APPEND g_value_1 TO g_list1.
    
      IF NOT g_list1 IS INITIAL.
        CALL FUNCTION 'VRM_SET_VALUES'
          EXPORTING
            id     = g_name1
            values = g_list1.
      ENDIF.
    
    ENDMODULE.                 " F4_SCR  OUTPUT

    *Function module to get the list box values. * we write this code in PAI

    MODULE user_command_9000 INPUT.
    
     g_name1 = c_status.
      CALL FUNCTION 'VRM_GET_VALUES'
        EXPORTING
          id           = g_name1
        IMPORTING
          values       = g_list1
        EXCEPTIONS
          id_not_found = 1
          OTHERS       = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    
      READ TABLE g_list1 INTO g_wa_list WITH KEY key = g_status.
      IF sy-subrc EQ 0.
        g_status = g_wa_list-text.
      ENDIF.
    
    ENDMODULE.

    This will surely help to retrieve the values from list box.

    Plz reward if useful.

    Thanks,

    Dhanashri.

    Edited by: Dhanashri Pawar on Jun 17, 2008 10:58 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 08:36 AM

    Hi,

    create a variable in your program with the name same as screen field name(list box field) then always the selected value will be present in that variable.

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 08:38 AM

    check values sy-subrc, sy-curow, sy-..... and so on.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 08:41 AM

    Amit,

    For example, consider you have function code 'SELECTED' for your dropdown list box.

    MODULE user_command_9100 INPUT.

    CASE ok_code.

    WHEN 'BACK'. LEAVE TO SCREEN 0.

    WHEN 'EXIT'. LEAVE TO SCREEN 0.

    WHEN 'CANC'. LEAVE TO SCREEN 0.

    WHEN 'SELECTED'.

    READ TABLE v INTO wv BINARY SEARCH

    WITH KEY key = C_FORM_MENU.

    IF sy-subrc = 0.

    MESSAGE i398(00) WITH 'Key: ' wv-key

    'Value: ' wv-text.

    ENDIF.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_9100 INPUT

    This will display a information box with the values you selected from the dropdown list box.

    C_FORM_MENU variable will contain the value.

    Regards,

    Dhana

    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.