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 Option:Update LOW & HIGH fields on F4

former_member184739
Contributor
0 Kudos

Dear Experts,

I am trying to update Select-Options Ranges when F4 is Chosen.On choosing F4 i display a popup with options to select range of accounts using FM:F4IF_INT_TABLE_VALUE_REQUEST. I tried to update(DYNP_VALUES_UPDATE)  but its not working.

Can you please guide me how to update the Select option ranges?

Your help is highly appreciated.

Thanks.

Prabaharan  

 

1 ACCEPTED SOLUTION

former_member15255
Active Participant
0 Kudos

Hello Prabaharan,

After selecting the values from F4 help you need to set it to the respective selection option high and low. following example would help you out.

tables ekko.

select-options s_ebeln for ekko-ebeln.

at selection-screen on value-request for s_ebeln-low.

   perform f4_values changing s_ebeln-low.

at selection-screen on value-request for s_ebeln-high.

   perform f4_values changing s_ebeln-high.

form f4_values changing s_ret_ebeln type ebeln.

   data : it_ekko type standard table of ekko,

          it_return  like ddshretval occurs 0 with header line.

   select  *

     from ekko

     into table it_ekko

     up to 10 rows.

   call function 'F4IF_INT_TABLE_VALUE_REQUEST'

     exporting

       retfield        = 'EBELN'

       dynpprog        = sy-cprog

       value_org       = 'S'

     tables

       value_tab       = it_ekko

       return_tab      = it_return

     exceptions

       parameter_error = 1

       no_values_found = 2

       others          = 3.


       s_ret_ebeln     = it_return-fieldval.

endform.                                                    " F4_VALUES

11 REPLIES 11

former_member205060
Active Participant
0 Kudos

Hi ,

Kindly check this link.

https://scn.sap.com/thread/928071

You can find many links on SCN regarding your problem.

Regards,

Rahul Singh

0 Kudos

Kindly close your post if answered.

0 Kudos

Hello Rahul,

Reference you have given works for updating single values but not for Ranges.Please suggest.

On choosing F4 if we choose two entries then G/L  from should update in SO_GL-LOW  and G/L TO should update in SO_GL-HIGH.  Please correct if i am wrong.

I will close the Post for sure.

Thanks

Prabaharan

former_member15255
Active Participant
0 Kudos

Hello Prabaharan,

After selecting the values from F4 help you need to set it to the respective selection option high and low. following example would help you out.

tables ekko.

select-options s_ebeln for ekko-ebeln.

at selection-screen on value-request for s_ebeln-low.

   perform f4_values changing s_ebeln-low.

at selection-screen on value-request for s_ebeln-high.

   perform f4_values changing s_ebeln-high.

form f4_values changing s_ret_ebeln type ebeln.

   data : it_ekko type standard table of ekko,

          it_return  like ddshretval occurs 0 with header line.

   select  *

     from ekko

     into table it_ekko

     up to 10 rows.

   call function 'F4IF_INT_TABLE_VALUE_REQUEST'

     exporting

       retfield        = 'EBELN'

       dynpprog        = sy-cprog

       value_org       = 'S'

     tables

       value_tab       = it_ekko

       return_tab      = it_return

     exceptions

       parameter_error = 1

       no_values_found = 2

       others          = 3.


       s_ret_ebeln     = it_return-fieldval.

endform.                                                    " F4_VALUES

0 Kudos

Hello Suresh,

I am trying to update both LOW & HIGH when choosing F4.But as per your suggestion we must choose individully.

Thanks

Prabaharan

0 Kudos

Hi Prabharan,

if you are confident that select singles , exclude ranges and exclude singles are not used then

you can use the values Return_tab parameter of F4IF_INT_TABLE_VALUE_REQUEST,

and then Append those values to select option table assigning values to

SO_GL-LOW  and G/L TO

using the sigh = 'I' and Option ='BT'.

Try for it. It will definatly work.

Note: do not pass any values to exporting parameters :

DYNPPROG

DYNPNR

DYNPROFIELD .


Former Member
0 Kudos

Hi Prabaharan,

I hope following code will work out for you.

SELECTION-SCREEN begin of block balance with frame title  text-001.
   PARAMETERS      : p_bukrs type bkpf-bukrs.
   SELECT-OPTIONS : s_segmt for bseg-segment.
  SELECTION-SCREEN end of block balance.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_segmt-low.
PERFORM F4_HELP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_segmt-high.
PERFORM F4_HELP.


FORM F4_HELP.
     refresh it_dynpfields.

     wa_dynpfields-fieldname = 'P_BUKRS'.
     Append wa_dynpfields to it_dynpfields.

     CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
         DYNAME                               = sy-repid
         DYNUMB                               = sy-dynnr

     TABLES
         DYNPFIELDS                           = it_dynpfields


     READ TABLE it_dynpfields into wa_dynpfields with key fieldname = 'P_BUKRS'.

     Select segment
               name
              into table it_segment
              from FAGL_SEGMT.

     loop at it_segment into wa_segment.
       condense wa_segment-segment.
            if  not wa_segment-segment+6(2) = wa_dynpfields-fieldvalue+0(2).
              delete table it_segment from wa_segment.
            endif.
     endloop.

     CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
*       DDIC_STRUCTURE         = ''
         RETFIELD               = 'SEGMENT'
*       PVALKEY                = ' '
         DYNPPROG               = sy-repid
         DYNPNR                 = sy-dynnr
         DYNPROFIELD            = 'S_SEGMT'
*       STEPL                  = 0
         WINDOW_TITLE           = 'Segments'
*       VALUE                  = ' '
         VALUE_ORG              = 'S'

TABLES
         VALUE_TAB              = it_segment
*        FIELD_TAB              = lt_field
         RETURN_TAB             = it_return


ENDFORM.


former_member205060
Active Participant
0 Kudos

Hi you can use the below mention code taken from this link

http://scn.sap.com/thread/1946714

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.

Regards,

Rahul Singh

0 Kudos

Hello Rahul,

Code you have suggested will work for Single values . But it wont work for Ranges.

Thanks.

0 Kudos

This message was moderated.

0 Kudos

Hi,

The other option you can try is to debug the code and during the selection of the F4 values update the Field-high value manually by picking the index value of your proposed value_tab to return_tab.

Regards,

Rahul Singh