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

Search help

Former Member
0 Likes
821

Hi all

i gt 2 input field: name, address

i want to create a search help on the address input field base on the name i had.

Hw to do that? any code

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
794

Hi Gary,

You may use the following program logic for your purposes. Hope it helps

REPORT zhr_astest.

Data : Begin of li_address,

STRAS type pa0006-stras,

ORT01 type pa0006-ort01,

ORT02 type pa0006-ort02,

LAND1 type pa0006-land1,

end of li_address.

Data : it_addr like table of li_address.

DATA: progname TYPE sy-repid,

dynnum TYPE sy-dynnr,

dynpro_values TYPE TABLE OF dynpread,

field_value LIKE LINE OF dynpro_values.

Parameters : p_pernr type pa0006-pernr,

p_addr type pa0006-STRAS.

INITIALIZATION.

progname = sy-repid.

dynnum = sy-dynnr.

  • Search-help for P_WERKS-Low

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_addr.

CLEAR: field_value, dynpro_values, it_addr.

REFRESH dynpro_values.

field_value-fieldname = 'P_PERNR'.

APPEND field_value TO dynpro_values.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = progname

dynumb = dynnum

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

  • Select data to be display on Search Help

Select stras ort01 ort02 land1

into table it_addr

from pa0006

where pernr = field_value-fieldvalue and

anssa = '1'.

SORT it_addr BY land1.

DELETE ADJACENT DUPLICATES FROM it_addr

COMPARING stras ort01 ort02 land1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_ADDR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'P_ADDR'

value_org = 'S'

TABLES

value_tab = it_addr.

10 REPLIES 10
Read only

Former Member
0 Likes
794

Hi,

Refer to the following code:

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

REFRESH ITEMP.

CLEAR ITEMP.

SELECT WERKS

NAME1

FROM T001W

INTO TABLE ITEMP

WHERE IWERK = 'M011'.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'WERKS'

  • PVALKEY = ' '

  • DYNPPROG = ' '

  • DYNPNR = ' '

  • DYNPROFIELD = ' '

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

TABLES

VALUE_TAB = ITEMP

  • FIELD_TAB =

RETURN_TAB = T_RETURN

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

S_WERK-LOW = T_RETURN-FIELDVAL.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

0 Likes
794

hihi. Sorry i new to abap.... can u start from the report and rewrote the whole code. Any code in the flow logic? thank

Read only

Former Member
0 Likes
794

hi,

u want to have ur own search help then goto se 11 -> create a search help and in ur program use event AT SELECTION-SCREEN ON HELP REQUEST and code.

if helpful reward some points.

with regards,

Suresh Aluri.

Read only

0 Likes
794

How do u write this AT SELECTION-SCREEN ON HELP REQUEST?

Write at where? flow logic or report ?

Read only

Former Member
0 Likes
795

Hi Gary,

You may use the following program logic for your purposes. Hope it helps

REPORT zhr_astest.

Data : Begin of li_address,

STRAS type pa0006-stras,

ORT01 type pa0006-ort01,

ORT02 type pa0006-ort02,

LAND1 type pa0006-land1,

end of li_address.

Data : it_addr like table of li_address.

DATA: progname TYPE sy-repid,

dynnum TYPE sy-dynnr,

dynpro_values TYPE TABLE OF dynpread,

field_value LIKE LINE OF dynpro_values.

Parameters : p_pernr type pa0006-pernr,

p_addr type pa0006-STRAS.

INITIALIZATION.

progname = sy-repid.

dynnum = sy-dynnr.

  • Search-help for P_WERKS-Low

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_addr.

CLEAR: field_value, dynpro_values, it_addr.

REFRESH dynpro_values.

field_value-fieldname = 'P_PERNR'.

APPEND field_value TO dynpro_values.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = progname

dynumb = dynnum

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

  • Select data to be display on Search Help

Select stras ort01 ort02 land1

into table it_addr

from pa0006

where pernr = field_value-fieldvalue and

anssa = '1'.

SORT it_addr BY land1.

DELETE ADJACENT DUPLICATES FROM it_addr

COMPARING stras ort01 ort02 land1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_ADDR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'P_ADDR'

value_org = 'S'

TABLES

value_tab = it_addr.

Read only

0 Likes
794

Thank you u save my day!

Read only

0 Likes
794

Hihi.. sorry to bother u .

I not using a selection screen but a dialog screen.

How to make yr working code to be in dialog screen?

Read only

0 Likes
794

Hi Gary,

You might want to do this way. Let me know if it works or not

    • The screen flow logic is as follows:

PROCESS ON VALUE-REQUEST.

FIELD P_ADRR MODULE VALUE_ADDRESS.

    • In the Dialog Modules

Module Value_Address Input.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = progname

dynumb = dynnum

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

  • Select data to be display on Search Help

Select stras ort01 ort02 land1

into table it_addr

from pa0006

where pernr = field_value-fieldvalue and

anssa = '1'.

SORT it_addr BY land1.

DELETE ADJACENT DUPLICATES FROM it_addr

COMPARING stras ort01 ort02 land1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_ADDR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'P_ADDR'

value_org = 'S'

TABLES

value_tab = it_addr.

endmodule.

Read only

0 Likes
794

Hi

Below is my code. The bold word is where i gt syntax error.

REPORT ZGARY_SEARCH_HELP_DIA.

DATA: ADMINO(20) type c.

Start-of-selection.

call screen 100.

Module Value_Address Input.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = progname

dynumb = dynnum

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

  • Select data to be display on Search Help

Select ADMINOGARY FNAMEGARY LNAMEGARY

into table it_addr

from ZSTUDGARY

where ADMINOGARY = ADMINO.

SORT it_addr BY land1.

DELETE ADJACENT DUPLICATES FROM it_addr

COMPARING stras ort01 ort02 land1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_ADDR'

dynpprog = <b>progname</b>

dynpnr = dynnum

dynprofield = 'P_ADDR'

value_org = 'S'

TABLES

value_tab = it_addr.

endmodule.

Read only

0 Likes
794

Hi Gary,

I would suggest you to assign the program name to that variable before calling it.

Regards,

Loo