2014 Jan 09 6:55 AM
when an inbound order is getting created i want check if the PO number already exists, if PO is already created i want the idoc to throw a error.
we are using the z process code inside which i am using the FM : IDOC_INPUT_ORDERS. Now where should i check for duplicate PO an write an error message... please help it very very urgent.
I have pasted the process we are following.please help i will be greatful
FUNCTION zidoc_input_orders.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWFAP_PAR-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" VALUE(DOCUMENT_NUMBER) LIKE VBAK-VBELN
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EDI_TEXT STRUCTURE EDIORDTXT1 OPTIONAL
*" EDI_TEXT_LINES STRUCTURE EDIORDTXT2 OPTIONAL
*"----------------------------------------------------------------------
CALL FUNCTION 'IDOC_INPUT_ORDERS'
EXPORTING
input_method = input_method
mass_processing = mass_processing
IMPORTING
workflow_result = workflow_result
application_variable = application_variable
in_update_task = in_update_task
call_transaction_done = call_transaction_done
document_number = document_number
TABLES
idoc_contrl = idoc_contrl
idoc_data = idoc_data
idoc_status = idoc_status
return_variables = return_variables
serialization_info = serialization_info
edi_text = edi_text
edi_text_lines = edi_text_lines.
*Trigger Event
WAIT UP TO 1 SECONDS.
DATA : ls_edidc TYPE edidc,
ls_edids TYPE bdidocstat,
lv_objkey TYPE sweinstcou-objkey.
READ TABLE idoc_contrl INTO ls_edidc INDEX 1.
READ TABLE idoc_status INTO ls_edids WITH KEY docnum = ls_edidc-docnum
status = '51'.
IF sy-subrc = 0.
lv_objkey = ls_edids-docnum.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'ZIDOCORDER'
objkey = lv_objkey
event = 'ZINPUTERROROCCURRED'.
COMMIT WORK.
ENDIF.
ENDFUNCTION.
when an inbound order is getting created i want check if the PO number already exists, if PO is already created i want the idoc to throw a error.
we are using the z process code inside which i am using the FM : IDOC_INPUT_ORDERS. Now where should i check for duplicate PO an write an error message... please help it very very urgent.
I have pasted the process we are following.please help i will be greatful
FUNCTION zidoc_input_orders.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWFAP_PAR-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" VALUE(DOCUMENT_NUMBER) LIKE VBAK-VBELN
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EDI_TEXT STRUCTURE EDIORDTXT1 OPTIONAL
*" EDI_TEXT_LINES STRUCTURE EDIORDTXT2 OPTIONAL
*"----------------------------------------------------------------------
CALL FUNCTION 'IDOC_INPUT_ORDERS'
EXPORTING
input_method = input_method
mass_processing = mass_processing
IMPORTING
workflow_result = workflow_result
application_variable = application_variable
in_update_task = in_update_task
call_transaction_done = call_transaction_done
document_number = document_number
TABLES
idoc_contrl = idoc_contrl
idoc_data = idoc_data
idoc_status = idoc_status
return_variables = return_variables
serialization_info = serialization_info
edi_text = edi_text
edi_text_lines = edi_text_lines.
*Trigger Event
WAIT UP TO 1 SECONDS.
DATA : ls_edidc TYPE edidc,
ls_edids TYPE bdidocstat,
lv_objkey TYPE sweinstcou-objkey.
READ TABLE idoc_contrl INTO ls_edidc INDEX 1.
READ TABLE idoc_status INTO ls_edids WITH KEY docnum = ls_edidc-docnum
status = '51'.
IF sy-subrc = 0.
lv_objkey = ls_edids-docnum.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'ZIDOCORDER'
objkey = lv_objkey
event = 'ZINPUTERROROCCURRED'.
COMMIT WORK.
ENDIF.
ENDFUNCTION.
2014 Jan 09 7:38 AM
Hi
Use EXIT_SAPLVEDA_011 and fill DERRTAB for the same
Nabheet
2014 Jan 09 8:06 AM
i can use it if i use the standard process code. but will it work for for the above FM it is my doubt...
for me to check the User exit works or not i need access key so i just wanna confirm whether it will work.
Thanks in advance
2014 Jan 09 8:09 AM
It will work.. You dont need access key. You just create the Z include inside the Exit and create a project in CMOD for the same...Why do you need an acess key?
Nabheet
2014 Jan 09 9:03 AM
i was not registered as developer so it was asking me for access key. thanks for the suggestion.. i will put a break point and check.
2014 Jan 09 9:16 AM
okie:) break point will trigger if project is activated for the same in CMOD
2014 Jan 09 10:19 AM
I have activated and harcoded the breakpoint when i try to reprocess in we19 the breakpoint i not triggering.pls help
2014 Jan 09 10:23 AM
In WE19 Please use INBOUND Function Module button and choose call in debugging mode. Please attach a screen shot of the project created in CMOD all green?
Nabheet
2014 Jan 09 11:10 AM
i have activated in cmod and checked even in the program, but when it triggers there th sy-subrc=4 and skips the the include, so i tried to manually change it to '0' in debbuging mode but still it skips the include and goes to end function.
please help.