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

Error while executing BAPI_ALM_ORDER_MAINTAIN.

Former Member
0 Likes
4,945

Hi friends,

I have an error while executing the BAPI: BAPI_ALM_ORDER_MAINTAIN.

The error message is 119BAPI call must have a SAVE or DIALOG method.

My coding is :

data:IT_METHODS TYPE TABLE OF BAPI_ALM_ORDER_METHOD,
       wa_methods TYPE BAPI_ALM_ORDER_METHOD,
       it_header1 TYPE TABLE OF BAPI_ALM_ORDER_HEADERS_I,
       it_header like IT_HEADER1,

       wa_header TYPE BAPI_ALM_ORDER_HEADERS_I,
       it_return TYPE TABLE OF bapiret2,
       wa_return TYPE bapiret2.
* PARAMETERS ORDERID type aufnr.

   clear wa_methods.
   wa_methods-refnumber = '000001'.
   wa_methods-objecttype = 'HEADER'.
   wa_methods-method = 'CREATE'.
*  wa_methods-objectkey = ORDERID.
   wa_methods-objectkey = '%00000000001'.
   append wa_methods to it_methods. clear wa_methods.
  clear wa_methods.
   wa_methods-refnumber = '000001'.
   wa_methods-objecttype = 'HEADER'.
   wa_methods-method = 'SAVE'.
*  wa_methods-objectkey = ORDERID.
   wa_methods-objectkey = '%00000000001'.
   append wa_methods to it_methods. clear wa_methods.

*-- Header Mapping
   clear wa_header.
   loop at it_methods into wa_methods.
   wa_header-orderid = ORDERID.
   wa_header-order_type = 'PM01'." ordtype.   " order type
   wa_header-planplant = 'PLA1'. "PPLANT.     " plant
   wa_header-mn_wk_ctr = 'DEMO1'."mnwkctr.    " work center
   wa_header-START_DATE = sy-datum.
   wa_header-BASICSTART = sy-uzeit.
   wa_header-short_text  ='maintance order'."shorttxt. "short text value
*  wa_header-FUNCT_LOC  = 'PLA1-SMP'."FUNC_LOC.  "functional location
   wa_header-EQUIPMENT  = 'TEST'."EQUIP.     "equipment
*  wa_header-PMACTTYPE  = '103'.
APPEND wa_header to IT_HEADER.
endloop.



CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
* EXPORTING
*   IV_MMSRV_EXTERNAL_MAINTENACE       = 'E'
   TABLES
     IT_METHODS                         = it_methods
     IT_HEADER                          = 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                       =
*   EXTENSION_IN                       =
    RETURN                             = it_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_ESTIMATED_COSTS                 =
           .

read TABLE it_return INTO wa_return with key type = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT          = 'X'.

READ TABLE it_return INTO wa_return with key type = 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.


data: char type char300.
char = wa_return.

  write:/ 'return' , char .



Please give me some suggestions.


Thanks & regards,

Mahesh

1 ACCEPTED SOLUTION
Read only

Ashg1402
Contributor
0 Likes
3,321

Hi mahesh,

   try this in place of your save method. Don't pass any value for refnumber and objecttype for SAVE. I have done same thing. It will work.

wa_methods-refnumber = ' '.

   wa_methods-objecttype = ' '.

   wa_methods-method = 'SAVE'.

   wa_methods-objectkey = '%00000000001'.

   append wa_methods to it_methods. clear wa_methods.


Regards

Ashish

10 REPLIES 10
Read only

Ashg1402
Contributor
0 Likes
3,322

Hi mahesh,

   try this in place of your save method. Don't pass any value for refnumber and objecttype for SAVE. I have done same thing. It will work.

wa_methods-refnumber = ' '.

   wa_methods-objecttype = ' '.

   wa_methods-method = 'SAVE'.

   wa_methods-objectkey = '%00000000001'.

   append wa_methods to it_methods. clear wa_methods.


Regards

Ashish

Read only

Former Member
0 Likes
3,321

Hi Ashish,

I tried that but now also i am getting the below error .

No authorization for authorization group 3000

regards,

Mahesh

Read only

0 Likes
3,321

Hi,

this can mean that you are not authorized to create order with this type, i.e. PM01.

You can ask from your senior to check the authorizations or roles assigned to you.

Regards

ashish

Read only

Former Member
0 Likes
3,321

Thanks Ashish.

I will check and let you know.

Read only

0 Likes
3,321

Check authorization failure with transaction SU53

Regards,

Raymond

Read only

Former Member
0 Likes
3,321

Hi Ashish,

I tried with refnumber as null, now i am getting the error as Entry 0 in table HEADER (method CREATE) was not found

Regards,

Mahesh

Read only

0 Likes
3,321

Hi Mahesh,

  Refnumber is needed for all the other methods. Only for the 'SAVE' its not needed. Can you copy the part where you are declaring the methods.

First give the refnumber for the HEADER CREATE method, and keep it blank for SAVE. This refnumber is a numeric field , so you can directly declare the value as 1 in place of '000001'.

Try that.

Regards

Ashish

Read only

Former Member
0 Likes
3,321

Hi Ashish,

I found the problem.

It happened because of improper Authorizations.

Regards,

Mahesh

Read only

siva_subramanian2
Participant
0 Likes
3,321

Ask your Colleagues to create orders with their ID and if they are able to create compare and assign the missing authorizations to your ID. SU53 will also help you in displaying the missing authorization.

Read only

Former Member
0 Likes
3,321

Thanks siva & raymond.