2011 Dec 13 3:19 PM
Hi Gurus,
I've written the following conversion exit:
FUNCTION CONVERSION_EXIT_ZBZEI_INPUT.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT)
*" EXPORTING
*" VALUE(OUTPUT)
*" EXCEPTIONS
*" INPUT_NOT_VALID
*"----------------------------------------------------------------------
DATA : CPI_OUT(4) type n, CPI_IN(5), cpi_in2(5), cpi_in3(5).
DATA : CPI_YEAR(4), CPI_PERIOD(3).
DATA : CPI_NUM2(2) TYPE N.
DATA : CPI_NUM3(2) TYPE N,
index(2) type n,
index2(2) type n,
merker(1).
DATA : CPI_C8, CPI_C7, CPI_C6, CPI_C5.
DATA: SONDERZ. "nimmt das Trennungszeichen auf
*-initializations-----------------------------------------------------*
check not input is initial.
CPI_IN2 = INPUT.
CLEAR : cpi_in, cpi_in3, cpi_out, OUTPUT, index, index2, merker,
cpi_num2, cpi_num3.
do.
if cpi_in2+index(1) co '0123456789' and merker ne 'X'.
cpi_in+index2(1) = cpi_in2+index(1).
add 1 to index2.
endif.
if cpi_in2+index(1) = ':'.
merker = 'X'.
clear index2.
endif.
if cpi_in2+index(1) co '0123456789' and merker = 'X'.
cpi_in3+index2(1) = cpi_in2+index(1).
add 1 to index2.
endif.
add 1 to index.
if index = 5.
exit.
endif.
enddo.
if cpi_in3 is initial.
cpi_out = cpi_in.
else.
cpi_num2 = cpi_in.
cpi_num3 = cpi_in3.
cpi_out(2) = cpi_num2.
cpi_out+2(2) = cpi_num3.
endif.
if cpi_out(2) > 23.
message e000 raising input_not_valid.
endif.
if cpi_out+2(2) > 59.
message e001 raising input_not_valid.
endif.
output = cpi_out.
* output+2(2) = cpi_in+3(2).
endfunction.
The problem is when the user inputs an invalid value and presses directly after this F4 the conversion exit will call and I get the short dump DYNPRO_MSG_IN_HELP when I trigger the error message.
Is there any way to know that the program is in value-request? Maybe a system field? Can I catch this error?
Thanks for help.
Lars
Hi Gurus,
I've written the following conversion exit:
FUNCTION CONVERSION_EXIT_ZBZEI_INPUT.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT)
*" EXPORTING
*" VALUE(OUTPUT)
*" EXCEPTIONS
*" INPUT_NOT_VALID
*"----------------------------------------------------------------------
DATA : CPI_OUT(4) type n, CPI_IN(5), cpi_in2(5), cpi_in3(5).
DATA : CPI_YEAR(4), CPI_PERIOD(3).
DATA : CPI_NUM2(2) TYPE N.
DATA : CPI_NUM3(2) TYPE N,
index(2) type n,
index2(2) type n,
merker(1).
DATA : CPI_C8, CPI_C7, CPI_C6, CPI_C5.
DATA: SONDERZ. "nimmt das Trennungszeichen auf
*-initializations-----------------------------------------------------*
check not input is initial.
CPI_IN2 = INPUT.
CLEAR : cpi_in, cpi_in3, cpi_out, OUTPUT, index, index2, merker,
cpi_num2, cpi_num3.
do.
if cpi_in2+index(1) co '0123456789' and merker ne 'X'.
cpi_in+index2(1) = cpi_in2+index(1).
add 1 to index2.
endif.
if cpi_in2+index(1) = ':'.
merker = 'X'.
clear index2.
endif.
if cpi_in2+index(1) co '0123456789' and merker = 'X'.
cpi_in3+index2(1) = cpi_in2+index(1).
add 1 to index2.
endif.
add 1 to index.
if index = 5.
exit.
endif.
enddo.
if cpi_in3 is initial.
cpi_out = cpi_in.
else.
cpi_num2 = cpi_in.
cpi_num3 = cpi_in3.
cpi_out(2) = cpi_num2.
cpi_out+2(2) = cpi_num3.
endif.
if cpi_out(2) > 23.
message e000 raising input_not_valid.
endif.
if cpi_out+2(2) > 59.
message e001 raising input_not_valid.
endif.
output = cpi_out.
* output+2(2) = cpi_in+3(2).
endfunction.
The problem is when the user inputs an invalid value and presses directly after this F4 the conversion exit will call and I get the short dump DYNPRO_MSG_IN_HELP when I trigger the error message.
Is there any way to know that the program is in value-request? Maybe a system field? Can I catch this error?
Thanks for help.
Lars
2013 Jan 21 2:51 PM
Hello Lars,
refering to OSS 84510 SAP does not allow error messages in this environment. However, to find out if you are in a F4- context you can use the kernel function 'DY_GET_DYNPRO_EVENT'
data: event(3).
"check if we are in F4 environment
call 'DY_GET_DYNPRO_EVENT' id 'EVENT' field event.
if sy-subrc <> 0 or ( event <> 'PAI'
and event <> 'INP' )."PAI also POV
" not F4 help
message e000 raising input_not_valid.
else.
"F4 help -> only S message
message s000 display like 'E' raising input_not_valid.
endif.
Kind regards, miro
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |