Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Query about VRM_SET_VALUES

Former Member
0 Likes
1,513

I am working with module pool program and am using function module VRM_SET_VALUES to populate a list box.

I am writing the logic in the PAI of the screen flow logic.

Eg:

process on value-request.

field list_field MODULE populate_list.

This populates the list.

Now if I have to select an item from the list and press 'Enter', the selected item value dissappears as the module 'populate_list' fires again.

Is there a way to avoid this?

Kindly help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,402

Hi,

In PBO code this way :

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

And in PAI :

MODULE user_command_9000 INPUT.
* function module to get the list box values.

  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.                 " USER_COMMAND_9000  INPUT

Hope this helps.

thanx,

dhanashri.

Edited by: Dhanashri Pawar on Aug 21, 2008 11:36 AM

9 REPLIES 9
Read only

Former Member
0 Likes
1,402

Check this Demo

DEMO_DYNPRO_DROPDOWN_LISTBOX

Did you set the function code For the list box screen field.

why are you populating the values at this POV. instead populate them at PBO and handle them using the User command in PAI by setting the function code to the list box field.

Read only

0 Likes
1,402

Hi Vijay,

I am not using a dictionary object. Rather I am using hard coded values in the program. In PBO too if I call VRM_SET_VALUES, the list box is reset everytime PBO gets fired.

Is there any way out in this scenario?

Thanks.

Read only

0 Likes
1,402

You have to append the values in list in PBO only.Let me know the detailes logic.

Read only

0 Likes
1,402

Code is as below.

*********************************************

PROCESS BEFORE OUTPUT.

MODULE status_1001.

MODULE populate_list.

PROCESS AFTER INPUT.

MODULE user_command_1001.

*********************************************

module populate_list output.

clear values.

value-key = 'FOC'.

value-text = 'FOC'.

append value to values.

value-key = 'INSTALLMENT'.

value-text = 'INSTALLMENT'.

append value to values.

value-key = 'INSTALLMENT1'.

value-text = 'INSTALLMENT1'.

append value to values.

field_id = 'list'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = field_id

VALUES = VALUES.

IF sy-subrc <> 0.

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

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

ENDIF.

endmodule. " populate_list OUTPUT

Read only

0 Likes
1,402

The Value list attribute is set to A, and it has the function code.

Read only

0 Likes
1,402

>

> Hi Vijay,

>

> I am not using a dictionary object. Rather I am using hard coded values in the program. In PBO too if I call VRM_SET_VALUES, the list box is reset everytime PBO gets fired.

>

> Is there any way out in this scenario?

>

> Thanks.

Certain things that you do in the PBO eg doing the initial population of a table control from a database table, should only be done once, and this is one of them. Run VRM_SET_VALUES on the first run of the PBO when your screen is first called. Then set a flag which you will check on every subsequent PBO call to prevent the FM from running again.

Read only

Former Member
0 Likes
1,402
Read only

Former Member
0 Likes
1,403

Hi,

In PBO code this way :

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

And in PAI :

MODULE user_command_9000 INPUT.
* function module to get the list box values.

  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.                 " USER_COMMAND_9000  INPUT

Hope this helps.

thanx,

dhanashri.

Edited by: Dhanashri Pawar on Aug 21, 2008 11:36 AM

Read only

Former Member
0 Likes
1,402

hi Check out this code.

PROCESS BEFORE OUTPUT.

MODULE status_0100.

**Moduel to create the drop down for the field TYPE

MODULE type_dropdown.

MODULE type_dropdown OUTPUT.

CLEAR : value,

list.

value-key = c_txt01.

APPEND value TO list.

value-key = c_txt02.

APPEND value TO list.

value-key = c_txt03.

APPEND value TO list.

value-key = c_txt04.

APPEND value TO list.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'D_TYPE'

values = list.

ENDMODULE. " TYPE_DROPDOWN OUTPUT