cancel
Showing results for 
Search instead for 
Did you mean: 

Maintenance Order BUS2007 Event: Created and...

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185167
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Ok, I understand but I don´t know how to do it  (I know how create method by creating a subobject and delegating to it) but  I don´t know how to do with release method (Function Module? Transaction?) Attributes (Table? Field?)

Thank in advance

former_member185167
Active Contributor
0 Kudos

Hello,

I don't know it off the top of my head either - that's not really a workflow question. You would face the same problem if trying to do it in ABAP.

Maybe someone else here knows the FM or you could find the answer in another forum by searching SCN (best to use Google for this).

regards

Rick Bakker

former_member185167
Active Contributor
0 Kudos

Hello,

At one site I saw that for this they used a method which called transaction IW32 and used a BDC.

I hope you can find a way to do it without a BDC

regards

Rick Bakker

Former Member
0 Kudos

I find  this BAPI   BAPI_ALM_ORDER_MAINTAIN but I know a little about ABAP and I don´t know how implement this in BO (delegated) for release method.

Thank in advance

paul_bakker2
Active Contributor
0 Kudos

Hi,

See the example code in class CL_RPLM_MP_POWL_ORDER_PM, method RELEASE_ORDERS.

cheers

Paul

Former Member
0 Kudos


Sorry, I tried and I couldn´t. Show this screen the program. I know, i have to fill but I am trying and I got only errors.

BEGIN_DATA OBJECT. " Do not change.. DATA is generated

* only private members may be inserted into structure private

DATA:

" begin of private,

"   to declare private attributes remove comments and

"   insert private attributes here ...

" end of private,

  BEGIN OF KEY,

      NUMBER LIKE AUFK-AUFNR,

  END OF KEY,

      _AUFK LIKE AUFK.

END_DATA OBJECT. " Do not change.. DATA is generated



BEGIN_METHOD REL_MO3 CHANGING CONTAINER.

  CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

    EXPORTING

      IV_MMSRV_EXTERNAL_MAINTENACE =

    TABLES

      EXTENSION_IN =

      RETURN =

      ET_NUMBERS =

      IT_REFORDER_ITEM =

      IT_REFORDER_ITEM_UP =

      IT_REFORDER_SERNO_OLIST_INS =

      IT_REFORDER_SERNO_OLIST_DEL =

      IT_PRT =

      IT_PRT_UP =

      IT_REFORDER_OPERATION =

      IT_SERVICEOUTLINE =

      IT_SERVICEOUTLINE_UP =

      IT_SERVICELINES =

      IT_SERVICELINES_UP =

      IT_SERVICELIMIT =

      IT_SERVICELIMIT_UP =

      IT_SERVICECONTRACTLIMITS =

      IT_SERVICECONTRACTLIMITS_UP =

      ET_NOTIFICATION_NUMBERS =

      IT_PERMIT =

      IT_PERMIT_UP =

      IT_PERMIT_ISSUE =

      IT_METHODS =

      IT_HEADER =

      IT_HEADER_UP =

      IT_HEADER_SRV =

      IT_HEADER_SRV_UP =

      IT_USERSTATUS =

      IT_PARTNER =

      IT_PARTNER_UP =

      IT_OPERATION =

      IT_OPERATION_UP =

      IT_RELATION =

      IT_RELATION_UP =

      IT_COMPONENT =

      IT_COMPONENT_UP =

      IT_OBJECTLIST =

      IT_OBJECTLIST_UP =

      IT_OLIST_RELATION =

      IT_TEXT =

      IT_TEXT_LINES =

      IT_SRULE =

      IT_SRULE_UP =

      IT_TASKLISTS =

    EXCEPTIONS

      OTHERS = 01.

  CASE SY-SUBRC.

    WHEN 0.            " OK

    WHEN OTHERS.       " to be implemented

  ENDCASE.

END_METHOD.

former_member185167
Active Contributor
0 Kudos

You should say what errors.

paul_bakker2
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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 .

Former Member
0 Kudos

The best answer, thank you!!!!!

You know how to explain!

Regards!

Former Member
0 Kudos

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 .

       

.

Former Member
0 Kudos

Thank you for your help, but I never write an ABAP CODE and I don´t know why I have the next problems with the code recommend for Paul Bakker.

Error List

anjan_paul
Active Contributor
0 Kudos

Hi,

  From line no 12 to line no 34 should come after line no 36

Former Member
0 Kudos

Thank you, I am trying learn

Is this the code?

This is the new error

Best regards

former_member185167
Active Contributor
0 Kudos

Hello,

If you are not an ABAPer then you should not be writing ABAP code until you learn how to do so. Luckily, it's easy! In the meantime, leave it to a colleague.

regards

Rick Bakker

Former Member
0 Kudos

Yes, I know. It´s not for a project. It´s for me.

If you don´t want to help me, It´s okay.

Thank you

paul_bakker2
Active Contributor
0 Kudos

Everybody wants to help you (look at the number of replies!), but you're not making it easy.


It's like you are asking for driving directions ('how do I get to the beach?'), but it turns out you don't know how to drive ('how do I start the car?').


Time to crack open a book and learn a bit of basic ABAP. Luckily it's not too difficult.

good luck

Paul

Former Member
0 Kudos

This message was moderated.

former_member185167
Active Contributor
0 Kudos

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