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

F4 help

Former Member
0 Likes
655

Hi all,

i have a requirement like i have a plant and MRP controller in the selection screen. if the user enters a plant and if the user presses F4 on MRP controller then the user has to see all MRP controllers related to the plant entered in the selection screen only. Any input on this is appreciated. I Know the table related to this is T024D. Please give an example code if possible.

Thanks in anticipation.

Regards

Poorna Ravichandra

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
516

Hi,

Please see the below code for a similar requirement. here there are two fields namely p_devloc and p_inst. if the user enters the p_devloc and presses F4 on p_inst then the relevant values for p_inst pertaining to p_devloc should appear.

DATA: i_dynpread TYPE TABLE OF dynpread ,

struct_dynp TYPE dynpread ,

ws_c_repid TYPE sy-repid,

ws_dynprofield TYPE help_info-dynprofld,

ws_c_dynnr TYPE sy-dynnr.

data : begin of i_tab occurs 0,

anlage like eanld-anlage,

devloc like egpld-devloc,

end of i_tab.

CONSTANTS:

c_retfield TYPE dfies-fieldname VALUE 'STRING',

c_valueorg TYPE ddbool_d VALUE 'S'.

selection-screen : begin of block bl1 with frame title text-000.

parameters : p_devloc like egpld-devloc,

p_inst like eanld-anlage.

selection-screen end of block bl1.

at selection-screen on value-request for p_inst.

REFRESH : i_tab.

ws_c_repid = sy-repid.

ws_c_dynnr = sy-dynnr.

struct_dynp-fieldname = 'P_DEVLOC'.

APPEND struct_dynp to i_dynpread.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = ws_c_repid

dynumb = ws_c_dynnr

TABLES

dynpfields = i_dynpread

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.

read table i_dynpread into struct_dynp with key fieldname = 'P_DEVLOC'.

select tplnr

zzinstall_num

into table i_tab

from iflot

where tplnr = p_devloc.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_INST'

dynpprog = ws_c_repid

dynpnr = ws_c_dynnr

dynprofield = 'VAL3'

value_org = 'S'

TABLES

value_tab = i_tab

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.

Regards,

Jagath.

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
516

Actually the following program works for me. If you put a plant in, and do F4 on the MRP controller, then you only get the values for that plant. Remove the plant, you will get all the values for all plants.



report zrich_0001.


parameters: p_werks type marc-werks,
            p_dispo type marc-dispo.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
517

Hi,

Please see the below code for a similar requirement. here there are two fields namely p_devloc and p_inst. if the user enters the p_devloc and presses F4 on p_inst then the relevant values for p_inst pertaining to p_devloc should appear.

DATA: i_dynpread TYPE TABLE OF dynpread ,

struct_dynp TYPE dynpread ,

ws_c_repid TYPE sy-repid,

ws_dynprofield TYPE help_info-dynprofld,

ws_c_dynnr TYPE sy-dynnr.

data : begin of i_tab occurs 0,

anlage like eanld-anlage,

devloc like egpld-devloc,

end of i_tab.

CONSTANTS:

c_retfield TYPE dfies-fieldname VALUE 'STRING',

c_valueorg TYPE ddbool_d VALUE 'S'.

selection-screen : begin of block bl1 with frame title text-000.

parameters : p_devloc like egpld-devloc,

p_inst like eanld-anlage.

selection-screen end of block bl1.

at selection-screen on value-request for p_inst.

REFRESH : i_tab.

ws_c_repid = sy-repid.

ws_c_dynnr = sy-dynnr.

struct_dynp-fieldname = 'P_DEVLOC'.

APPEND struct_dynp to i_dynpread.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = ws_c_repid

dynumb = ws_c_dynnr

TABLES

dynpfields = i_dynpread

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.

read table i_dynpread into struct_dynp with key fieldname = 'P_DEVLOC'.

select tplnr

zzinstall_num

into table i_tab

from iflot

where tplnr = p_devloc.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'P_INST'

dynpprog = ws_c_repid

dynpnr = ws_c_dynnr

dynprofield = 'VAL3'

value_org = 'S'

TABLES

value_tab = i_tab

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.

Regards,

Jagath.

Read only

0 Likes
516

Thanks jagath

got the solution.

Thanks very much.

Regards poorna