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

help me out

Former Member
0 Likes
422

hi to all sdn experts,

i want to add at selection-screen on value request and function module

F4_int_table_value_request to my code so that based on material number i should get material type and plant plz help me out. i have tried but unsuccessful here is my code.

tables :mara, marc.

types: begin of ty_mara,

matnr type mara-matnr,"material no

mtart type mara-mtart,"material type

matkl type mara-matkl,"material group

meins type mara-meins,"base unit of measure

ntgew type mara-ntgew,"net weight

end of ty_mara,

begin of ty_marc,

matnr type marc-matnr,"material no

werks type marc-werks,"plant

pstat type marc-pstat,"maintenance status

dispo type marc-dispo,"mrp controller

end of ty_marc.

data: it_mara type standard table of ty_mara initial size 0,

wa_mara like line of it_mara,

it_marc type standard table of ty_marc initial size 0,

wa_marc like line of it_marc.

selection-screen begin of block b1 with frame title text-001.

select-options : so_mat for mara-matnr.

parameters: p_matype type mara-mtart.

select-options: so_werks for marc-werks.

selection-screen end of block b1.

start-of-selection.

perform f_get_val using wa_mara

changing it_mara.

&----


*& Form f_get_val

&----


  • text

----


  • -->P_WA_MARA text

  • <--P_IT_MARA text

----


FORM f_get_val USING P_WA_MARA

CHANGING P_IT_MARA.

select matnr mtart matkl meins ntgew

from mara into table it_mara

where matnr in so_mat and mtart eq p_matype.

ENDFORM. " f_get_val

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
400

I dont know why you want the material type in the selection screen, if you know the material. In anycase here is what you can do

At selection-screen on value-request p_mattype.

perform get_material_type.

form get_material_type.

data : l_matnr like mara-matnr,

prog like d020s-prog,

dynp like d020s-dnum,

dynp_fields like dynpread occurs 100 with header line.

move syst-repid to prog.

move '1000' to dynp.

dynp_fields-fieldname = 'SO_MAT-LOW.

append dynp_fields.

call function 'DYNP_VALUES_READ'

exporting

dyname = prog

dynumb = dynp

tables

dynpfields = dynp_fields

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 dynp_fields index 1.

move dynp_fields-fieldvalue to l_matnr.

select mtart into p_mattype from mara where matnr = l_matnr.

endform.

I dont know why you want the material type in the selection screen, if you know the material. In anycase here is what you can do

At selection-screen on value-request p_mattype.

perform get_material_type.

form get_material_type.

data : l_matnr like mara-matnr,

prog like d020s-prog,

dynp like d020s-dnum,

dynp_fields like dynpread occurs 100 with header line.

move syst-repid to prog.

move '1000' to dynp.

dynp_fields-fieldname = 'SO_MAT-LOW.

append dynp_fields.

call function 'DYNP_VALUES_READ'

exporting

dyname = prog

dynumb = dynp

tables

dynpfields = dynp_fields

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 dynp_fields index 1.

move dynp_fields-fieldvalue to l_matnr.

select mtart into p_mattype from mara where matnr = l_matnr.

endform.

1 REPLY 1
Read only

Former Member
0 Likes
401

I dont know why you want the material type in the selection screen, if you know the material. In anycase here is what you can do

At selection-screen on value-request p_mattype.

perform get_material_type.

form get_material_type.

data : l_matnr like mara-matnr,

prog like d020s-prog,

dynp like d020s-dnum,

dynp_fields like dynpread occurs 100 with header line.

move syst-repid to prog.

move '1000' to dynp.

dynp_fields-fieldname = 'SO_MAT-LOW.

append dynp_fields.

call function 'DYNP_VALUES_READ'

exporting

dyname = prog

dynumb = dynp

tables

dynpfields = dynp_fields

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 dynp_fields index 1.

move dynp_fields-fieldvalue to l_matnr.

select mtart into p_mattype from mara where matnr = l_matnr.

endform.