Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IDOC Error

Former Member
0 Likes
2,317

Hello friends,

I need to make a field mandatory ina segment of IDOC. I guess this can be acheived by BD65.

However i need to do this for a specific output type. How can I do this. do I need to make coding changes for this issue. IF yes I also need to capture this error message and show against the IDOC number in the Errro message.

ANy inputs.

Thanks, BOB.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,215

I am assuming you know the process of activating the user exits. As you probably know already, this user exit is called once for each segment of the IDoc(shipments?). So in order for you to know what the output type (or was it order type) is, you will need certain data from a certain segment and the field that you want to check for may be in another segment.

So you have to make sure that you do this check only once and you have all the data you need to do the check. Please see what data you are getting by putting a single IF statement in debugging. Then you can decide on the code yourself. Please also check the data in DATA parameter of the function module. I think it will have almost all the data you need to do your check.

14 REPLIES 14
Read only

Former Member
0 Likes
2,215

any suggestions.

Bob

Read only

0 Likes
2,215

Most IDoc function modules have a lot of user exits. Find one that is appropriate and write your logic in there. You cannot use the required field concept through a setting. You will have to do that in your own logic since it is conditionally required.

Read only

0 Likes
2,215

Thanks Srinivas for the suggestion.

I have the EXIT, EXIT_SAPLV56K_002 . In this EXIT I build my IDOC segments and know the place where i would do the check fro my condition. Pls suggest how to code for this.

Thanks,

BOB


FORM CUSTOMER_FUNCTION_002
                USING VALUE(SEGNAM)      LIKE EDIDD-SEGNAM.

  CALL CUSTOMER-FUNCTION '002'
       EXPORTING
            CONTROL_RECORD_OUT = CONTROL_RECORD_OUT
            MESSAGE_TYPE       = CONTROL_RECORD_IN-MESTYP
            SEGMENT_NAME       = SEGNAM
            DATA               = DB_DATA
            TAB_IDOC_REDUCTION = TAB_IDOC_REDUCTION
       TABLES
            IDOC_DATA          = INT_EDIDD
       EXCEPTIONS
              ERROR_MESSAGE_RECEIVED        = 1
              DATA_NOT_RELEVANT_FOR_SENDING = 2.
  CASE SY-SUBRC.
    WHEN 1.
      MESSAGE ID      SY-MSGID
              TYPE    SY-MSGTY
              NUMBER  SY-MSGNO
              WITH    SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
              RAISING ERROR_MESSAGE_RECEIVED.
    WHEN 2.
      MESSAGE ID      SY-MSGID
              TYPE    SY-MSGTY
              NUMBER  SY-MSGNO
              WITH    SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
              RAISING DATA_NOT_RELEVANT_FOR_SENDING.
  ENDCASE.

ENDFORM.                               " CUSTOMER_FUNCTION_002

Edited by: Bob Dan on Sep 29, 2009 8:19 PM

Read only

0 Likes
2,215

Bob,

Take that functions name and go to CMOD. GO to utilities tab and click on find. There go to additional selection and put FM name where you will get the exitname.

Now go to SMOD create project and give exit name you found from above process and activate the component for that user exit. you will get a Z* include and write your code there or you put breakpoint there ans check the interface what are the importing and exporting parameter.

regards,

Nirad Pachchigar

Read only

Former Member
0 Likes
2,216

I am assuming you know the process of activating the user exits. As you probably know already, this user exit is called once for each segment of the IDoc(shipments?). So in order for you to know what the output type (or was it order type) is, you will need certain data from a certain segment and the field that you want to check for may be in another segment.

So you have to make sure that you do this check only once and you have all the data you need to do the check. Please see what data you are getting by putting a single IF statement in debugging. Then you can decide on the code yourself. Please also check the data in DATA parameter of the function module. I think it will have almost all the data you need to do your check.

Read only

0 Likes
2,215

Thanks Srinivas for the Advice.

I know the user EXIT and its activated.

I know the place to write the code and also am aware that this FM would trigger once fro each segment.

My problem is,

within the IF Statement

for E.g

if type = 'ABC'.

here i need some help as how would i stop the further processing of the IDOC and terminate it. Also I need to have a custom error and show it in the IDOC. ( when I see the IDOC in WE02, i need to see this custom error.

Endif.

Thanks,

Bob

Read only

0 Likes
2,215

All you need to do is

IF type = "ABC'.
  MESSAGE Ennn(Zxxx) WITH text-001 text-002 text-003 text-004 RAISING ERROR_MESSAGE_RECEIVED.
ENDIF.

where nnn is your message number, Zxxx is your message class and text-001----text-004 are the variable pieces of your message.

Make sure you raise it as E(rror) message.

Read only

0 Likes
2,215

You can even pick a generic one like E398(00) and pass your message in 4 variables.

Read only

0 Likes
2,215

Thanks Srinivas for the suggestion.

I have tried this option but the problem is i dont see the IDOC when i see in WE02. I want to see the IDOC in WE02 with a error status and the custom message.

Any further suggestions.

Bob

Read only

0 Likes
2,215

TO give more infrormation about the IDOC, Its an OUTBOUND IDOC. i dont want it to be sent across to the third party based on my condition. However i dont want to just miss his with an error. i want an IDOC Number with a fialed status in WE02, so i can correct the data and re process it.

Hoep this explains it all.

Thanks,

Bob

Read only

0 Likes
2,215

Hi ,

In your case, your are making the system to Stop by providing the E message and hence there wont be any idoc cretaed with error status.

One thing you can do is try to change the status of Idoc (if possible) after generation of Idoc number from the customer exit avaialble if any.

Regards,

Naveen

Read only

0 Likes
2,215

Can you see if you can use the exit EXIT_SAPLV56K_001 and set the status field on the control record to an error status?

Read only

0 Likes
2,215

Thanks Srinivas. I have already done this but not succesful. I had changes to Status 51 but it changed back to Status 3 when i see the IDOC.

Bob

Read only

0 Likes
2,215

Bob,

Let me ask you this question; Why do you want to generate an IDoc with the an error status when you already know that IDoc would never be sent out? While asking this question I'm perhaps assuming that you are not thinking to modify the errored IDoc itself to correct the data before sending it. The best practice is to go back to the original document and correct the data there and reprocess the output.

I guess the answer to my question is - you need a mechanism to determine the documents with error/missing data. Correct? If answer to this is yes - this what I have impletemented at one of my clients.

Write customer exit "EXIT_SAPLV56K_002 - Transmit Shipments to IDOC Type" to check the contents of specific segment and raise exception in the event data is not provided for mandatory field.

Once exception is triggered no IDoc will be generated and error gets updated in the NAST protocol. The output status for that output turns red.

Goto transaction VL71 (for Delivery related ouput) or VT70 (for Shipment related output) run the report selecting specific type and Processing mode "3 - Error Processing". This will provide you with a list of documents where error has occured. Then one can go to individual document and correct the error before reprocessing the output with the same transaction.

Hope this helps.

Regards,

Gajendra