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

Problem with Search help selection

Former Member
0 Likes
3,316

Hi,

I have added a search help for a standard field in PR which is made mandatory. Search help provides facility to select a valid user from the list.When user selects a value it gets saved without any issues.But when I close the search help without selecting any value the incorrect value gets saved in the PR.

I have written the validation in BADI ME_PROCESS_REQ_CUST and the search help function module in an include program.

I need this validation to happen even before saving. Could anyone assist me on this please.

1 ACCEPTED SOLUTION
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
2,078

Hello Rekha.

     Did you clear the search help return variable before each call?

     If you had used the function module F4IF_INT_TABLE_VALUE_REQUEST for the search help, then you can find out if end-user had selected a value or not using the return internal table RETURN_TAB.

Regards.

6 REPLIES 6
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
2,079

Hello Rekha.

     Did you clear the search help return variable before each call?

     If you had used the function module F4IF_INT_TABLE_VALUE_REQUEST for the search help, then you can find out if end-user had selected a value or not using the return internal table RETURN_TAB.

Regards.

Read only

0 Likes
2,078

Hi Arun,

Thanks for the reply.I am using F4IF_FIELD_VALUE_REQUEST and have an internal table in RETURN_TAB. Where do I have to clear the return_tab, just before the call to the FM?

Regards

Read only

0 Likes
2,078

Rekha,

     Clear[] the internal table(RETURN_TAB) just before calling the FM.

     That internal table will be filled with value chosen by user.

Read only

0 Likes
2,078

Hii Rekha,

refresh the return_tab itab before calling the FM F4IF_FIELD_VALUE_REQUEST and debug the code.This FM have only one tables parameter as return_tab

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

       EXPORTING

         tabname                   = 'ZAPT_05ACCNT'

         fieldname                 = 'ACNTNO'

*        SEARCHHELP                = ' '

*        SHLPPARAM                 = ' '

        DYNPPROG                  = sy-repid
        DYNPNR                    = sy-dynnr
*        DYNPROFIELD               = ' '
*        STEPL                     = 0
*        VALUE                     = ' '
*        MULTIPLE_CHOICE           = ' '
*        DISPLAY                   = ' '
*        SUPPRESS_RECORDLIST       = ' '
*        CALLBACK_PROGRAM          = ' '
*        CALLBACK_FORM             = ' '
*        CALLBACK_METHOD           =
*        SELECTION_SCREEN          = ' '
*      IMPORTING
*        USER_RESET                =

      TABLES
        RETURN_TAB                = t_rtn -------->type DDSHRETVAL.

      EXCEPTIONS
        FIELD_NOT_FOUND           = 1
        NO_HELP_FOR_FIELD         = 2
        INCONSISTENT_HELP         = 3
        NO_VALUES_FOUND           = 4
        OTHERS                    = 5
               .
     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.

So betterTry to use FM F4IF_INT_TABLE_VALUE_REQUEST  may it help u

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

        retfield        = 'ACNTNO'  ------->for which field u want the dynamic search help should be same as table field name

        dynpprog        = sy-repid

        dynpnr          = sy-dynnr

        dynprofield     = 'P_ANO'     ----->parameters name

*       window_title    = 'Selection screen'

*       VALUE           = ' '

        value_org       = 'C'  ----------->C displayed as cell by cell S as structure

      TABLES

        value_tab       = t_f4 ------------->internal table having data to be displayed in search help

        field_tab       = t_ft ------------->field internal table

        return_tab      = t_rtn     ------------->return table

        dynpfld_mapping = t_dd  --------internal table for dynamic field mapping

      EXCEPTIONS

        parameter_error = 1

        no_values_found = 2

        OTHERS          = 3.

    IF sy-subrc <> 0.

      EXIT.

    ENDIF.

regards

Syed

Read only

Former Member
0 Likes
2,078

"Declaring Types

TYPES: BEGIN OF ty_field,
        carrid TYPE ZCARRID,    "This is table created by me
        connid TYPE zconnid,     "This is table created by me
       END OF ty_field.


"Declaring Internal Table

DATA :t_rtn TYPE STANDARD TABLE OF ddshretval ,
      t_field TYPE STANDARD TABLE OF ty_field.



"Declaring Workarea
DATA :x_rtn TYPE ddshretval.


SELECTION-SCREEN BEGIN OF BLOCK b.
PARAMETERS: p_dte TYPE  sy-datum,
            p_id TYPE   i.
SELECTION-SCREEN END OF BLOCK b.


"Dynamic Search Help

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_id.

  SELECT carrid connid
      FROM z07sflight
      INTO TABLE t_field
      WHERE fldate EQ p_dte.APPEND 'F0001' to t_rtn.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'P_ID'
      value_org       = 'S'
      dynprofield     = 'P_ID'
    TABLES
      value_tab       = t_field
      return_tab      = t_rtn
    EXCEPTIONS

      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.

  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  READ TABLE t_rtn INTO x_rtn INDEX 1.
  p_id = x_rtn-fieldval.

Regards,

Alenlee

Read only

Former Member
0 Likes
2,078

Hi ,

Plz check the return variable at validation code in BADI ME_PROCESS_REQ_CUST whether the value is blank , and if the input value from search help is blank, clear the input field and wait for the user manual input if necessary or skip and proceed to next in the program.

Regards,

Shruti