‎2007 Oct 05 12:07 PM
Hi Folks,
I have a selection-screen having the matnr and quantity.
MATNR is going to be fetched from the table but the quantity is going to be given by the user at the selection screen level.Now if the user enters say
part4 as matnr
10 as quantity,the unit of measure of this part4 should get displayed besides the Quantity field in the selection-screen.Can anyone here please let me know how to achieve this.
Thanks,
K.Kiran.
‎2007 Oct 05 12:44 PM
hi Kiran,
pls. see the following code. Pls. note that this is for period and text that will appear is the name of the month, but I think that the concept is the same.
hope this helps
ec
PARAMETERS : p_mon TYPE poper DEFAULT '012' OBLIGATORY
VISIBLE LENGTH 2.
SELECTION-SCREEN COMMENT 37(15) lv_monat FOR FIELD p_mon.
INITIALIZATION.
PERFORM get_buper USING p_gjahr
p_mon
CHANGING lv_monat.
FORM get_buper USING i_jahr TYPE any
i_monat TYPE any
CHANGING p_monam TYPE any.
lv_period = i_monat.
CALL FUNCTION 'G_POSTING_DATE_OF_PERIOD_GET'
EXPORTING
period = lv_period
variant = 'L1'
year = i_jahr
IMPORTING
from_date = lv_date
EXCEPTIONS
period_not_defined = 1
variant_not_defined = 2
OTHERS = 3.
IF sy-subrc EQ 0.
lv_period = lv_date+4(2).
SELECT SINGLE monam INTO p_monam FROM t015m
WHERE spras = sy-langu
AND monum = lv_period.
IF sy-subrc NE 0.
CLEAR p_monam.
ENDIF.
ENDIF.
ENDFORM. " GET_BUPER
DON'T reward if NOT useful
‎2007 Oct 05 12:57 PM
run the code given below and see if it fulfills ur requirement
parameters:
p_matnr like mara-matnr,
p_MENGE like mseg-menge,
p_meins like mara-meins.
at selection-screen OUTPUT.
loop at screen.
if screen-name = 'P_MEINS'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
endloop.
AT SELECTION-SCREEN.
IF P_MATNR IS NOT INITIAL.
SELECT SINGLE MEINS FROM MARA
INTO P_MEINS WHERE
MATNR EQ P_MATNR.
ENDIF.
Reward points if useful, get back in case of query...
Cheers!!!
‎2007 Oct 06 4:06 AM
Tripat,
It is working but it is displaying the P_MEINS at the selection screen if and only if I fill in the other selection screen fields which are following P_MEINS.But what I want is once the user enter the MATNR then automatically the P_MEINS should get populated without pressing ENTER.
Thanks,
K.Kiran.
Message was edited by:
Kiran K
‎2007 Oct 06 5:31 AM
Hi Folks.
Once the user enter value in P_matnr I want the corresponding meins to be displayed as text besides P_MATNR.
Can anyone here please help me with this.
REPORT ZSELECTIONSCREEN .
tables:mara.
DATA: L_MEINS(05) TYPE C,
T_MEINS(05) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_WERKS LIKE ZMMSTORAGEBIN-WERKS OBLIGATORY,
P_MATNR LIKE MARA-MATNR OBLIGATORY,
P_MEINS LIKE MARA-MEINS,
QUANT LIKE MSEG-MENGE ,
LABEL(03) TYPE C .
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_MEINS'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
select meins from mara into (t_meins) where matnr = p_matnr.
endselect.
IF P_MATNR IS NOT INITIAL.
P_MEINS = T_MEINS.
ENDIF.
Thanks,
K.Kiran.
‎2007 Oct 06 5:37 AM
You need to press ENTER in order to trigger event AT SELECTION-SCREEN OUTPUT. Once this event is triggered, if condition is satisfied, it will display unit next to Material.
System will get to know to trigger this logic if and only if user presses ENTER. That is the limitation.
ashish
‎2007 Oct 06 5:42 AM
Ashish,
I got it but a minor problem with syntax
REPORT ZSELECTIONSCREEN .
tables:mara.
DATA: L_MEINS(05) TYPE C,
T_MEINS(05) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_WERKS LIKE ZMMSTORAGEBIN-WERKS OBLIGATORY,
P_MATNR LIKE MARA-MATNR OBLIGATORY.
<b>SELECTION-SCREEN COMMENT 1(01) UOM FOR FIELD p_mATNR.</b>
PARAMETERS: P_MEINS LIKE MARA-MEINS,
QUANT LIKE MSEG-MENGE ,
LABEL(03) TYPE C .
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_MEINS'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
select meins from mara into (t_meins) where matnr = p_matnr.
endselect.
IF P_MATNR IS NOT INITIAL.
UOM = T_MEINS.
ENDIF.
Can you please let me know how to correct this comment 1(01).
Thanks,
K.Kiran.
‎2007 Oct 06 5:47 AM
When you need to add comment to selection screen next to parameter, you need to use begin of line syntax.
Check this code and make changes accordingly to your code.
selection-screen begin of line.
selection-screen comment (20) matnr .
parameters: p_matnr type mara-matnr obligatory.
selection-screen comment (40) maktx .
selection-screen end of line.
You can check this link for more details -
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba7a135c111d1829f0000e829fbfe/frameset.htm
Also in your code if you make this change, it will work
SELECTION-SCREEN COMMENT 1(1) UOM FOR FIELD p_mATNR.
Comments
To place comments on the selection screen, you use:
SELECTION-SCREEN COMMENT [/]<pos(len)> <comm> [FOR FIELD <f>]
[MODIF ID <key>].
This statement writes the <comm> comment on the selection screen. For <comm>, you can specify a text symbol or a field name with a maximum length of eight characters. This character field must not be declared with the DATA statement, but is generated automatically with length <len>. The field must be filled before the selection screen is called. You must always specify the <pos(len)> addition. Only if there are several elements in one line, can you omit <pos>.
Message was edited by:
Ashish Gundawar
‎2007 Oct 06 6:00 AM
Hi Kiran,
This is possible.... but you need to know what event this has to trigger...
The values will be populated only when the user selects the key boad function ENTER.....
If you what to populate without user action then you have to code in F4 help of your own and use the FM's "DYNP_VALUES_READ" and "DYNP_VALUES_UPDATE"
Or you can create a search help and import the unit value when you choose the material....
If the hint is useful Say thanks by reward .
Regards,
Prabhu Rajesh
‎2007 Oct 06 7:35 AM
hi kiran,
Just go through this code, this will help u.
TABLES:mara.
DATA: l_meins(05) TYPE c,
t_meins(05) TYPE c.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:p_werks LIKE marc-werks OBLIGATORY,
p_matnr LIKE mara-matnr OBLIGATORY.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(01) uom FOR FIELD p_matnr.
PARAMETERS: p_meins LIKE mara-meins,
quant LIKE mseg-menge ,
label(03) TYPE c .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_MEINS'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
SELECT meins FROM mara INTO (t_meins) WHERE matnr = p_matnr.
ENDSELECT.
IF NOT p_matnr IS INITIAL.
uom = t_meins.
ENDIF.
<b>please reward points if helpfull.</b>
with regards,
radhika kolluru.