Application Development 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: 

Select options - dynp_values_update

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

I need to update a select option ( multiple values ) in the selection screen. I tried with DYNP_VALUES_UPDATE but it was not working. I am checking on this for last two days but did not reach the solution.

Please donot tell me to use submit statement ( calls an internall session ) becuase that is what i got when i searched in SCN. I want this functionality to happen when the f4 help is selected. We are providing a popup of multiple checkboxes when f4 is pressed on a select option. When one or more check boxes are selected then those values must be appended to the select option. Please give me some ideas.

If i have to use DYNP_VALUES_UPDATE then how should i use it for select option ?

Regards

Kesav

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Keshav,

For SELECT-OPTIONS you can update the values in the LOW & HIGH fields only using DYNP_VALUES_UPDATE.

We are providing a popup of multiple checkboxes when f4 is pressed on a select option. When one or more check boxes are selected then those values must be appended to the select option.

Can you be a more specific on this? If possible post the relevant portion of the code.

BR,

Suhas

8 REPLIES 8

Former Member
0 Kudos

hi,

You can try with the below code. Here from the table ZRFIMOD entries we get the f4 selections and in it_vrm is with the fields to be displayed.

SELECT * FROM ZRFIMOD INTO TABLE ITAB.

REFRESH IT_VRM.

LOOP AT ITAB.

WA-KEY = ITAB-MODU.

WA-TEXT = ITAB-MODU.

APPEND WA TO IT_VRM.

CLEAR WA.

ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'ZRFI-MODU' " Fieldname for f4

VALUES = IT_VRM

EXCEPTIONS

ID_ILLEGAL_NAME = 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.

Regards,

sirisha.

0 Kudos

Hi Sirisha,

Please read my question carefully. I donot need a list box...its a select option where in I need to update multiple values to it.

Kesav

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Keshav,

For SELECT-OPTIONS you can update the values in the LOW & HIGH fields only using DYNP_VALUES_UPDATE.

We are providing a popup of multiple checkboxes when f4 is pressed on a select option. When one or more check boxes are selected then those values must be appended to the select option.

Can you be a more specific on this? If possible post the relevant portion of the code.

BR,

Suhas

0 Kudos

Hi Suhas ,

Let me explain it more clearly.

In the selection screen there is a select option. User will not manually provide the input but he will select it through f4 help. The f4 help displayed for the field is not a standard one( AT SELECTION-SCREEN ON VALUE-REQUEST is used ). A popup is displayed using function module REUSE_ALV_POPUP_TO_SELECT when the f4 is pressed . The displayed popup consists of a check box and other two fields in it. Now if the user seleted multiple checkboxes( say two ) then the values from a column of the selected rows must be appended to the select options. in this case select-option-low must be appended with two values.

Using function DYNP_VALUES_UPDATE i was able to populate a single value but not multiple. I will try to format the code and then paste it here.

I hope now you got the issue i am facing.

Kesav

0 Kudos

Hi Suhas,

Just check this sample code.


TYPE-POOLS:slis.

DATA:v_mat TYPE mara-matnr.
DATA: wa_fcat TYPE slis_fieldcat_alv,
      it_fcat TYPE slis_t_fieldcat_alv.

TYPES: BEGIN OF ty,
  checkbox TYPE c,
  matnr TYPE matnr,
  END OF ty.

DATA:it TYPE TABLE OF ty.
data:wa type ty.


SELECT-OPTIONS s_mat FOR v_mat no intervals .

INITIALIZATION.

  CLEAR it_fcat[].

  wa_fcat-col_pos   = '1'.
  wa_fcat-fieldname = 'CHECKBOX'.
  wa_fcat-tabname   = 'IT'.
  APPEND wa_fcat TO it_fcat.
  CLEAR wa_fcat.
  wa_fcat-col_pos   = '2'.
  wa_fcat-fieldname = 'MATNR'.
  wa_fcat-tabname   = 'IT'.
  APPEND wa_fcat TO it_fcat.
  CLEAR wa_fcat.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_mat-low.

  SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF TABLE it UP TO 100 ROWS.

  CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
      i_selection          = 'X'
      i_zebra              = 'X'
      i_checkbox_fieldname = 'CHECKBOX'
      i_scroll_to_sel_line = 'X'
      i_tabname            = 'IT'
      it_fieldcat          = it_fcat
    TABLES
      t_outtab             = it[]
    EXCEPTIONS
      program_error        = 1
      OTHERS               = 2.

  LOOP AT it INTO wa WHERE checkbox = 'X'.


  endloop.

I would like to update the selected material numbers to the select option.

Kesav

0 Kudos

Hello Keshav,

Not sure why you've used REUSE_ALV_POPUP_TO_SELECT. You can achieve the same by turning on the MULTIPLE_CHOICE param in F4IF_INT_TABLE_VALUE_REQUEST. Check this code snippet:

DATA: v_field TYPE fieldname.

SELECT-OPTIONS: s_field FOR v_field NO INTERVALS.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'S_FIELD-LOW'.
      screen-input = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_field-low.

* Local type declarations
  TYPES : BEGIN OF t_flds,
    tabname   TYPE dfies-tabname,
    fieldname TYPE dfies-fieldname,
    keyflag   TYPE dfies-keyflag,
    fieldtext TYPE dfies-fieldtext,
  END OF t_flds.

  CONSTANTS: lc_field TYPE fieldname  VALUE 'FIELDNAME'.

* Local data declarations
  DATA:
        ls_flds TYPE t_flds,
        lt_flds TYPE STANDARD TABLE OF t_flds,
        ls_values TYPE ddshretval,
        lt_values TYPE STANDARD TABLE OF ddshretval,
        lt_dfies TYPE TABLE OF dfies,
        ls_dfies TYPE dfies.

* Get field details of the Table
  CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      tabname        = 'MARC'
      langu          = sy-langu
    TABLES
      dfies_tab      = lt_dfies
    EXCEPTIONS
      not_found      = 1
      internal_error = 2
      OTHERS         = 3.
  IF sy-subrc = 0.
    LOOP AT lt_dfies  INTO ls_dfies WHERE fieldname NE 'MANDT'.
      MOVE-CORRESPONDING ls_dfies TO ls_flds.
      APPEND ls_flds TO lt_flds.
    ENDLOOP.
  ELSE.
    EXIT.
  ENDIF.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = lc_field
      window_title    = 'Select the Table Field'(001)
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'S_FIELD-LOW'
      value_org       = 'S'
      multiple_choice = 'X'
      display         = 'F'
    TABLES
      value_tab       = lt_flds
      return_tab      = lt_values.

  s_field-sign    = 'I'.
  s_field-option  = 'EQ'.

  LOOP AT lt_values INTO ls_values .
    s_field-low = ls_values-fieldval.
    APPEND s_field.
  ENDLOOP.

  DATA: lt_dynpread   TYPE STANDARD TABLE OF dynpread,
        lwa_dynpread  TYPE dynpread.

  READ TABLE s_field INDEX 1.
  IF sy-subrc = 0.
    lwa_dynpread-fieldname  = 'S_FIELD-LOW'.
    lwa_dynpread-fieldvalue = s_field-low.
    APPEND lwa_dynpread TO lt_dynpread.

*  Update the screen field values
    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        dyname               = sy-repid
        dynumb               = sy-dynnr
      TABLES
        dynpfields           = lt_dynpread
      EXCEPTIONS
        invalid_abapworkarea = 1
        invalid_dynprofield  = 2
        invalid_dynproname   = 3
        invalid_dynpronummer = 4
        invalid_request      = 5
        no_fielddescription  = 6
        undefind_error       = 7
        OTHERS               = 8.
    IF sy-subrc NE 0.

    ENDIF.

  ENDIF.

Hope this helps.

BR,

Suhas

Former Member
0 Kudos

Hi,

DYNP_VALUES_UPDATE doesn't seem to add more than one value to the select option/parameter.

Please check this code.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

.

.

.

LOOP AT it INTO wa WHERE checkbox = 'X'.

at first.

read table it into wa index sy-tabix.

v_fieldvalue = wa-MATNR.

endat.

S_MAT-sign = 'I'.

S_MAT-option = 'EQ'.

S_MAT-LOW = wa-MATNR.

append S_MAT.

clear S_MAT.

at last .

S_MAT-sign = 'I'.

S_MAT-option = 'EQ'.

S_MAT-LOW = v_fieldvalue.

append S_MAT.

clear S_MAT.

endat.

sort S_MAT.

endloop.

Regards,

Srini.

0 Kudos

HI Suhas,

Thanks... That sounds promising

But i have to do smoe more addition to it . I need the value of column 1 to one range table and value of column 2 to the screen field . Let me check.