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 dynamic values from the screen

Former Member
0 Kudos

Hi all,

when we press F4 normally on the filed it will bring the screen to enter values.

I need to assign a default value Dynamically from the one of the screen fields into one of the fields in the searchhelp...its not a constant.

Please let me know if anybody has an idea on this.

Thanks

Madhu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can use the Search help Exit for this, you can extend the search help and write the code in that one

1) goto SE11, create search help, give attributes

2) In the defination specify the input & output parameter and hit list for search help

3) To write the code create a new the function module by coping the standard

FM, F4IF_SHLP_EXIT and with the code for exit flow.

4) specify this FM as a search help exit name in the defination section.

Here, for the Input parameter, you need to pass that value, from that input value you can pass it to the Search help exits

Look at the below link

http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm

Regards

Sudheer

7 REPLIES 7

Former Member
0 Kudos

Hi,

You can use the Search help Exit for this, you can extend the search help and write the code in that one

1) goto SE11, create search help, give attributes

2) In the defination specify the input & output parameter and hit list for search help

3) To write the code create a new the function module by coping the standard

FM, F4IF_SHLP_EXIT and with the code for exit flow.

4) specify this FM as a search help exit name in the defination section.

Here, for the Input parameter, you need to pass that value, from that input value you can pass it to the Search help exits

Look at the below link

http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm

Regards

Sudheer

0 Kudos

Hi sudhir

Thanks for the Quick reply.

i created search help which displays the customer,customer name,Vendor etc..

when i give the customer number after i press F4 it will bring the corresponding

vendor.

I have the customer number in my custom screen and it varies everytime

i run the transaction.I need to pass the customer number dynamically to the search help-customer field.

i understand that you told me to use the Search help Exit but do you have any sample code or furthrer idea which help me doing this?

Thanks,

Madhu

Former Member
0 Kudos

Hi Madhu,

Here i am giving the sample code one is for report purpose and other one is Dialog program.

<b>First one :</b>

this program tells like by giving the value in one selection field and it should give the F4 values to the other filed in the selctions screen.

tables bsak.

TYPES : BEGIN OF ST_bsak,

bukrs TYPE bsak-BUKRS,

lifnr TYPE bsak-lifnr,

END OF ST_bsak.

DATA : IT_bsak TYPE STANDARD TABLE OF ST_bsak.

DATA : WA_bsak TYPE ST_bsak.

Data : v_repid type SY-REPID,

v_dynum type SY-DYNNR.

parameters : p_bukrs TYPE bsak-bukrs.

select-options : s_lifnr for bsak-liFnr.

DATA:lo_dynpfields LIKE dynpread OCCURS 1 WITH HEADER LINE.

<b>AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_lifnr-LOW.</b>

v_repid = sy-repid.

v_dynum = sy-dynnr.

lo_dynpfields-fieldname = 'P_BUKRS'.

APPEND lo_dynpfields.

CLEAR lo_dynpfields.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = v_repid

dynumb = v_dynum

translate_to_upper = 'X'

  • REQUEST = ' '

  • PERFORM_CONVERSION_EXITS = ' '

  • PERFORM_INPUT_CONVERSION = ' '

  • DETERMINE_LOOP_INDEX = ' '

TABLES

dynpfields = lo_dynpfields

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

.

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 TABLE lo_dynpfields WITH KEY fieldname = 'P_BUKRS'.

IF sy-subrc IS INITIAL.

MOVE lo_dynpfields-fieldvalue TO P_bukrs.

ENDIF.

*AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_lifnr-LOW.

  • IF S_OBJID IS NOT INITIAL.

SELECT bukrs lifnr from bsak up to 10 rows

INTO TABLE IT_bsak

WHERE bukrs = p_bukrs.

IF SY-SUBRC EQ 0.

  • SEARCH HELP FOR QUALIFICATION.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'LIFNR'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'S_LIFNR'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = IT_BSAK

  • FIELD_TAB =

  • RETURN_TAB = RETURN_TAB

  • DYNPFLD_MAPPING =

  • 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.

ENDIF.

<b>Second one is :</b>

this is you can use in screen-user exit.

assume ur first field is bukrs and second field is vkorg

zfpdch-vkorg is ur screen field name

in flow logic

PROCESS ON VALUE-REQUEST.

***module for F4 help on sales organization

FIELD zfpdch-vkorg MODULE organ_help.

doble click on module

&----


*& Module organ_help INPUT

&----


  • text

----


MODULE organ_help INPUT.

DATA: BEGIN OF i_vkorg OCCURS 0,

vkorg LIKE vbak-vkorg,

vtext LIKE tvkot-vtext,

END OF i_vkorg.

DATA:lo_dynpfields LIKE dynpread OCCURS 1 WITH HEADER LINE.

v_repid = sy-repid.

v_dynum = sy-dynnr.

lo_dynpfields-fieldname = 'ZFPDCH-BUKRS'.

APPEND lo_dynpfields.

CLEAR lo_dynpfields.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = v_repid

dynumb = v_dynum

translate_to_upper = 'X'

  • REQUEST = ' '

  • PERFORM_CONVERSION_EXITS = ' '

  • PERFORM_INPUT_CONVERSION = ' '

  • DETERMINE_LOOP_INDEX = ' '

TABLES

dynpfields = lo_dynpfields

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

.

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 TABLE lo_dynpfields WITH KEY fieldname = 'ZFPDCH-BUKRS'.

IF sy-subrc IS INITIAL.

MOVE lo_dynpfields-fieldvalue TO zfpdch-bukrs.

ENDIF.

SELECT vkorg

vtext

INTO TABLE i_vkorg

FROM tvko

WHERE bukrs = zfpdch-bukrs

AND spras = 'EN'.

IF sy-subrc IS INITIAL.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'VKORG'

  • PVALKEY = ' '

dynpprog = v_repid

dynpnr = v_dynum

dynprofield = 'ZFPDCH-VKORG'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = i_vkorg[]

  • FIELD_TAB =

  • RETURN_TAB =

  • DYNPFLD_MAPPING =

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.

ENDIF.

ENDMODULE. " organ_help INPUT

<b>Reward with points if helpful.</b>

Regards,

Vijay.

0 Kudos

Hi Vijay

Thanks for your reply

The answers you provided will be useful only when the search help coded in

the POV modules(dialog program) or custom reports.

I have a custom transaction and that has a collective search help for a screen field

which has 6 elementary search helps.

I have created 7th one .

my requirement is to provide the dynamic screen field value to one of the fields in my elementary search help instead of enter the value after it appears.

the answer provided by sudheer copying the standard Search help Exit FM, F4IF_SHLP_EXIT might be the solution

But i need some help(sample code) to achieve this.

Please let me know if you know this.

Thanks

Madhu

Former Member
0 Kudos

Hi

try like this

<b>create a structure of what the vlues you want</b>

TYPES : BEGIN OF ST_OBJID_SH,

OTYPE TYPE HRP1000-OTYPE,

OBJID TYPE HRP1000-OBJID,

END OF ST_OBJID_SH.

DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.

DATA : WA_OBJID_SH TYPE ST_OBJID_SH.

<b>selection screen</b>

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

*SELECT-OPTIONS : S_OTYPE FOR HRP1001-OTYPE NO INTERVALS .

SELECT-OPTIONS : S_OBJID FOR HRP1001-OBJID NO INTERVALS .

SELECT-OPTIONS : DATE FOR SY-DATUM NO-EXTENSION OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

<b>write the logic like this</b>

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.

  • IF S_OBJID IS NOT INITIAL.

SELECT OTYPE OBJID FROM HRP1000

INTO TABLE IT_OBJID_SH

WHERE OTYPE = 'D'.

IF SY-SUBRC EQ 0.

  • SEARCH HELP FOR QUALIFICATION.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'OBJID'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'S_OBJID'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = IT_OBJID_SH

  • FIELD_TAB =

  • RETURN_TAB = RETURN_TAB

  • DYNPFLD_MAPPING =

  • 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.

ENDIF.

.

<b>Reward if usefull</b>

0 Kudos

Hi naresh

Thanks for your reply

The answers you provided will be useful only when the search help coded in

the POV modules(dialog program) or custom reports.

I have a custom transaction and that has a collective search help for a screen field

which has 6 elementary search helps.

I have created 7th one .

my requirement is to provide the dynamic screen field value to one of the fields in my elementary search help instead of enter the value after it appears.

the answer provided by sudheer copying the standard Search help Exit FM, F4IF_SHLP_EXIT might be the solution

But i need some help(sample code) to achieve this.

Please let me know if you know this.

Thanks

Madhu

Former Member
0 Kudos

Hi

I got the answer myself.

in the dialog program I set the parameter id with the field and then i called that parameter in the Default value in the elementary search help and it works finally.

Thanks