Skip to Content

How to control Import parameter of search help

Hello Friends,

I have a confusion about search help import parameter,

suppose, i have two fields in my search help zshlp_kna1 ( kunnr and land1) and both have import and export parameter value checked,

now how can we use this import parameter value in our program , like if i select land1 as 'US' in input field in my abap program , so only respective kunnr should be display in search help for KUNNR input field.

Thanks in advance

Vikash

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Mar 30, 2017 at 05:05 AM

    The principle of multiple input fields used in a search help, is to type the screen fields according to a DDIC structure. No other way if you want to use the principle of search helps.

    Say you call the DDIC structure Z_CUSTOMER_SHLP. It has fields KUNNR and LAND1. The field LAND1 must be attached to the search help ZSHLP_KNA1 and you link both structure fields to both importing/exporting fields of your search help (declare both fields importing and exporting). Do the same thing for KUNNR.

    In your selection screen, do :

    PARAMETERS p_kunnr TYPE z_customer_shlp-kunnr.

    PARAMETERS p_land1 TYPE z_customer_shlp-land1.

    Nothing else.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 28, 2017 at 07:28 AM

    Question did not understood. obviously If you give 'US' then 'US' Value comes.

    total search help values like

    kunna1 land1

    one US
    two US
    three US
    Four IN

    If you give US then, the below data will comes. This is natural search help behavior.

    kunna1 land1

    one US

    two US
    three US

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 30, 2017 at 07:08 AM

    Hi Vikash Pathak,

    Using module pool program create a screen fields with two inputs with help.I have considered material number and plant.created module in screen painter i.e in flow logic in PAI. I have used finction modules DYNP_VALUES_READ and F4IF_INT_TABLE_VALUE_REQUEST.

    I think the following code will be helpful for your scenario.

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

    TYPES:BEGIN OF ty_marc,

    matnr TYPE matnr, "Material Number

    werks TYPE werks_d, "Plant

    END OF ty_marc.

    DATA:lt_marc TYPE TABLE OF ty_marc,

    gs_marc TYPE ty_marc.

    DATA:lt_return TYPE TABLE OF ddshretval, "Interface Structure Search Help

    gs_return TYPE ddshretval.

    DATA:lt_dynpfields TYPE TABLE OF dynpread, "Fields of the current screen (with values)

    gs_dynpfields TYPE dynpread.

    DATA:gv_werks TYPE marc-werks.

    START-OF-SELECTION.

    CALL SCREEN 9000.

    DATA: p_werks TYPE werks_d,

    p_matnr TYPE matnr.

    INITIALIZATION.

    REFRESH lt_marc.

    CLEAR gs_marc.

    REFRESH lt_dynpfields.

    REFRESH lt_return.

    *&---------------------------------------------------------------------*

    *&Module search_help INPUT

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    MODULE search_help INPUT.

    gs_dynpfields-fieldname = 'P_WERKS'.

    APPEND gs_dynpfields TO lt_dynpfields.

    CLEAR gs_dynpfields.

    CALL FUNCTION 'DYNP_VALUES_READ' "Read screen field values before PAI field transport

    EXPORTING

    dyname = sy-repid

    dynumb = sy-dynnr

    TABLES

    dynpfields = lt_dynpfields

    EXCEPTIONS

    invalid_abapworkarea = 1

    invalid_dynprofield = 2

    invalid_dynproname = 3

    invalid_dynpronummer = 4

    invalid_request = 5

    no_fielddescription = 6

    invalid_parameter = 7

    undefind_error = 8

    double_conversion = 9

    stepl_not_found = 10

    OTHERS = 11

    .

    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 lt_dynpfields INTO gs_dynpfields

    WITH KEY fieldname = 'P_WERKS'.

    IF sy-subrc = 0.

    gv_werks = gs_dynpfields-fieldvalue.

    SELECT matnr

    werks FROM marc INTO TABLE lt_marc

    WHERE werks = gv_werks.

    IF sy-subrc = 0.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = 'MATNR'

    value_org = 'S'

    TABLES

    value_tab = lt_marc

    return_tab = lt_return

    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.

    ENDIF.

    ENDIF.

    ENDMODULE." search_help INPUT

    *&---------------------------------------------------------------------*

    *&Module STATUS_9000 OUTPUT

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    MODULE status_9000 OUTPUT.

    SET PF-STATUS 'PBO_9000'.

    * SET TITLEBAR 'xxx'.

    CASE sy-ucomm.

    WHEN 'BACK'.

    LEAVE PROGRAM.

    ENDCASE.

    ENDMODULE." STATUS_9000 OUTPUT

    *&---------------------------------------------------------------------*

    *&Module user_command_9000 INPUT

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    module user_command_9000 input.

    ifp_werks is INITIAL.

    MESSAGE 'Please enter the value' TYPE 'E'.

    ENDIF.

    endmodule. " user_command_9000 INPUT

    Thanks and regards.

    Venkatakrishnan Lakshmanan

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 17, 2017 at 07:30 AM

    Hi Vikash,

    Check out the following code.

    TYPES: BEGIN OF ty_land1,
           kunnr TYPE kna1-kunnr,
           land1 TYPE kna1-land1,
           END OF ty_land1.
    *--------------------------------------------------------------*
    *Data Declaration
    *--------------------------------------------------------------*
    DATA: gwa_land1      TYPE ty_land1,
          gt_land1       TYPE TABLE OF ty_land1.
    DATA: gt_return      TYPE TABLE OF ddshretval,
          gwa_return     TYPE ddshretval.
    DATA: gwa_dynpfields TYPE dynpread,
          gt_dynpfields  TYPE TABLE OF dynpread.
    DATA: gv_land1       TYPE kna1-land1.
    *--------------------------------------------------------------*
    *Selection-Screen
    *--------------------------------------------------------------*
    PARAMETERS: p_land1 TYPE kna1-land1 OBLIGATORY.
    PARAMETERS: p_kunnr TYPE kna1-kunnr.
    *--------------------------------------------------------------*
    *Selection-Screen on Value-Request
    *--------------------------------------------------------------*
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_kunnr.
      REFRESH gt_dynpfields.
      gwa_dynpfields-fieldname = 'P_LAND1'.
      APPEND gwa_dynpfields TO gt_dynpfields.
    *Get plant value on the selection screen
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = sy-repid
          dynumb               = sy-dynnr
        TABLES
          dynpfields           = gt_dynpfields
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      READ TABLE gt_dynpfields INTO gwa_dynpfields
             WITH KEY fieldname = 'P_LAND1'.
      IF sy-subrc = 0.
        gv_land1 = gwa_dynpfields-fieldvalue.
      ENDIF.
    *Get values from the database based on plant
      SELECT kunnr
             land1
             UP TO 10 ROWS
             INTO TABLE gt_land1
             FROM kna1
             WHERE land1 = gv_land1.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'KUNNR'
          value_org       = 'S'
        TABLES
          value_tab       = gt_land1
          return_tab      = gt_return
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      READ TABLE gt_return INTO gwa_return INDEX 1.
      IF sy-subrc = 0.
        p_kunnr = gwa_return-fieldval.
      ENDIF.

    Hope it helps.

    Regards,

    Mangesh

    Add comment
    10|10000 characters needed characters exceeded