Application Development 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: 

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

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

rajeevgoswami1
Participant
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

Hi,

For this filed is key filed and also it has foreign key relation ship?.if it is then f4 help is possible other case external we have provide.

Regards,

Gurunath Kumar D

rajeevgoswami1
Participant
0 Kudos

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

0 Kudos

Thanks a lot Rajeev!

Key for success was to assign Default value to SH's parameter 'PAMSSERVER'.

Your example was very helpful.

I am observing one more  strange thing, when setting cursor on the  p_papr screen field and pressing F4, search help is displayed properly, with initial value taken from screen, which is great.

But I am losing  focus, that means immediately when SH popup table is shown, cursor sets itself on the screen field p_papr, and I need to click mouse on the SH again in order to be able to continue filtering and choosing values.

I have also observed that this symptom starts when additional parameters are used for 'F4IF_FIELD_VALUE_REQUEST' function module, that is:

dynpprog                  = sy-repid

       dynpnr                    = sy-dynnr

       dynprofield               = 'P_PAPR'

Once they are added I am loosing focus...

PS. I really need to get used to the new forum, also find where to reward points...

0 Kudos

I would suggest you to check out search-help exit.