1

I'm checking an implementation of the interface IF_EX_IDOC_CREATION_CHECK which has a method IDOC_DATA_CHECK with 3 parameters:

  1. IDOC_CONTROL type EDIDC
  2. IDOC_DATA type EDIDD_TT
  3. CREATE_IDOC type C

And my problem is that I can't find documentation in internet related to this interface nor examples. I want to know specifically what value does the parameter IDOC_DATA have when is called? Does it process IDocs from one material at a time or it carries all the IDocs of all the materials?

The code that is breaking my head is

loop at idoc_data assigning <it_data>.
  case <it_data>-segnam.
    when  'E1BPE1MATHEAD'. " Segment
      clear: it_mat,zliser.
      it_mathead = <it_data>-sdata.
      ...
      if sy-subrc eq 0. " -------> This 
        exit.           " -------> is my
      endif.            " -------> headache
...

When it comes to the exit. statement it goes out the loop without processing the next IDocs but I don't know exactly if it stops checking all the next IDocs of all the materials or the method IF_EX_IDOC_CREATION_CHECK~IDOC_DATA_CHECK is called again with the next set of IDocs of another material.

Unfortunately I can't run this interface with sample data because it directly changes data of other systems, so I just can read the code.

So if anyone has experience or reference in this issue I'd appreciate your help.

Thanks in advance.

Sandra Rossi
  • 9,036
  • 2
  • 18
  • 39
Nelson Miranda
  • 5,237
  • 5
  • 30
  • 50

1 Answers1

1

The exit statement will cause the program to exit out of the loop, if the loop is the only processing block in the method, it will also exit the method.

However, the BADI/method should be called again for each IDOC.

Don't you have a development or QA environment where you could test this just to be sure?

Esti
  • 3,629
  • 8
  • 33
  • 54
  • Yes I do, unfortunely this implementation is connected directly to other system, so, if I test it I'll write in the other system, but your answer is what I suspected. This is just part of the problem, because it seems like this method keeps information of the last IDOC, so, on the next call the values remain and pollute the current info. I'd like to touch the code and comment the lines that write to the other system and test it, but that is a code on warranty and I just can read it. Thanks for replying. – Nelson Miranda Feb 25 '12 at 15:35
  • Can you find the place where the class is instantiated? It sounds like the object reference is being reused, in stead of being instantiated properly. Or perhaps there are some rogue static attributes left over from the previous IDOC? – Esti Feb 25 '12 at 21:48
  • This BAdi works when a job is activated which internally calls this implementation. I've seen the job with SM37 and it has a variant. On saturday I made my own implementation in DEV and I could run it and as you wrote it calls IDOCs from one material at a time, then passes to the other set. The code implemented also has internal variables which as far as I know, it should clear all of them. I'm debugging, so it's a matter of time to figure out what happens there. – Nelson Miranda Feb 27 '12 at 17:01