‎2007 Dec 27 11:29 AM
hi friends ,
plz any one can help me for folloeimg scenario.
In selection screen i have three fields,plant,mat no and material group.if i input lant how do i get the matno and mat group based on plant dynamically.
‎2007 Dec 27 11:32 AM
use on value request method of selection screen...
there write code to fetch the records based on entered plant...
e.g.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_plant.
move '123' to p_matnr.
‎2007 Dec 27 11:32 AM
Hi,
Refer this
at selection-screen on s_werks.
select matnr
werks
matkl
from marc into table it_marc
where werks in s_werks.
Regards,
PRashant
‎2007 Dec 27 11:33 AM
‎2007 Dec 27 11:33 AM
Hi rajesh,
I had material number and material type on the selection screen.I was entering material number and pressing F4 on material type it was giving me material type for the entered material number.
Please go through the code and implement the same logic for your requirement
SELECTION-SCREEN BEGIN OF BLOCK b2.
PARAMETERS: p_matnr TYPE matnr MODIF ID md1.
PARAMETERS: p_mtart TYPE mtart MODIF ID md1.
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_mtart.
lit_dynpfields-fieldname = 'P_MATNR'.
APPEND lit_dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = 'Z3318_MODIFY_SCREEN'
dynumb = '1000'
translate_to_upper = 'X'
TABLES
dynpfields = lit_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.
READ TABLE lit_dynpfields
WITH KEY fieldname = 'P_MATNR'.
p_matnr = lit_dynpfields-fieldvalue.
SELECT mtart
INTO TABLE it_mtart
FROM mara
WHERE matnr = p_matnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'Material Type'
dynpprog = 'Z3318_MODIFY_SCREEN'
dynpnr = '1000'
dynprofield = 'P_MTART'
value_org = 'S'
TABLES
value_tab = it_mtart
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
‎2007 Dec 27 11:35 AM
hi rajesh,
Use the event on selection-screen-output ,this will help u.
Thank you,
Regards.
‎2007 Dec 27 3:12 PM
Hi rajesh,
please cehck the below code.based on the value of plant in selection screen.we can choose values for material number and mat group..using at selection screen output and at selection screen value request.
REPORT ZPRACTICE_43_032.
tables:marc,mara.
data : begin of itab occurs 0,
matnr like marc-matnr,
werks like marc-werks,
matkl like mara-matkl,
end of itab.
selection-screen:begin of block a with frame title text-001.
select-options:s_werks for marc-werks default '3000'.
parameter:p_matnr like marc-matnr.
parameter:p_matkl like mara-matkl.
selection-screen:end of block a.
at selection-screen output.
select amatnr awerks b~matkl
into table itab
from marc as a
inner join mara as b
on amatnr = bmatnr
where werks in s_werks.
if not itab[] is initial.
sort itab.
endif.
delete itab where matkl is initial.
at selection-screen on value-request for p_matnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATNR'
DYNPPROG = 'ZPRACTICE_43_022'
DYNPNR = '1000'
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = itab
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
at selection-screen on value-request for p_matkl.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATKL'
DYNPPROG = 'ZPRACTICE_43_022'
DYNPNR = '1000'
DYNPROFIELD = 'P_MATKL'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = itab
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
reward point if it is useful.
Regards,
Thasneem