‎2009 Mar 26 3:53 AM
Hi Experts,
In selection screen first i will give first matnr(Material Number).and press enter it need to check if it is there in database(marc table) or not.
if it is in data base the below selection screen not to be displyed.
if it is there the below selection screen with Material Desc(maktx),sales text,Division. how can achive this requirement.thanks in advance.
Thanks,
Venkat.
‎2009 Mar 26 4:14 AM
Hi,
Refer this code, its working:-
PARAMETERS : p_matnr TYPE marc-matnr OBLIGATORY,
p_maktx TYPE makt-maktx MODIF ID abc.
DATA : v_matnr TYPE marc-matnr.
AT SELECTION-SCREEN OUTPUT.
SELECT SINGLE matnr FROM marc INTO v_matnr WHERE matnr = p_matnr.
IF sy-subrc NE 0.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 1.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
CLEAR p_maktx.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 0.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
SELECT SINGLE maktx FROM makt INTO p_maktx WHERE matnr = p_matnr.
ENDIF.
Hope this helps you.
Regards,
Tarun
‎2009 Mar 26 3:59 AM
HI Reddy.
Refer this code.
selection-screen begin of block b with frame title text-001.
select-options: s_plwrk for plaf-plwrk obligatory,"Plant
s_plnum for plaf-plnum, "Planned Order.
s_matnr1 for plaf-matnr, "Header Material
s_matnr2 for resb-matnr ,"Comp Material
s_pertr for plaf-pertr obligatory,
"Planned opening date
s_dispo for plaf-dispo. "MRP Controller
parameter : pa_vari like disvariant-variant.
"layout variant
selection-screen end of block b.
start-of-selection.
if s_plwrk is not initial and s_pertr is not initial.
**Fetch the Planned Order Number from table PLAF.
select plnum
matnr
plwrk
gsmng
pertr
dispo
from plaf into table it_plaf where
plnum in s_plnum
and matnr in s_matnr1
and plwrk in s_plwrk
and pertr in s_pertr
and dispo in s_dispo.
if sy-subrc <> 0.
message text-002 type 'E'.
endif.
else.
message 'Plant and Planned opening date both are mandatory' type 'S'.
endif.
Regards.
Jay
‎2009 Mar 26 4:03 AM
Hi,
to validate u can use event AT SELECTION-SCREEN ON <matnr>.
and to hide use
LOOP AT SCREEN.
CASE SCREEN-NAME.
WHEN <maktx>.
screen-invisible = 'X'.
ENDCASE.
MODIFY SCREEN.
ENDLOOP.
‎2009 Mar 26 4:05 AM
Hi ,
devlope ur code using this key... .
tables: mara.
parameters: p_matnr type matnr,
p_maktx type maktx.
at selection-screen output.
select single matnr from mara into mara-matnr where matnr = p_matnr.
if sy-subrc = 0 and mara-matnr <> space. this code fro
loop at screen.
if screen-name = 'P_MAKTX'. " check ur fields here
screen-active = 0. "for deactive mode it will hide from screen "
endif.
modify screen
endloop.
endif.
thanks and regards,
viji
‎2009 Mar 26 4:06 AM
AT SELECTION-SCREEN OUTPUT.
loop at screen.
if condition( the condition that u need to check will be written here).
if screen-name = 'X'. " parameter that u need to make invisible
screen-invisible = '1'.
modify screen.
endif.
endif.
endloop.
‎2009 Mar 26 4:14 AM
Hi,
Refer this code, its working:-
PARAMETERS : p_matnr TYPE marc-matnr OBLIGATORY,
p_maktx TYPE makt-maktx MODIF ID abc.
DATA : v_matnr TYPE marc-matnr.
AT SELECTION-SCREEN OUTPUT.
SELECT SINGLE matnr FROM marc INTO v_matnr WHERE matnr = p_matnr.
IF sy-subrc NE 0.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 1.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
CLEAR p_maktx.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 0.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
SELECT SINGLE maktx FROM makt INTO p_maktx WHERE matnr = p_matnr.
ENDIF.
Hope this helps you.
Regards,
Tarun
‎2009 Mar 26 4:37 AM
Hi Tarun,
Thanks for u r immediate response.
For the below selection fileds material description,division need to be mandatory if the matnr is not in data base.if i set obligatory first screen itself asking.Plese tell me how to achieve.
Thanks,
Venkat.
‎2009 Mar 26 4:41 AM
Hi,
Do you also want to make material description mandatory or just division field mandatory , if no material found from table MARC.
Regards,
Tarun
‎2009 Mar 26 4:46 AM
‎2009 Mar 26 5:00 AM
Hi,
Refer this code:-
If material not found in MARC, fields p_maktx and p_param are made mandatory.
But if user wishes to change material, and even if the material is available in MARC,
the other tow fields are still mandatory.
But if you give some value to these two fields and the material is a valid material from MARC,
the other two fields are set as optional (not mandatory)
PARAMETERS : p_matnr TYPE marc-matnr OBLIGATORY,
p_maktx TYPE makt-maktx MODIF ID abc,
p_param(10) TYPE c MODIF ID def.
DATA : v_matnr TYPE marc-matnr.
AT SELECTION-SCREEN OUTPUT.
IF NOT p_matnr IS INITIAL.
SELECT SINGLE matnr FROM marc INTO v_matnr WHERE matnr = p_matnr.
IF sy-subrc <> 0.
CLEAR p_maktx.
CLEAR p_param.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 1.
ENDIF.
IF screen-group1 = 'DEF'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
SELECT SINGLE maktx FROM makt INTO p_maktx WHERE matnr = p_matnr.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 0.
ENDIF.
IF screen-group1 = 'DEF'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDIF.
Regards,
Tarun
‎2009 Mar 26 6:19 AM
Hi Tarun,
Thanks for the immediate response. if the material is not in marc i need division default value AE need to be passed. division other than ae or ac it should through error.
Thanks,
Venkat.
‎2009 Mar 26 6:30 AM
Hi,
Consider parameter p_param as DIVISION NUMBER
If no material found from MARC, p_param is set to AE, else if material found p_param is cleared.
If p_param is other than AE or AC, then error message 'Invalid Division'
Refer:
PARAMETERS : p_matnr TYPE marc-matnr OBLIGATORY,
p_maktx TYPE makt-maktx MODIF ID abc,
p_param(10) TYPE c MODIF ID def.
DATA : v_matnr TYPE marc-matnr.
AT SELECTION-SCREEN OUTPUT.
IF NOT p_matnr IS INITIAL.
SELECT SINGLE matnr FROM marc INTO v_matnr WHERE matnr = p_matnr.
IF sy-subrc <> 0.
CLEAR p_maktx.
CLEAR p_param.
p_param = 'AE'.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 1.
ENDIF.
IF screen-group1 = 'DEF'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
SELECT SINGLE maktx FROM makt INTO p_maktx WHERE matnr = p_matnr.
CLEAR p_param.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 0.
ENDIF.
IF screen-group1 = 'DEF'.
screen-invisible = 0.
screen-active = 1.
screen-input = 1.
screen-required = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
SELECT SINGLE matnr FROM marc INTO v_matnr WHERE matnr = p_matnr.
IF sy-subrc <> 0.
p_param = 'AE'.
ENDIF.
IF NOT ( p_param = 'AE' OR p_param = 'AC' ).
MESSAGE 'Invalid Division' TYPE 'E'.
ENDIF.
Hope this helps you.
Regards,
Tarun
‎2009 Mar 26 6:38 AM