Sunday, April 7, 2013

How to add search help to selection parameter?

I was looking for help to add search help in selection parameter. But I didn't find any simple one to understand for a newbie like me. So I am going to explain for the beginner how to add search help in selection parameter.

In my previous post I have shown how to create search help. Now I will use that one.

DATA:  it_return TYPE STANDARD TABLE OF ddshretval,
            wa_return LIKE LINE OF it_return.

PARAMETERS: p_traid TYPE likp-traid.

Go to AT SELECTION-SCREEN.
Change the line  AT SELECTION-SCREEN ON VALUE-REQUEST FOR  p_traid.

Now call FM F4IF_FIELD_VALUE_REQUEST

  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname                   = 'likp'
      fieldname                 = 'TRAID'
      searchhelp                = 'ZTRAID'
   TABLES
     return_tab                =  it_return[]
   EXCEPTIONS
     field_not_found           = 1
     no_help_for_field        = 2
     inconsistent_help         = 3
     no_values_found          = 4
     OTHERS                    = 5          .
  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 it_return table data and assign to the parameter.

IF sy-subrc EQ 0.
    READ TABLE it_return  INTO wa_return INDEX 1.
    p_traid = wa_return-fieldval.
  ENDIF. 

Now it will work :).

Thanks
Rizvi :)

No comments:

Post a Comment

UA-40152711-1