Archived discussions are read-only. Learn more about SAP Q&A

[Search-help] how to pass screen field to import parameter of SHelp?

Hi All,

What a new discussion forum we have

I am trying to create a simple elementary SHelp and attach it to selection screen field.

So basically I am haveing 2 screen fields, like:

PARAMETERS:
   p_name         TYPE  tsp03d-name,
   p_papr         TYPE  znl_printer. "F4

ZNL_PRINTER data element is of predefined type CHAR30.

It has elementary SHelp ZNL_PRINTERS attached (parameter name is NAME).

Selection method: TSP03D

SHelp parameters:

- SHelp parameter: 'NAME'      (IMP=X, EXP=X, LPos=Spos=1, Data element=RSPOLNAME)

- SHelp parameter: 'PAPROSNAME'     (IMP=X, EXP=X, LPos=Spos=2, Data element=RSPOPRNAME)

So now, let's say I am entering some value into the field p_name, for example *BOB*.

Then I click the p_papr field and press F4.

What I would like to achieve is to fill  the NAME parameter of SHelp with a value of p_name selection screen field (*BOB*)

Could you please suggest what should that be done? I know I could use  F4IF_INT_TABLE_VALUE_REQUEST FModule to build a SHelp internal table on the fly, based on screen fields value. But I need to use this functionality also in other programs. So developing the logic for each of them would be redundant.

Is there a standard / data dictionary way to achieve the result I described?

Would appreciate your comments.

Regards,

bob.

Tags:
replied

Hi Bob,

To get the default value in search help we need to set the parameter id for that perticular field (p_name), before calling the F4 help.

Note: At the search help level set the default value of "name"  parameter  to it's   parameter id.

You can set the parameter id in ' AT SELECTION-SCREEN on VALUE-REQUEST FOR p_papr' event.

But to if use value request then implicit F4 will not work. To call the search help explicitly u can use FM  'F4IF_FIELD_VALUE_REQUEST'

and to read the screen value to set the parameter id use FM 'FM_FYC_DYNPRO_VALUE_READ'.

To know it more clearly I have created  an example.

code:

  REPORT  Y65_SHELP.
PARAMETERS:
   p_dept         TYPE  yh2165_emp-dept,
   p_empno        TYPE  yh2165_emp-empno.
  DATA: fval TYPE DYNFIELDVALUE.

   AT SELECTION-SCREEN on VALUE-REQUEST FOR p_empno.

   CALL FUNCTION 'FM_FYC_DYNPRO_VALUE_READ'
  EXPORTING
    i_repid            = sy-repid
    i_dynnr            = sy-dynnr
    i_fieldname        = 'P_DEPT'
IMPORTING
   E_FIELDVALUE       = Fval
          .
set PARAMETER ID 'ZDEPT' FIELD fval.

    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      TABNAME                   = 'YH2165_EMP'
      FIELDNAME                 = 'EMPNO'
     SEARCHHELP                = 'YH2165_S_EMP'
     SHLPPARAM                 = 'EMPNO'
     DYNPPROG                  = sy-repid
     DYNPNR                    = sy-dynnr
     DYNPROFIELD               = 'P_EMPNO'
   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.

If you any query please let me know.

Regards,

Rajeev Goswami

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question