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

creating serach help programitically.

Former Member
0 Likes
699

Hi abapers,

Is it possible to create a serach help programitically say by using FM

F4IF_INT_TABLE_VALUE_REQUEST in a se38 program

and then attaching it to a field of a custom z table ?

regards,

Aditya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
673

Hi,

try like this...


 PERFORM read_dynprofield USING 'YSAFE_STK_INS-WERKS'
                               CHANGING ysafe_stk_ins-werks.

    SELECT  DISTINCT
             a~matnr
             b~maktx
             INTO CORRESPONDING FIELDS OF TABLE it_help1
             FROM ysafe_stk_ins AS a
             INNER JOIN makt AS b
             ON a~matnr = b~matnr
             WHERE a~werks EQ ysafe_stk_ins-werks.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield        = 'MATNR'
        dynpprog        = sy-repid
        dynpnr          = sy-dynnr
        dynprofield     = 'YSAFE_STK_INS-WERKS'
        value_org       = 'S'
      TABLES
        value_tab       = it_help1
      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.


*&---------------------------------------------------------------------*
*&      Form  READ_DYNPROFIELD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FIELDNAME  text
*      <--P_VALUE  text
*----------------------------------------------------------------------*
FORM read_dynprofield  USING    p_fieldname
                       CHANGING p_value.

  DATA it_dynfield4 TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-repid
      dynumb               = sy-dynnr
      request              = 'A'
      translate_to_upper   = 'X'
    TABLES
      dynpfields           = it_dynfield4
    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 it_dynfield4 WITH KEY fieldname = p_fieldname.

  p_value = it_dynfield4-fieldvalue.

ENDFORM.                    " READ_DYNPROFIELD

Arunima

4 REPLIES 4
Read only

Former Member
0 Likes
673

Hi,,,,,

Yes aditya It can be done By BDC,,,, Just do the recording of creating the search Help,, and then create it,,,,,

Thanks

saurabh

Read only

former_member195383
Active Contributor
0 Likes
673

u can call

CALL FUNCTION 'DYNP_VALUES_READ' to collect the tb_dynpfields from dynpfields under the tables section of FM.This way you read dynamically the value of one field say wf_field2.

Using tb_dynpfields-fieldvalue you can fetch the required values from the data base that u wanna use in the search help.

then call the FM.

F4IF_INT_TABLE_VALUE_REQUEST, using those values..Your search help will come bases on the entries of the other field wf_field2

That will help u out

Regards

Rudra

Read only

Former Member
0 Likes
674

Hi,

try like this...


 PERFORM read_dynprofield USING 'YSAFE_STK_INS-WERKS'
                               CHANGING ysafe_stk_ins-werks.

    SELECT  DISTINCT
             a~matnr
             b~maktx
             INTO CORRESPONDING FIELDS OF TABLE it_help1
             FROM ysafe_stk_ins AS a
             INNER JOIN makt AS b
             ON a~matnr = b~matnr
             WHERE a~werks EQ ysafe_stk_ins-werks.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield        = 'MATNR'
        dynpprog        = sy-repid
        dynpnr          = sy-dynnr
        dynprofield     = 'YSAFE_STK_INS-WERKS'
        value_org       = 'S'
      TABLES
        value_tab       = it_help1
      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.


*&---------------------------------------------------------------------*
*&      Form  READ_DYNPROFIELD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FIELDNAME  text
*      <--P_VALUE  text
*----------------------------------------------------------------------*
FORM read_dynprofield  USING    p_fieldname
                       CHANGING p_value.

  DATA it_dynfield4 TYPE STANDARD TABLE OF dynpread WITH HEADER LINE.
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-repid
      dynumb               = sy-dynnr
      request              = 'A'
      translate_to_upper   = 'X'
    TABLES
      dynpfields           = it_dynfield4
    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 it_dynfield4 WITH KEY fieldname = p_fieldname.

  p_value = it_dynfield4-fieldvalue.

ENDFORM.                    " READ_DYNPROFIELD

Arunima

Read only

0 Likes
673

Hi,

also you can use the extension matchcode object for parameters and select-options for creating search helps for the particular screen fields( if you are talking about creating about selection-screen fields)

Regards,

Manjista.