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

Search help multiple values selection problem

Azeemquadri
Contributor
0 Kudos
1,549

Hello Friends,

I am using FM f4_if_int_table_value_request FM to display multiple values on selection screen

in AT-selection-screen on value request event.

Multiple values are getting displayed perfectly .

Then after that I am using DYNP_VALUES_UPDATE FM to return the values back to screen.

But the problem is in the select-option field . It only picks the last value selected.

I have a row:

I EQ 'last value selected from F4 help screen''.

Is there a way to update multiple rows in the select option selection screen field.

Thanks.

4 REPLIES 4
Read only

Former Member
0 Kudos
595

Hi Abdul,

instead of using DYNP_VALUES_READ to populate the data into the select-options, please try to populate the select-options table instead.

For example, if the name of the select-options is S_SEL, then:


loop at result_table_from_f4.
  s_sel-sign = 'I'.
  s_sel-option = 'EQ'.
  s_sel-low = value_from_result_table.
  clear s_sel-high.
  append s_sel.
endloop.

I hope this helps. Kind regards,

Alvaro

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
595

Hello,

This code snippet should work. But to display the three values you have to press enter, this will trigger the PBO & the data will be updated in the screen.

TABLES spfli.

SELECT-OPTIONS:
s_carrid FOR spfli-carrid.

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

  TYPES: t_return_tab  TYPE ddshretval.

  TYPES: BEGIN OF ty_line,
    carrid   TYPE spfli-carrid,
    carrname TYPE scarr-carrname,
  END OF ty_line.

  DATA: it_list TYPE STANDARD TABLE OF ty_line,
        wa_return_tab TYPE t_return_tab,
        i_return_tab TYPE STANDARD TABLE OF t_return_tab,
        v_repid TYPE sy-repid,
        v_dynnr TYPE sy-dynnr.

  v_repid = sy-repid.
  v_dynnr = sy-dynnr.

  SELECT carrid carrname
  FROM scarr
  INTO TABLE it_list.

  IF sy-subrc = 0.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield        = 'CARRID'
        dynpprog        = v_repid
        dynpnr          = v_dynnr
        dynprofield     = 'S_CARRID-LOW'
        value_org       = 'S'
        multiple_choice = 'X'
      TABLES
        value_tab       = it_list
        return_tab      = i_return_tab
      EXCEPTIONS
        parameter_error = 1
        no_values_found = 2
        OTHERS          = 3.
    IF sy-subrc = 0.
      s_carrid-sign = 'I'.
      s_carrid-option = 'EQ'.
      LOOP AT i_return_tab INTO wa_return_tab.
        s_carrid-low = wa_return_tab-fieldval.
        APPEND s_carrid.
      ENDLOOP.

      READ TABLE s_carrid INDEX 1.
    ENDIF.
  ENDIF.

I am not sure if there is any alternate technique to this.

BR,

Suhas

Read only

Former Member
0 Kudos
595

Hi Suhas,

you may try the following:


TABLES spfli.

SELECT-OPTIONS: s_carrid FOR spfli-carrid.

SELECTION-SCREEN: PUSHBUTTON /1(20) but1 USER-COMMAND carr.

INITIALIZATION.
  but1 = 'Choose CARRID(s)'.

AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'CARR'.
      TYPES: t_return_tab  TYPE ddshretval.

      TYPES: BEGIN OF ty_line,
        carrid   TYPE spfli-carrid,
        carrname TYPE scarr-carrname,
      END OF ty_line.

      DATA: it_list TYPE STANDARD TABLE OF ty_line,
            wa_return_tab TYPE t_return_tab,
            i_return_tab TYPE STANDARD TABLE OF t_return_tab,
            v_repid TYPE sy-repid,
            v_dynnr TYPE sy-dynnr.

      v_repid = sy-repid.
      v_dynnr = sy-dynnr.

      SELECT carrid carrname
      FROM scarr
      INTO TABLE it_list.

      IF sy-subrc = 0.

        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield        = 'CARRID'
            dynpprog        = v_repid
            dynpnr          = v_dynnr
*        dynprofield     = 'S_CARRID-LOW'
            value_org       = 'S'
            multiple_choice = 'X'
          TABLES
            value_tab       = it_list
            return_tab      = i_return_tab
          EXCEPTIONS
            parameter_error = 1
            no_values_found = 2
            OTHERS          = 3.
        IF sy-subrc = 0.
          s_carrid-sign = 'I'.
          s_carrid-option = 'EQ'.
          LOOP AT i_return_tab INTO wa_return_tab.
            s_carrid-low = wa_return_tab-fieldval.
            APPEND s_carrid.
          ENDLOOP.

          READ TABLE s_carrid INDEX 1.
        ENDIF.
      ENDIF.

  ENDCASE.

What I have done is:

- not linking the result of the F4 search to field S_CARRID-LOW

- inserting this F4 search into event AT SELECTION SCREEN. This allows to see the select-options filled when its contents are actually populated.

I hope this helps. Kind regards,

Alvaro

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
595

HI Alvaro,

Nice way of tricking SAP

But i dont think this looks good to the eyes. I would rather hit an enter after selecting data from the F4 help.

Cheers,

Suhas