‎2011 Oct 05 9:25 AM
Hi Experts,
I have 4 fields in table control. 1. Material 2. Description. 3. Unit of Measure 4. Quantity.
I have to first validate material, than if material is exits, i am populating data to description and unit of measure field.
once i populate the data to the field description and unit of measure, i want to validate quantity.
if user not entered quantity, i have to raise the message. pls enter quantity.
i have following code
loop at it_matnr.
chain.
field it_matnr-matnr.
field it_matnr-maktx.
field it_matnr-meins.
field it_matnr-bdmng.
module check_matnr on chain-input .
module tc_matnr_modify on chain-request.
module check_bdmng on chain-input.
endchain.
&----
*& Form check_matnr
&----
text
----
-->P_IT_MATNR_MATNR text
----
FORM check_matnr USING P_MATNR TYPE matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = p_matnr
IMPORTING
OUTPUT = p_matnr
.
SELECT SINGLE matnr into v_matnr from mara
WHERE matnr = p_matnr.
if sy-subrc ne 0.
MESSAGE e999 WITH 'material' p_matnr 'does not exist'.
endif.
ENDFORM. " check_matnr
&----
*& Module check_bdmng INPUT
&----
text
----
MODULE check_bdmng INPUT.
if it_matnr-bdmng is initial.
MESSAGE e999 WITH 'Please enter Quantity'.
endif.
ENDMODULE. " check_bdmng INPUT
MODULE tc_matnr_modify INPUT.
DATA: lv_matnr TYPE matnr.
IF it_matnr-matnr IS NOT INITIAL.
CLEAR lv_matnr.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = it_matnr-matnr
IMPORTING
output = lv_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
SELECT SINGLE maktx FROM makt INTO it_matnr-maktx
WHERE matnr = lv_matnr
AND spras = sy-langu.
IF it_matnr-meins IS INITIAL.
SELECT SINGLE meins FROM mara INTO it_matnr-meins
WHERE matnr = lv_matnr.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
input = it_matnr-meins
language = sy-langu
IMPORTING
LONG_TEXT =
output = it_matnr-meins
SHORT_TEXT =
EXCEPTIONS
unit_not_found = 1
OTHERS = 2.
ENDIF.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = it_matnr-matnr
IMPORTING
OUTPUT = it_matnr-matnr
.
MODIFY it_matnr
INDEX tc_matnr-current_line.
IF sy-subrc NE 0.
APPEND it_matnr.
ENDIF.
But i am facing the problem, once i validate material, it will fill 2 fields, but it is not going to quantity validation.
Please let me know what i have to change.
Rgefds,
Udupi
‎2011 Oct 05 10:52 AM
Hi Udipi,
loop at it_matnr.
chain.
field it_matnr-matnr.
field it_matnr-maktx.
field it_matnr-meins.
field it_matnr-bdmng. " Comment this here
module check_matnr on chain-input .
module check_bdmng on chain-input.
field it_matnr_bdmng module check_bdmng. "As a sepaate check or try using ON INPUT or ON REQUEST
module tc_matnr_modify. " Table Control modify should be a normal (Defaulted one)
endloop.For more info please go through the Documentation on ON INPUT ON REQUEST
Cheerz
Ramchander Rao.K
‎2011 Oct 05 10:54 AM
Hi,
Remove chain-input from -
module check_bdmng on chain-input.
chain-input is triggered when u input value and Request is triggered when ever u change value in field .
Regards,
Madhukar Shetty
‎2011 Oct 07 1:42 PM
Hi dont use chain input use chain request .
Chain Request: when ever value is changed chain request will trigger
Chain Input: when intial value change chain input will trigger