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 Issue

Former Member
0 Likes
476

Hi,

I am working in SRM4.0

We have created 3 new fields on a standard screen, by appending these fields to structures as per SAP Notes 458591 and 672960 (Thats the way to add "Z" fields to std screen in SRM).

Now the requirement is when the user clicks on F4 help on one of the fields, the data is fetched from R/3 and displayed. For this we have created a search help and assigned it to a data element of the "Z" field and the values are being retrieved from R/3 with a function module that we have included in the search help. This much is working fine.

Now the problem is that when we click on F4 help of any one field and select the value, the corressponding values should get populated in the other 2 fields. How do we achieve this?

Thanks and Regards,

Jayesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
444

HI,

check this code..

hope it helps...

tables: mara, makt.

data: begin of itab occurs 0,

matnr like mara-matnr,

end of itab.

data : begin of btab occurs 0,

maktx like makt-maktx,

end of btab.

data mak like makt-maktx.

DATA : return like ddshretval occurs 0 with header line.

data: begin of dynpfields occurs 3.

include structure dynpread.

data: end of dynpfields.

parameters: p_matnr like mara-matnr,

p_maktx like makt-maktx.

Initialization.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

REFRESH ITAB.

SELECT matnr FROM mara INTO TABLE ITAB.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR '

dynprofield = 'P_MATNR '

dynpprog = sy-REPID

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = ITAB

return_tab = return.

select single maktx from makt into mak where matnr = return-fieldval.

p_matnr = return-fieldval.

refresh return.

clear return.

move 'P_MAKTX' to dynpfields-fieldname.

move mak to dynpfields-fieldvalue.

append dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = 'SY-REPID'

dynumb = '1000'

tables

dynpfields = dynpfields

  • EXCEPTIONS

  • INVALID_ABAPWORKAREA = 1

  • INVALID_DYNPROFIELD = 2

  • INVALID_DYNPRONAME = 3

  • INVALID_DYNPRONUMMER = 4

  • INVALID_REQUEST = 5

  • NO_FIELDDESCRIPTION = 6

  • UNDEFIND_ERROR = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

refresh return.

clear return.

3 REPLIES 3
Read only

Former Member
0 Likes
445

HI,

check this code..

hope it helps...

tables: mara, makt.

data: begin of itab occurs 0,

matnr like mara-matnr,

end of itab.

data : begin of btab occurs 0,

maktx like makt-maktx,

end of btab.

data mak like makt-maktx.

DATA : return like ddshretval occurs 0 with header line.

data: begin of dynpfields occurs 3.

include structure dynpread.

data: end of dynpfields.

parameters: p_matnr like mara-matnr,

p_maktx like makt-maktx.

Initialization.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

REFRESH ITAB.

SELECT matnr FROM mara INTO TABLE ITAB.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR '

dynprofield = 'P_MATNR '

dynpprog = sy-REPID

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = ITAB

return_tab = return.

select single maktx from makt into mak where matnr = return-fieldval.

p_matnr = return-fieldval.

refresh return.

clear return.

move 'P_MAKTX' to dynpfields-fieldname.

move mak to dynpfields-fieldvalue.

append dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = 'SY-REPID'

dynumb = '1000'

tables

dynpfields = dynpfields

  • EXCEPTIONS

  • INVALID_ABAPWORKAREA = 1

  • INVALID_DYNPROFIELD = 2

  • INVALID_DYNPRONAME = 3

  • INVALID_DYNPRONUMMER = 4

  • INVALID_REQUEST = 5

  • NO_FIELDDESCRIPTION = 6

  • UNDEFIND_ERROR = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

refresh return.

clear return.

Read only

anversha_s
Active Contributor
0 Likes
444

hi,

u can use FM => 'DYNP_VALUES_UPDATE'

DATA: BEGIN OF dynprofelder OCCURS 0.

INCLUDE STRUCTURE dynpread.

DATA: END OF dynprofelder.

REFRESH dynprofelder.

dynprofelder-fieldname = 'SCREEN_FIELD_NAME'.

dynprofelder-fieldvalue = screen_fld_value.

APPEND dynprofelder.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = dynprofelder

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

rgds

anver

pls mark all hlpful answers

Read only

Former Member
0 Likes
444

Hi jayesh,

1. Simple

2. While defining the search help

3. Make those extra fields as EXPORT

(hence, their value will AUTOMATICALLY GET

exported on the screen,

to the fields with the same name)

regards,

amit m.