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: 

automatic population of search help value to another field in module pool

Former Member
0 Kudos

Hello there,

I am developing a module pool screen, in which i have a table control field with fields PERNR and ARBPL along with other fields.

I have to give a search help for Pernr first field for which i have given a search help with the use of PM02 search help, given in the screen field level, in the same search help there is another field ARBPL, when the pernr is selected i have to get the corresponding Arbpl field value in the search help hit list and pass it to my field arbpl in my table control.

I tried with POV event as well with FM f4if_field_value_request but the return structure always filling one value only PERNR.

Is there any chance to get the both field values from the search help.

Thank you in advance.

Regards,

Kumar.

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

Try the following logic in your table control, in table control you have get the selected index using function DYNP_GET_STEPL.


TYPE-POOLS: shlp.

PARAMETERS:p_matnr TYPE marc-matnr,
           p_werks TYPE marc-werks,
           p_ekgrp type marc-ekgrp.

TYPES:BEGIN OF ty_marc,
      matnr TYPE marc-matnr,
      werks TYPE marc-werks,
      ekgrp TYPE marc-ekgrp,
      END OF ty_marc.

DATA:i_marc TYPE TABLE OF ty_marc,
     i_val TYPE TABLE OF ddshretval,
     wa_val TYPE ddshretval.
DATA:wa_dynpfields TYPE dynpread,
    i_dynpfields LIKE STANDARD TABLE OF dynpread.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

  SELECT matnr werks ekgrp FROM marc INTO TABLE i_marc UP TO 100 ROWS.

  CHECK i_marc[] IS NOT INITIAL.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield         = 'MATNR'
      value_org        = 'S'
      callback_program = sy-repid
      callback_form    = 'CALLBACK_ROUTINE'
      dynpnr           = sy-dynnr
    TABLES
      value_tab        = i_marc
      return_tab       = i_val
    EXCEPTIONS
      parameter_error  = 1
      no_values_found  = 2
      OTHERS           = 3.
  IF sy-subrc  <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  LOOP AT i_val INTO wa_val.
    IF sy-tabix = 1.
      wa_dynpfields-fieldname    = 'P_MATNR'.
      wa_dynpfields-fieldvalue   = wa_val-fieldval.
    ELSEIF sy-tabix = 2.
      wa_dynpfields-fieldname    = 'P_WERKS'.
      wa_dynpfields-fieldvalue   = wa_val-fieldval.
    ELSEIF sy-tabix = 3.
      wa_dynpfields-fieldname    = 'P_EKGRP'.
      wa_dynpfields-fieldvalue   = wa_val-fieldval.
    ENDIF.
    APPEND wa_dynpfields TO i_dynpfields.
  ENDLOOP.

  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname     = sy-repid
      dynumb     = sy-dynnr
    TABLES
      dynpfields = i_dynpfields.

FORM callback_routine TABLES i_val TYPE ddshreslts
            CHANGING wa_shlp TYPE shlp_descr
                     wa_callcontrol LIKE ddshf4ctrl.
  DATA:
    wa_intf     LIKE LINE OF wa_shlp-interface.

  wa_intf-shlpfield = 'F0002'.
  wa_intf-valfield  = 'X'.
  wa_intf-f4field = 'X'.
  wa_intf-value = '~'.
  APPEND wa_intf TO wa_shlp-interface.

  wa_intf-shlpfield = 'F0003'.
  wa_intf-valfield  = 'X'.
  wa_intf-f4field = 'X'.
  wa_intf-value = '~'.
  APPEND wa_intf TO wa_shlp-interface.

ENDFORM.                    " CALLBACK_F4

4 REPLIES 4

kesavadas_thekkillath
Active Contributor
0 Kudos

Try the following logic in your table control, in table control you have get the selected index using function DYNP_GET_STEPL.


TYPE-POOLS: shlp.

PARAMETERS:p_matnr TYPE marc-matnr,
           p_werks TYPE marc-werks,
           p_ekgrp type marc-ekgrp.

TYPES:BEGIN OF ty_marc,
      matnr TYPE marc-matnr,
      werks TYPE marc-werks,
      ekgrp TYPE marc-ekgrp,
      END OF ty_marc.

DATA:i_marc TYPE TABLE OF ty_marc,
     i_val TYPE TABLE OF ddshretval,
     wa_val TYPE ddshretval.
DATA:wa_dynpfields TYPE dynpread,
    i_dynpfields LIKE STANDARD TABLE OF dynpread.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

  SELECT matnr werks ekgrp FROM marc INTO TABLE i_marc UP TO 100 ROWS.

  CHECK i_marc[] IS NOT INITIAL.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield         = 'MATNR'
      value_org        = 'S'
      callback_program = sy-repid
      callback_form    = 'CALLBACK_ROUTINE'
      dynpnr           = sy-dynnr
    TABLES
      value_tab        = i_marc
      return_tab       = i_val
    EXCEPTIONS
      parameter_error  = 1
      no_values_found  = 2
      OTHERS           = 3.
  IF sy-subrc  <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  LOOP AT i_val INTO wa_val.
    IF sy-tabix = 1.
      wa_dynpfields-fieldname    = 'P_MATNR'.
      wa_dynpfields-fieldvalue   = wa_val-fieldval.
    ELSEIF sy-tabix = 2.
      wa_dynpfields-fieldname    = 'P_WERKS'.
      wa_dynpfields-fieldvalue   = wa_val-fieldval.
    ELSEIF sy-tabix = 3.
      wa_dynpfields-fieldname    = 'P_EKGRP'.
      wa_dynpfields-fieldvalue   = wa_val-fieldval.
    ENDIF.
    APPEND wa_dynpfields TO i_dynpfields.
  ENDLOOP.

  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname     = sy-repid
      dynumb     = sy-dynnr
    TABLES
      dynpfields = i_dynpfields.

FORM callback_routine TABLES i_val TYPE ddshreslts
            CHANGING wa_shlp TYPE shlp_descr
                     wa_callcontrol LIKE ddshf4ctrl.
  DATA:
    wa_intf     LIKE LINE OF wa_shlp-interface.

  wa_intf-shlpfield = 'F0002'.
  wa_intf-valfield  = 'X'.
  wa_intf-f4field = 'X'.
  wa_intf-value = '~'.
  APPEND wa_intf TO wa_shlp-interface.

  wa_intf-shlpfield = 'F0003'.
  wa_intf-valfield  = 'X'.
  wa_intf-f4field = 'X'.
  wa_intf-value = '~'.
  APPEND wa_intf TO wa_shlp-interface.

ENDFORM.                    " CALLBACK_F4

Former Member
0 Kudos

Hi,

I want to know if there is another solution because i have a same problem but i use specific search help with view not an internal table

Thanks

0 Kudos

Hello,

Thanks guys, I solved it my self.

I have used F4IF_INT_TABLE_VALUE_REQUEST FM and passed the two fields to be filled with the search help to DYNPFLD_MAPPING parameter.

so the same search help now populating values in to two fields.

Regards,

Kumar.

0 Kudos

SIMO - please stop spamming the forum with meaningless ok's.

Rob