Skip to Content
avatar image
Former Member

Maintenance Order BUS2007 Event: Created and...

Hello experts, I have created a Workflow with the following steps:

For a Maintenance Order

- Trigger when BUS2007 Event:Created is reached

- User Decision: Approval/Rejected   Maintenance Order

Now, I need  if I choose Approval, the Maintenance Order is released automatically.

What do you do this?

Thank in advance for your help.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 07, 2014 at 10:52 PM

    Hello,

    Assuming you know how to release a Maintenance Order in SAP, you have to add a Release method to BUS2007 (by creating a subobject and delegating to it). Then create a TS task to call that method. Finally, create a step in your workflow to call that task.

    regards

    Rick Bakker

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      Did you actually look at the sample code that I suggested?

      It's pretty simple! OK, let me post it here for you.

          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
             EXPORTING
              input  = ls_result-aufnr
            IMPORTING
              output = lv_aufnr.


      * fill methods to prepare for BAPI
            ls_methods-refnumber = '000000'.
            ls_methods-objecttype = 'HEADER'.
            ls_methods-method = 'RELEASE'.
            ls_methods-objectkey = ls_result-aufnr.
            APPEND ls_methods TO lt_methods.

            CLEAR ls_methods.
            ls_methods-method = 'SAVE'.
            APPEND ls_methods TO lt_methods.


      * set status to Released
            CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
              TABLES
                it_methods = lt_methods
                return     = lt_return.

      cheers

      Paul

  • avatar image
    Former Member
    Sep 08, 2014 at 05:25 AM

    Hi Cristian ,

    What I understand is you want to release the maintenance order using workflow approval process .


    Steps :

    1.In workflow header > start event use object type and link this with event .

    2.use user decision activity step .

    3.Delegate the BUS2007 and add a method in which write the code to release the maintenance order as suggeted by Paul use 'BAPI_ALM_ORDER_MAINTAIN' . Here use OBJECT-KEY-NUMBER as the maintenance order no .

           

    .

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello,

      Over at the ABAP forum there are hundreds of people standing by to help you with your ABAP syntax errors.

      Good luck in your SAP career!

      regards

      Rick Bakker

  • avatar image
    Former Member
    Sep 09, 2014 at 07:24 AM

    Hi Cristian ,

    You dont need to worry , you can learn ABAP !!!

    You are getting this error as you have not implimented the method which you have created .

    Follow these steps .

    Step 1 . Go to EDIT >> CHANGE RELEASE STATUS > IMPLIMENT

    Now Release the same method .

    Step 2.  Write this code inside the method .

    DATA : lt_methods TYPE STANDARD TABLE OF bapi_alm_order_method ,

           ls_methods TYPE bapi_alm_order_method,

           lt_return TYPE STANDARD TABLE OF bapiret2 ,

           lv_aufnr TYPE aufnr .



    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

      EXPORTING

        input  = object-key-number

      IMPORTING

        output = lv_aufnr.



    * fill methods to prepare for BAPI

    ls_methods-refnumber = '000000'.

    ls_methods-objecttype = 'HEADER'.

    ls_methods-method = 'RELEASE'.

    ls_methods-objectkey = lv_aufnr.

    APPEND ls_methods TO lt_methods.



    CLEAR ls_methods.

    ls_methods-method = 'SAVE'.

    APPEND ls_methods TO lt_methods.



    * set status to Released

    CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

      TABLES

        it_methods = lt_methods

        return     = lt_return.

    Step 3.    Now save and generate the Method and the custom BOR .

    It should work .

    All the best .

    Regards ,

    Ashish Gaur .

    Add comment
    10|10000 characters needed characters exceeded