Skip to Content
0

How to control Import parameter of search help

Mar 21, 2017 at 12:18 PM

154

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded

It should work. What did you try exactly ?

0
Former Member

capture.png

Hi,

when i enter 'US' in land field so , the relevant Customer should be visible in in search help of KUNNR .

capture.png (2.1 kB)
0
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Sandra Rossi Mar 30, 2017 at 05:05 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Kali Charan Mar 28, 2017 at 07:28 AM
0

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


searchelp.png (62.5 kB)
Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

capture.png

Hi,

when i enter 'US' in land field so , the relevant Customer should be visible in in search help of KUNNR .

capture.png (2.1 kB)
0

It is better first put

Land1
then kunnr

you need to use

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

Generate a query in it. then add the values. It hope you understood.

Lot of examples are there in here. Check it. But process is what i told you above.

0

You don't need to use F4IF_INT_TABLE_VALUE_REQUEST, you may use it. You can also do it without ABAP code, based on search help built-in features. See my answer.

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

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

Share
10 |10000 characters needed characters left characters exceeded
Mangesh Parihar Apr 17, 2017 at 07:30 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded