Application Development 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: 

Send deleted PO IDOCs via message control

former_member125661
Contributor
0 Kudos

I have a message control system with output determination working fine for PO creation and change.

I am using a custom message type - ZORDERS1 and a custom output type - ZNEU.

I have 2 lines for message control in the outbound partner profile.

Both have process code of ME10 and one of them has change (checkbox ticked ) and other spaced.

I have a user routine to check some conditions which will generate the output. But when I delete all the items of the PO, the automatic output determination works .But not the way I expect..It doesn't trigger the user routine and upon saving doesn't generate the idoc at all.

Is deletion of PO's and sending deleted PO's follow a different approach than changing a PO ?

Thanks in advance.

Shareen

1 ACCEPTED SOLUTION

Jelena
Active Contributor
0 Kudos

Shareen,

I used everything standard, except for the output type. For the IDocs I used 2 message types - ORDERS (ME10) and ORDCHG (ME11). Both were linked to my ZNEU output type. It worked just fine with changes, deletions, etc. (deletion is just a change on PO, by the way).

The reason may be in your routine (where did you put it, by the way - in output requirements?). And what does the processing log say for the messages?

Edited by: Jelena Perfiljeva on Jul 23, 2008 11:25 PM

8 REPLIES 8

Jelena
Active Contributor
0 Kudos

Shareen,

I used everything standard, except for the output type. For the IDocs I used 2 message types - ORDERS (ME10) and ORDCHG (ME11). Both were linked to my ZNEU output type. It worked just fine with changes, deletions, etc. (deletion is just a change on PO, by the way).

The reason may be in your routine (where did you put it, by the way - in output requirements?). And what does the processing log say for the messages?

Edited by: Jelena Perfiljeva on Jul 23, 2008 11:25 PM

0 Kudos

Thanks for the response.

I am using my custom message type ZORDERS1 and custom condition type Z005. In the partner profile for my output type, i have 2 process codes ME10 (with and without check box for change). I did not use ME11.

The output message is - No items exist in PO header messages upon saving. Output determination does happen..But the user routine is not triggered for deletion.

I thought i will use process code for ME10 alone because I have a requirement where the entire PO with all line items should be present in IDOC when only 1 line item is changed.

I have put my routine in output requirements. It is triggered for create and change..But not when I delete all the items of the PO.

Jelena, for ORDCHG, did u check this check-box for change ? Here is my output routine.

*&--------------------------------------------------------------------*
*&      Form  kobed_911
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM kobev_911.

  DATA: plant_sw(1)  TYPE c,
        l_bustype(3) TYPE c.


  DATA:   tab_count(6)   TYPE n,
          low_werks(4)   TYPE c,
          low_vend(6)    TYPE c,
          find_sw(1) TYPE c,
          i_name     TYPE tvarvc-name,
          i_type     TYPE tvarvc-type.    "IC1K900750 end



  DATA: i_flag    TYPE c,
  i_pot     TYPE TABLE OF bekpo WITH HEADER LINE,
  l_tab(60) TYPE c,
  l_output  TYPE c.

  data : lv_plant type werks_d .


  FIELD-SYMBOLS <prod>.

break roitmot.

 sy-subrc = 4.

  LOOP AT xnast WHERE kschl EQ komt1-kschl AND
                      objky EQ msg_objky   AND
                      aktiv EQ space       AND
                      vstat EQ '0'.
    EXIT.
  ENDLOOP.


  CHECK sy-subrc NE 0.


  sy-subrc = 4.
  l_output = 'N'.

* Process only on Create or Change...
  IF ( komkbea-druvo EQ neu OR komkbea-druvo EQ aend ) and (
komkbea-bsart = 'NB' ).

    l_tab = '(SAPLMEPO)pot[]'.
    ASSIGN (l_tab) TO <prod>.
    CHECK sy-subrc = 0.
    i_pot[] = <prod>.


    loop at i_pot.
clear lv_plant.
select single werks from zwm_plntparnr into lv_plant where werks eq
i_pot-werks .


      if sy-subrc eq 0 and i_pot-mtart eq 'ROH'.
   set parameter id 'WRK' field lv_plant.

        l_output = 'Y'.
      endif.
    endloop.

    if l_output eq 'Y'.
      clear sy-subrc .
    else.
      sy-subrc = 4.
    endif.

   ENDIF.


ENDFORM.                                                    "KOBEv_911
*---------------------------------------------------------------------*
*       FORM KOBEV_973                                                *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM kobed_911.

  data : lv_plant type werks_d .

  DATA: plant_sw(1)  TYPE c,
        l_bustype(3) TYPE c.

  DATA:   tab_count(6)   TYPE n,
          low_werks(4)   TYPE c,
          low_vend(6)    TYPE c,
          find_sw(1) TYPE c,
          i_name     TYPE tvarvc-name,
          i_type     TYPE tvarvc-type.    "IC1K900750 end

  DATA: i_flag    TYPE c,
        i_pot     TYPE TABLE OF bekpo WITH HEADER LINE,
        l_tab(60) TYPE c,
        l_output  TYPE c.


  FIELD-SYMBOLS <prod>.

break roitmot.


 sy-subrc = 4.


  LOOP AT xnast WHERE kschl EQ t683s-kschl AND
                      objky EQ msg_objky   AND
                      aktiv EQ space       AND
                      vstat EQ '0'.
    EXIT.
  ENDLOOP.

  CHECK sy-subrc NE 0.

  sy-subrc = 4.
  l_output = 'N'.


* Process only on Create or Change...
  IF ( komkbea-druvo EQ neu OR komkbea-druvo EQ aend ) and (
komkbea-bsart = 'NB' ).

    l_tab = '(SAPLMEPO)pot[]'.
    ASSIGN (l_tab) TO <prod>.
    CHECK sy-subrc = 0.
    i_pot[] = <prod>.

     loop at i_pot.
clear lv_plant.
select single werks from zwm_plntparnr into lv_plant where werks eq
i_pot-werks .


      if sy-subrc eq 0 and i_pot-mtart eq 'ROH'.
*       EXPORT lv_plant TO MEMORY ID 'KOBED_911_PLANT' .

        l_output = 'Y'.
      endif.
    endloop.


  ENDIF.

  if l_output eq 'Y'. "Output EDI
    clear sy-subrc .
  else.
    sy-subrc = 4.  " Do not ouput
  endif.

ENDFORM.                                                    "kobed_911

So do you reckon i need to have 2 output types ? One for create and another for change/delete ?

I cannot have Me10 and Me11 in my message control settings in Partner profile..But i can use Me10 twice with and without checkbox ticked next to it.

Edited by: Shareen Hegde on Jul 23, 2008 11:44 PM

Jelena
Active Contributor
0 Kudos

1. When you go to Messages screen, what exactly do you see there? A blank screen and the message "No items exist" at the bottom of the screen? Are there any entries with your output type and, if so, what color is their status (green / yellow / red) and what is in their processing log?

2. How did you arrive at the conclusion that "the user routine is not triggered for deletion"? Did you expect that it'll go into debugger at your breakpoints? I'm pretty sure that output routines run in their own update task and they won't stop at your breakpoints when you save a PO. It doesn't mean they are not triggered.

3. I'm not quite sure what's the purpose of your routines... Did you put them in the output determination requirements? This is meant to check whether the output record should be created or not. I have a feeling that your routine will never get past this point (not sure though what's msg_objky value):

sy-subrc = 4.
  LOOP AT xnast WHERE kschl EQ komt1-kschl AND
                      objky EQ msg_objky   AND
                      aktiv EQ space       AND
                      vstat EQ '0'.
    EXIT.
  ENDLOOP.
  CHECK sy-subrc NE 0.
  sy-subrc = 4.

What's the purpose of this piece of code?

My requirements were different - we had to create an IDoc only with the changed (or deleted, which is technically the same) items in it. That's probably the reason why I used ORDCHG (and yes, I checked the 'Change' box).

I have a feeling that you're making this more complicated than it should be. If you use ORDERS with ME10 and Change check box then most likely you'll get an IDoc with all the PO items every time when PO is created or changed. Is this what you're trying to do?

There is also a place in configuration where you specify, which fields will be considered "change" (you probably wouldn't need an IDoc if someone just entered a text on the PO, for example). It's in SPRO:

Materials Management -> Purchasing -> Messages -> Fields Relevant to Printouts of Changes.

Deletion flag is EKPO-LOEKZ.

I have my own document with all the steps that I did when configuring the IDoc output. If you contact me (there should be a button somewhere, maybe on my profile), I'll be happy to send it to you.

Good luck!

0 Kudos

I am using Orders (ME10 in message control) twice and once with change field checked because I want to send all the items of the PO to this 3d party system even if 1 line is changed or deleted.

In the print-relevant Purch Doc changes, I have EKPO-LOEKZ checked . I also see a routine # 3 next to it. I am beginning to wonder if deletion has its own requirement routine.

Yes.I do have the breakpoint in the requirement routine and it does stop for creation and change (except for deletion).

Let me tell u what happens when I delete a line item with my present setup.

When i delete an item and click on message(PO header), I do see the yellow lights indicating that change that took place with my output type, correct partner number..(but it did not stop at my routine..usually it does for any changes or when i create a po ). Everything appears to look normal (even though this happened without the requirement routine triggering..I think system just mimicked the already green output type which was created when I created the PO for the first time). Now, when i save it (again skipped the req routine).I save the PO..GO to PO in ME23N and see the message, I see a red light, indicating that the Output was not generated (IDOC was not created) .I click on the processing log..I see the following message..

GREEN Object 4500068197

GREEN Output type: PO EDI Output

GR Processing log for program RSNASTED routine EDI_PROCESSING

RED No items exist

The purpose of the user routine is to create IDOC/ generate output only when certain conditions are met.The idea is to generate the output when PO doc type is 'NB' and if the po line item (I get it from work table pot[] ) has atleast 1 plant that is on a Ztable and the matertial type if 'ROH'. It works the way it is supposed to for Create and Change. But this routine is not even touched for deletion.

My fear is that ORDERS(ME10) dont work for deletion. I cannot use both ME10 and ME11 in partner profile/message control(Both unchecked), because my belief is that if I use ORDCHG(ME11), only items that changed will be on the IDOC , not all the items of the PO.

The loop at XNAST part of req. routine is present in the standard routine 101 of NEU too. So, I just had it.

THese routines are called 2 times when I click on message after change/create and 2 times when I click on save. But never called when I delete. Anyways, thanks for trying to help me. I will send you my e m@il ID, so that I can see your document. Thanks again.

Jelena
Active Contributor
0 Kudos

OK, I found an answer (you might not like it though). It is in OSS note Note 456127 - FAQ: Electronic Data Interchange (EDI) in purchasing:

1. Question:
In the purchase order, one or more items have a deletion indicator. Why are these not transferred with the IDoc?
Answer:
Deleted items are only issued with IDoc type ORDCHG. You may have selected the wrong ME10 process code for the output of change messages in the partner profile. To set the partner profile correctly, see the answer to the next question.

2. Question:
In the partner profiles for the ORDERS outgoing message, the change message was also entered.
Answer:
You can use IDoc type ORDCHG for the output of changes. Define the following data in the outbound parameters for the respective partner:
        » application: EF
        » message type: enter the corresponding value
        » transaction code: ME11 (is linked to IDOC_OUTPUT_ORDCHG)
        » change message: X

I think that you're most likely right - ORDCHG IDoc will include only the deleted items. So you would either have to ask to change the requirements (why do they need non-changed items, anyway? it doesn't make any sense) or might have to write an IDoc user exit or something to add the missing items. Which, I bet, will be a pain in the back... You might also want to send a message to SAP and ask if there is a way around this.

The routine # 3 on LOEKZ is just for the text processing (hit F1 on it, there is an explanation).

0 Kudos

THis is what I feared too. I have to send all these IDOCs to a 3rd party system (EDI) called Swisslog (A WMS system) and that system doesn't understand if I just send changes..So I have to send the whole PO with all the line items. I had tried Me10 and Me11 ( with 'X' for change ) earlier under my message type (ZORDER1). But this wouldn't trigger the user routine too when there is any change. I am still perplexed why the user routine is not triggered . I am thinking of either coming up with my new process code and a FM that mimick both ME10 & Me11 or doing the coding to fill all the fields and additional items in the user exit for ME11. :-s

I wish this was ALE where sending just the changes would work.But thats not the case.

THanks again.

Shareen

shashi_urs
Explorer
0 Kudos

Hi,

We are also doing same thing. Means using ME10 in ORDER and ME10 agian in ORDERCHG but with change check box ticket. As per the standard if all line items of PO ar deleted then IDOC doe snot get generated and standard error "No Items exist" occurs.

Any way how to over come this.

Why we are using ME10 twice as our requirment is to send latest version of the PO. Whcih cna be fulfilled in this way. If we use ME11 then only changed line item is sent out an throid party cannot handle the same.

Former Member
0 Kudos

Hi,

Have you found the solution to send IDOC on PO deletion?

Please let me know how you did it.

Thanks,