2008 Jun 21 7:00 AM
hi experts,
I want to put check on quantity field of goods movement screen of co11n transaction if material exists.
I am using the fiedexit & below code to read values & put check.
DATA: i_dynfields TYPE TABLE OF dynpread WITH HEADER LINE,
num TYPE i,
v_erfmg TYPE mb_erfmg.
DO 11 TIMES.
num = sy-index.
i_dynfields-fieldname = 'MATNR'.
i_dynfields-stepl = num.
APPEND i_dynfields.
i_dynfields-fieldname = 'ERFMG'.
i_dynfields-stepl = num.
APPEND i_dynfields.
ENDDO.
ENDIF.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = 'SAPLCOWB'
dynumb = '0500'
translate_to_upper = 'X'
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
TABLES
dynpfields = i_dynfields
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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT i_dynfields.
IF i_dynfields-fieldname = 'MATNR'.
IF i_dynfields-fieldvalue IS NOT INITIAL.
READ TABLE i_dynfields WITH KEY fieldname = 'ERFMG'
stepl = num.
IF sy-subrc EQ 0.
IF i_dynfields-fieldvalue = 0 OR
i_dynfields-fieldvalue = space.
MESSAGE e004(zmsg2) WITH 'Quantity cannot be zero or empty'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFUNCTION.
but this is not executing the error message.
pls tell me where it is wrong.
hi experts,
I want to put check on quantity field of goods movement screen of co11n transaction if material exists.
I am using the fiedexit & below code to read values & put check.
DATA: i_dynfields TYPE TABLE OF dynpread WITH HEADER LINE,
num TYPE i,
v_erfmg TYPE mb_erfmg.
DO 11 TIMES.
num = sy-index.
i_dynfields-fieldname = 'MATNR'.
i_dynfields-stepl = num.
APPEND i_dynfields.
i_dynfields-fieldname = 'ERFMG'.
i_dynfields-stepl = num.
APPEND i_dynfields.
ENDDO.
ENDIF.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = 'SAPLCOWB'
dynumb = '0500'
translate_to_upper = 'X'
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
TABLES
dynpfields = i_dynfields
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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT i_dynfields.
IF i_dynfields-fieldname = 'MATNR'.
IF i_dynfields-fieldvalue IS NOT INITIAL.
READ TABLE i_dynfields WITH KEY fieldname = 'ERFMG'
stepl = num.
IF sy-subrc EQ 0.
IF i_dynfields-fieldvalue = 0 OR
i_dynfields-fieldvalue = space.
MESSAGE e004(zmsg2) WITH 'Quantity cannot be zero or empty'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFUNCTION.
but this is not executing the error message.
pls tell me where it is wrong.
2008 Jun 21 7:07 AM
LOOP AT i_dynfields where fieldname = 'ERFMG'
and stepl = num.
IF sy-subrc EQ 0.
IF i_dynfields-fieldvalue = 0 OR
i_dynfields-fieldvalue = space.
MESSAGE e004(zmsg2) WITH 'Quantity cannot be zero or empty'.
ENDIF.
ENDIF.
ENDLOOP.
Try the above....
Reward points...if the ans is helpful...
Edited by: Rudra Prasanna Mohapatra on Jun 21, 2008 8:07 AM
2008 Jun 21 11:44 AM
it is solved i need to pass entire screen field instead of 'matnr' ie. 'COWB_COMP-MATNR'.
but now the code is displaying error when quantity is not equal to zero also.
may be type mismatch.
can anyone tell?
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |