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: 

How to check, if production order user status changed

Former Member
0 Kudos
370

Hi experts,

I need to send mail with some information, when production order user status is changed.How can I check it?

Thanks&regards,

Jirka

1 ACCEPTED SOLUTION

former_member262988
Active Contributor
0 Kudos
118

Hi,

User the userexit PPCO0001 and the function module EXIT_SAPLCOBT_001....

keep break-point and check out if status in tables STATUS_TABLE & STATUS_TABLE_OLD is getting changed ......if yes catch the condition and if satisfies your condition declare one flag and upate the flag with 'X' .....and using concept of export memory get the flag value in.......

userexit PPCO0007(which is for while saving of pro order) use the function module EXIT_SAPLCOZV_001 for sending the mail with data ....

Thanks,

Shailaja Ainala.

4 REPLIES 4

former_member262988
Active Contributor
0 Kudos
119

Hi,

User the userexit PPCO0001 and the function module EXIT_SAPLCOBT_001....

keep break-point and check out if status in tables STATUS_TABLE & STATUS_TABLE_OLD is getting changed ......if yes catch the condition and if satisfies your condition declare one flag and upate the flag with 'X' .....and using concept of export memory get the flag value in.......

userexit PPCO0007(which is for while saving of pro order) use the function module EXIT_SAPLCOZV_001 for sending the mail with data ....

Thanks,

Shailaja Ainala.

0 Kudos
118

Hi Shailaja,

thanks for your help. There is a problem, that in table HEADER_TABLE_OLD, information about user status is not filled, so I can't check, if the staus is changed or not.

Jirka

0 Kudos
118

Hi Shailaja,

I tried to implement both userexist ... problem is, that proggram go first through FM EXIT_SAPLCOZV_001 and than through EXIT_SAPLCOBT_001. The second step is run after commit and I can't generate mail in the second one, because manual commit caused short dump.

So I have to implement it somehow in first FM.

Jirka

former_member262988
Active Contributor
0 Kudos
118

Hi,

I too got the similar kind of requirement .....like i need to create purchase order while saving of production order so i also faced the problem..... but the solution which i did is ........

i triggered event for background ( creation of purchase order from p.req) in exit PPCO0001 CALL

METHOD CL_BATCH_EVENT=>RAISE
    EXPORTING
      I_EVENTID                      = 'ZPRD_ORD_CHECK'        "backgroung job id for ZRPT_PO_BACKGROUND
    EXCEPTIONS
      EXCPT_RAISE_FAILED             = 1
      EXCPT_SERVER_ACCEPTS_NO_EVENTS = 2
      EXCPT_RAISE_FORBIDDEN          = 3
      EXCPT_UNKNOWN_EVENT            = 4
      EXCPT_NO_AUTHORITY             = 5
      OTHERS                         = 6.

  CASE SY-SUBRC.
    WHEN 0.
      EXIT.
    WHEN 1 OR 2 OR 3.
* Raise failed.
    WHEN 4.
* Event does not exist.
    WHEN OTHERS.
* Raised failed due to unknown reason.
  ENDCASE.
ENDIF.

-->Created one report where i raised the event

(triggering event)

CALL METHOD cl_batch_event=>raise

    EXPORTING
      i_eventid                      =  'ZME59'
    EXCEPTIONS
      excpt_raise_failed             = 1
      excpt_server_accepts_no_events = 2
      excpt_raise_forbidden          = 3
      excpt_unknown_event            = 4
      excpt_no_authority             = 5
      OTHERS                         = 6.

  CASE sy-subrc.
    WHEN 0.
      EXIT.
    WHEN 1 OR 2 OR 3.
* Raise failed.
    WHEN 4.
* Event does not exist.
    WHEN OTHERS.
* Raised failed due to unknown reason.
  ENDCASE.

--> The event while saving the production order will trigger the background job which is attached to background job program (report) which in turn triggers an event .

--> This way you can write one report program for mail sending .....

This event u set in sm36...Try this way it wil help you

Thanks,

Shailaja Ainala.