‎2007 Sep 04 5:46 PM
HI,
i have the material number in the selection screen ..when i select the material number i want to display the material description in same line ...
How can i achieve it?
Regards
BAlu
‎2007 Sep 04 5:56 PM
You can do it like this.
report zrich_0002 .
selection-screen begin of line.
selection-screen comment (20) matnr.
parameters: p_matnr type mara-matnr.
selection-screen comment (40) maktx.
selection-screen end of line.
at selection-screen output.
matnr = 'Material Number'.
if maktx is initial.
select single maktx into maktx
from makt
where matnr = p_matnr
and spras = sy-langu.
endif.
at selection-screen on value-request for p_matnr.
data: dynfields type table of dynpread with header line.
data: return type table of ddshretval with header line.
call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
tabname = 'MARA'
fieldname = 'MATNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'P_MATNR'
tables
return_tab = return
exceptions
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
others = 5.
read table return with key fieldname = 'P_MATNR'.
* Add it back to the dynpro.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
append dynfields.
clear dynfields.
dynfields-fieldname = 'MAKTX'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = return-fieldval
IMPORTING
OUTPUT = p_matnr.
select single maktx into dynfields-fieldvalue
from makt
where matnr = p_matnr
and spras = sy-langu.
append dynfields.
* Update the dynpro values.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynfields
exceptions
others = 8.
start-of-selection.
This will also handle if you do F4 help on the MATNR field, and select a material, the description will be filled in automatically.
Regards,
Rich Heilman
‎2007 Sep 04 5:53 PM
Hi Balu,
Do you want to display the description as a comment with the parameter??
Like :
Material Number 000001, On pressing enter the desc. comes in line as:
Material Number 000001 Material 1
Thanks and Best Regards,
Vikas Bittera.
‎2007 Sep 04 5:54 PM
Sure, but you should need to modify the Search Help....Or you can use this FM...
<b>F4IF_INT_TABLE_VALUE_REQUEST</b>
Greetings,
Blag.
‎2007 Sep 04 5:56 PM
You can do it like this.
report zrich_0002 .
selection-screen begin of line.
selection-screen comment (20) matnr.
parameters: p_matnr type mara-matnr.
selection-screen comment (40) maktx.
selection-screen end of line.
at selection-screen output.
matnr = 'Material Number'.
if maktx is initial.
select single maktx into maktx
from makt
where matnr = p_matnr
and spras = sy-langu.
endif.
at selection-screen on value-request for p_matnr.
data: dynfields type table of dynpread with header line.
data: return type table of ddshretval with header line.
call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
tabname = 'MARA'
fieldname = 'MATNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'P_MATNR'
tables
return_tab = return
exceptions
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
others = 5.
read table return with key fieldname = 'P_MATNR'.
* Add it back to the dynpro.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
append dynfields.
clear dynfields.
dynfields-fieldname = 'MAKTX'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = return-fieldval
IMPORTING
OUTPUT = p_matnr.
select single maktx into dynfields-fieldvalue
from makt
where matnr = p_matnr
and spras = sy-langu.
append dynfields.
* Update the dynpro values.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynfields
exceptions
others = 8.
start-of-selection.
This will also handle if you do F4 help on the MATNR field, and select a material, the description will be filled in automatically.
Regards,
Rich Heilman
‎2007 Sep 04 6:17 PM
Thanq Rich,
but if select one material number the description is coming ...after that if i entered wrong material number the description should b clear.....
Plz help me
Regards
BAlu
‎2007 Sep 04 6:25 PM
‎2007 Sep 04 7:26 PM
‎2007 Sep 04 8:29 PM
Please add this piece of code in richs code.
AT SELECTION-SCREEN OUTPUT.
MATNR = 'Material Number'.
SELECT SINGLE MAKTX INTO MAKTX
FROM MAKT
WHERE MATNR = P_MATNR
AND SPRAS = SY-LANGU.
<b> IF SY-SUBRC <> 0.
CLEAR MAKTX.
ENDIF.</b>
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.Hope this helps.
Shreekant