Application Development and Automation 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: 
Read only

BAPI_ALM_ORDER_MAINTAIN

Former Member
0 Likes
2,699

Hi,

I need to change the main work center , basic start date and basic end date which are in the header of the maintenance order. I tried using BAPI_ALM_ORDER_MAINTAIN but it is not working . It says Bapi call must have a save or dialog method. Can anyone give a sample code for the same - updating the header details of a maintenance order. Useful answers will be rewarded. Thanks in advance.

Regards,

Prabaharan.G

6 REPLIES 6
Read only

Former Member
0 Likes
1,295

Hi Prabaharan,

I am on ECC 6.0...I was looking at one of the hits for this BAPI and came at this Include

/NRX/ALM_ORDER_PROC

which uses the BAPI...I thought it might be of some help to you....Here is a part of the code from above mentioned Include


*--Create lines in method & text table
      CLEAR f_method.
      MOVE sy-tabix TO ref.
      MOVE ref TO f_method-refnumber.
      MOVE 'TEXT' TO f_method-objecttype.
      MOVE 'CREATE' TO f_method-method.
      MOVE order TO f_method-objectkey.
      APPEND f_method.

      CLEAR f_text.
      MOVE order TO f_text-orderid.
      MOVE i_resb-rsnum TO f_text-reserv_no.
      MOVE i_resb-rspos TO f_text-res_item.
      MOVE t_text-langu TO f_text-langu.
      MOVE counter TO f_text-textstart.

*----Add text lines to table
      LOOP AT t_text WHERE item_number EQ i_resb-posnr
                       AND activity EQ i_resb-vornr.
        CLEAR f_lines.
        MOVE t_text-tdformat TO f_lines-tdformat.
        MOVE t_text-tdline TO f_lines-tdline.
        APPEND f_lines.
        counter = counter + 1.
      ENDLOOP.
      counter = counter - 1.
      MOVE counter TO f_text-textend.
      APPEND f_text.
      counter = counter + 1.
    ENDLOOP.

*--Add SAVE line to method
    CLEAR f_method.
    MOVE 'SAVE' TO f_method-method.
    APPEND f_method.

    CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
      TABLES
        it_methods    = f_method
        it_text       = f_text
        it_text_lines = f_lines
        return        = f_return.

*--Check the return structure, ensure no errors occured
    CLEAR f_error.
    LOOP AT f_return WHERE type EQ 'E'.
      MOVE 'X' TO f_error.
    ENDLOOP.

    IF f_error NE 'X'.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = 'X'
        IMPORTING
          return = f_return.
    ENDIF.

If you haven't done Where-Used List for this BAPI, I suggest you to do it...

Regards,

Vivek

Read only

Former Member
0 Likes
1,295

Hi Viv,

Thanks for the immediate information. I checked the where used list but it has been coded to add text, but my req is to change the existing header data however I managed to find a solution for this and now the order got updated.

I am pasting the code below,

ata: I_METHODS type table of BAPI_ALM_ORDER_METHOD with header line,

I_HEADER type table of BAPI_ALM_ORDER_HEADERS_I with header line,

I_HEADERUP type table of BAPI_ALM_ORDER_HEADERS_UP with header line,

i_return type table of bapiret2.

i_methods-refnumber = '000001'.

i_methods-OBJECTTYPE = 'HEADER'.

i_methods-METHOD = 'CHANGE'.

i_methods-OBJECTKEY = '000005000018'.

append i_methods.

i_methods-OBJECTTYPE = ' '.

i_methods-METHOD = 'SAVE'.

append i_methods.

i_header-orderid = '000005000018'.

i_header-MN_WK_CTR = 'MPEAST'.

append i_header.

i_headerup-orderid = '000005000018'.

i_headerup-mn_wk_ctr = 'X'.

append i_headerup.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

IT_METHODS = i_methods

IT_HEADER = i_header

IT_HEADER_UP = i_headerup

  • 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_TEXT =

  • IT_TEXT_LINES =

  • EXTENSION_IN =

RETURN = i_return

  • ET_NUMBERS =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

Read only

Former Member
0 Likes
1,295

"BAPI_ALM_ORDER_MAINTAIN" is working fine. Code in the above segment of thread

Read only

0 Likes
1,295

Hi ,

How did you solved this problem..

I want change the user status.. Iam passinmg the methods table with refernce key,object type with operation type exiseted in iw33, method save or Change..., and the object key is order prefixed with or..

and the user stas table status zstg , language e, lanag en .. but still iam getting the message S operation type is not valid in method table...

its not updating the user status..

give me the reply...

Read only

0 Likes
1,295

Hi Sampath,

Do you need to update order header status or operation status?

For updating status use the function module which are discussed in the below link,

https://forums.sdn.sap.com/click.jspa?searchID=6752154&messageID=3710549

Regards,

Prabaharan.G

Read only

P507709
Participant
0 Likes
1,295

Hi ,

iam having same requirement , want to up update basic start date for wbs number based on order and system ststus.

system status not to be in teco,clsd,dlfl,dlt.

I have checked u r bapi Suggest me how to update start date.

Thanks

Durgaprasad