‎2011 Jul 06 3:48 PM
I'm modifying IDOC basic type ORDERS05 with an Enhancement. I've created some Z segments and it's ok.
But I have a field on a Z segment that I want to validate. If this field is blank, I want to set IDOC status as '57' and put a message. The problem is that I'm creating the IDOC with exits of the function IDOC_OUTPUT_ORDERS and I want to create the IDOC with that error status instead of create IDOC and do any changes later on that IDOC.
Can anyone suggest some ways for solve this problem?
Thanks everybody,
Marcelly
‎2011 Jul 06 6:21 PM
Hi,
Did you use user-exit EXIT_SAPLEINM_007 to populate the custom segment? In that user-exit you should be able to change the staus message of the IDOC.
Please let me know if you have further queries.
Regards
Ram
‎2011 Jul 06 9:42 PM
It's not entering on this exit when I create the message.
I tried to insert an infinity loop and watch the process at SM50 and it's not running.
Are you sure that the custom record is modified in this exit?
I was checking the function IDOC_OUTPUT_ORDERS and understand that the control record is customized by:
docu: customer exit - control record (001)
CALL CUSTOMER-FUNCTION '001'
EXPORTING
control_record_out = control_record_out
dekko = ekko
dobject = object
IMPORTING
control_record_out = control_record_out
TABLES
dxekpo = xekpo
dxeket = xeket.
And at the form FUELLEN_IDOC_INTTAB we can customize the data segments with:
Call Customer Function 002 (enhancement MM06E001)
PERFORM customer_function.
It's called almost for every standard segment.
But I can't find the customization of the status segment! I don't understand why I can't reach the exit EXIT_SAPLEINM_007. Is there another exit at the message creation of purchase orders to customize the status segments?
Thank you!
‎2011 Jul 07 6:28 AM
Hi,
Try the below, i guess this should work.
Implement function exit - EXIT_SAPLEINM_011, which gets called at the end of routine - fuellen_idoc_inttab.
Within the function exit, use the data in INT_EDIDD to validate and then raise the exception - data_not_relevant_for_sending.
This should fail the IDOC.
@Ramachandra
Did you use user-exit EXIT_SAPLEINM_007 to populate the custom segment? In that user-exit you should be able to change the staus message of the IDOC.
The above userexit gets called in INPUT processing of the Orders, and is not getting called anywhere in IDOC_OUTPUT_ORDERS.
Regards,
Chen
Edited by: Chen K V on Jul 7, 2011 11:06 AM
‎2011 Jul 07 3:08 PM
Thanks Chen, but I tried it before too...
But the request is to create the IDOC with error status 51, and if it is possible, set the message as 'Field XXX invalid'.
So, if I raise that exception the IDOC isn't created.
Any other suggestions?
I'm almost forgetting it and creating a JOB to change the IDOC's status. But it's too fail.
Thanks for everybody!
‎2011 Jul 08 9:25 AM
Hi,
I'm creating the IDOC with exits of the function IDOC_OUTPUT_ORDERS
But the request is to create the IDOC with error status 51, and if it is possible, set the message as 'Field XXX invalid'.
I am little confused based on the above two quotes of your's, in the first one you mention that the scenario is an Outbound IDOC and hence "IDOC_OUTPUT_ORDERS", while the second quote mentions having the IDOC status to be "51", now status "51" is for Inbound IDOCs that failed.
Could you please confirm the actual scenario.
So, if I raise that exception the IDOC isn't created.
Presuming that the scenario is outbound, If you want to create an Error IDOC, then just raise the Exception 1: ERROR_MESSAGE_RECEIVED, this should create an IDOC with an error status.
Regards,
Chen