BAPI_ALM_ORDER_MAINTAIN operation create
Hi, Dear All
When I create new service order using BAPI_ALM_ORDER_MAINTAIN, How come there is only the first operation input created?
Thanks.
Here is my coding:
DATA: IT_METHODS TYPE BAPI_ALM_ORDER_METHOD OCCURS 0 WITH HEADER LINE,
IT_HEADER TYPE BAPI_ALM_ORDER_HEADERS_I OCCURS 0 WITH HEADER LINE,
IT_HEADER_UP TYPE BAPI_ALM_ORDER_HEADERS_UP OCCURS 0 WITH HEADER LINE,
IT_PARTNER TYPE BAPI_ALM_ORDER_PARTN_MUL OCCURS 0 WITH HEADER LINE,
IT_PARTNER_UP TYPE BAPI_ALM_ORDER_PARTN_MUL_UP OCCURS 0 WITH HEADER LINE,
IT_OPERATION TYPE BAPI_ALM_ORDER_OPERATION OCCURS 0 WITH HEADER LINE,
IT_OPERATION_UP TYPE BAPI_ALM_ORDER_OPERATION_UP OCCURS 0 WITH HEADER LINE,
IT_SRULE TYPE BAPI_ALM_ORDER_SRULE OCCURS 0 WITH HEADER LINE,
IT_SRULE_UP TYPE BAPI_ALM_ORDER_SRULE_UP OCCURS 0 WITH HEADER LINE,
RETURN TYPE BAPIRET2 OCCURS 0 WITH HEADER LINE,
ET_NUMBERS TYPE BAPI_ALM_NUMBERS OCCURS 0 WITH HEADER LINE.
IT_METHODS-REFNUMBER = 1.
IT_METHODS-OBJECTTYPE = 'OPERATION'.
IT_METHODS-METHOD = 'CREATE'.
IT_METHODS-OBJECTKEY = '000000020664'.
APPEND IT_METHODS.
IT_METHODS-REFNUMBER = 1.
IT_METHODS-OBJECTTYPE = ''.
IT_METHODS-METHOD = 'SAVE'.
IT_METHODS-OBJECTKEY = '000000020664'.
APPEND IT_METHODS.
IT_OPERATION-ACTIVITY = '0030'.
IT_OPERATION-CONTROL_KEY = 'SM01'.
IT_OPERATION-WORK_CNTR = 'M1A1'.
IT_OPERATION-PLANT = '110A'.
IT_OPERATION-STANDARD_TEXT_KEY = 'C2-'.
IT_OPERATION-DESCRIPTION = 'Description 1'.
IT_OPERATION-LANGU = 'E'.
APPEND IT_OPERATION.
IT_OPERATION-ACTIVITY = '0040'.
IT_OPERATION-CONTROL_KEY = 'SM01'.
IT_OPERATION-WORK_CNTR = 'M1A1'.
IT_OPERATION-PLANT = '110A'.
IT_OPERATION-STANDARD_TEXT_KEY = 'ZSTAND'.
IT_OPERATION-DESCRIPTION = 'Description 2'.
IT_OPERATION-LANGU = 'E'.
APPEND IT_OPERATION.
IT_OPERATION_UP-ACTIVITY = 'X'.
IT_OPERATION_UP-CONTROL_KEY = 'X'.
IT_OPERATION_UP-WORK_CNTR = 'X'.
IT_OPERATION_UP-PLANT = 'X'.
IT_OPERATION_UP-STANDARD_TEXT_KEY = 'X'.
IT_OPERATION_UP-DESCRIPTION = 'X'.
IT_OPERATION_UP-LANGU = 'X'.
APPEND IT_OPERATION_UP.
APPEND IT_OPERATION_UP.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
IT_METHODS = IT_METHODS
IT_HEADER = IT_HEADER
IT_HEADER_UP = IT_HEADER_UP
IT_HEADER_SRV =
IT_HEADER_SRV_UP =
IT_USERSTATUS =
IT_PARTNER = IT_PARTNER
IT_PARTNER_UP = IT_PARTNER_UP
IT_OPERATION = IT_OPERATION
IT_OPERATION_UP = 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
IT_SRULE_UP = IT_SRULE_UP
IT_TASKLISTS =
EXTENSION_IN =
RETURN = RETURN
ET_NUMBERS = ET_NUMBERS
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
hi,
If you want to create two operations then we have to append one more operation line in IT_METHODS with
REFNUMBER = 2.
ADD the code which is in bold to your code to get required output.
IT_METHODS-REFNUMBER = 1.
IT_METHODS-OBJECTTYPE = 'OPERATION'.
IT_METHODS-METHOD = 'CREATE'.
IT_METHODS-OBJECTKEY = '000000020664'.
APPEND IT_METHODS.
*IT_METHODS-REFNUMBER = 2.*
*IT_METHODS-OBJECTTYPE = 'OPERATION'.*
*IT_METHODS-METHOD = 'CREATE'.*
*IT_METHODS-OBJECTKEY = '000000020664'.*
*APPEND IT_METHODS*
IT_METHODS-REFNUMBER = 1.
IT_METHODS-OBJECTTYPE = ''.
IT_METHODS-METHOD = 'SAVE'.
IT_METHODS-OBJECTKEY = '000000020664'.
APPEND IT_METHODS.
IT_OPERATION-ACTIVITY = '0030'.
IT_OPERATION-CONTROL_KEY = 'SM01'.
IT_OPERATION-WORK_CNTR = 'M1A1'.
IT_OPERATION-PLANT = '110A'.
IT_OPERATION-STANDARD_TEXT_KEY = 'C2-'.
IT_OPERATION-DESCRIPTION = 'Description 1'.
IT_OPERATION-LANGU = 'E'.
APPEND IT_OPERATION.
IT_OPERATION-ACTIVITY = '0040'.
IT_OPERATION-CONTROL_KEY = 'SM01'.
IT_OPERATION-WORK_CNTR = 'M1A1'.
IT_OPERATION-PLANT = '110A'.
IT_OPERATION-STANDARD_TEXT_KEY = 'ZSTAND'.
IT_OPERATION-DESCRIPTION = 'Description 2'.
IT_OPERATION-LANGU = 'E'.
APPEND IT_OPERATION.
IT_OPERATION_UP-ACTIVITY = 'X'.
IT_OPERATION_UP-CONTROL_KEY = 'X'.
IT_OPERATION_UP-WORK_CNTR = 'X'.
IT_OPERATION_UP-PLANT = 'X'.
IT_OPERATION_UP-STANDARD_TEXT_KEY = 'X'.
IT_OPERATION_UP-DESCRIPTION = 'X'.
IT_OPERATION_UP-LANGU = 'X'.
APPEND IT_OPERATION_UP.
APPEND IT_OPERATION_UP.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
IT_METHODS = IT_METHODS
IT_HEADER = IT_HEADER
IT_HEADER_UP = IT_HEADER_UP
IT_HEADER_SRV =
IT_HEADER_SRV_UP =
IT_USERSTATUS =
IT_PARTNER = IT_PARTNER
IT_PARTNER_UP = IT_PARTNER_UP
IT_OPERATION = IT_OPERATION
IT_OPERATION_UP = 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
IT_SRULE_UP = IT_SRULE_UP
IT_TASKLISTS =
EXTENSION_IN =
RETURN = RETURN
ET_NUMBERS = ET_NUMBERS
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
Regards,
Sravanthi
Similar Messages
-
Oms installation stack in Operation Creating OMS Respository is in progres
Hi All !!!
Im installing oms r2 on Linux AS4 .. all gent ok, all the checks ...
but the installing stack in the almost the las part(the last part is the agent configuration) Operation Creating OMS Respository is in progress, and what i can see is that both CPU ar at 100% constant, i just wonder what i missed ? is there a patch for OMS release2 on linux ? it will be great if some one could give an idea how to fix this
Thansk alot !!hello,
I have the same problem in win32. How did you solve it?
Thanks
Gonçalo Ribeiro -
BAPI_ALM_ORDER_MAINTAIN - operation-decription INITIAL
Hi all,
i'm trying to use BAPI_ALM_ORDER_MAINTAIN to add new operations.
If i pass values to STANDARD_TEXT_KEY and to DESCRIPTION i'll find on operation only the standard key.
The standard KEY is defined without any text in transaction CA10.
If i try to set description using IW32 i have no problem, both elements are filled.
Best regards,
SAPDUMMYHi madhurao123, thanks for your answer.
My issue is not about text.
I'm talking about two operations fields (BAPI_ALM_ORDER_OPERATION-STANDARD_TEXT_KEY and DESCRIPTION).
If i use a STANDARD_TEXT_KEY that has not a text (transaction CA10) and i fill the field DESCRIPTION, i'll have an operation with the standard_text_key and not with the description (blank).
This is my code:
CONCATENATE ord noper INTO t_methods-objectkey.
t_methods-refnumber = nmethop.
t_methods-objecttype = 'OPERATION'.
t_methods-method = 'CREATE'.
APPEND t_methods.
CLEAR t_methods.
t_operation-activity = noper.
t_operation-control_key = 'Z002'.
t_operation-standard_text_key = 'PREV'.
t_operation-work_cntr = tg_header-mn_wk_ctr.
t_operation-plant = zpmtb0001-iwerk.
CONCATENATE 'Preventivo:' preventivo '/' 'Versione:' simulazione
INTO t_operation-description SEPARATED BY space.
t_operation-acttype = 'BO0003'.
t_operation-mrp_relevant = '1'.
t_operation-quantity = '1'.
t_operation-base_uom = 'NUM'.
t_operation-langu = 'I'.
APPEND t_operation.
CLEAR t_operation.
t_operation_up-activity = 'X'.
t_operation_up-standard_text_key = 'X'.
t_operation_up-control_key = 'X'.
t_operation_up-work_cntr = 'X'.
t_operation_up-plant = 'X'.
t_operation_up-description = 'X'.
t_operation_up-acttype = 'X'.
t_operation_up-mrp_relevant = 'X'.
t_operation_up-quantity = 'X'.
t_operation_up-base_uom = 'X'.
t_operation-langu = 'X'.
APPEND t_operation_up.
CLEAR t_operation_up.
Thanks. -
Production order status, header released, operations created
Hello, I´m struggling with the following problem on production orders
When you look to first line in the header you see that the order is on release. When you go to the operation operation overview the operations are still on created
How is this possible and how to resolve?
If I click on release operation: Invalid function selected comes up.
Br MatthiasHi,
Plz go to production order operation tab, select operations & just check below a relese flag , just 3 ICON RIGHT TO Component tab, prt tabs.
& click it , operation should be released, if still not released then delete opeartion & recreate them manually.
Thanks.........Rakesh -
ADF Entity Object: Securable Operation "Create"?
Hello,
I have the following scenario: Within one view I have a table bound to a view object that bases on an entity object. The view also contains a "create insert" button.
Now I want to secure the "create insert" operation with a certain application role. However, within the entity object I can only activate the removeCurrentRow, read and update options as securable operation. Is there any way to control the creation of new items?
Regards,
MichaelHi.
welcome to forum!
Maybe this post can be useful http://andrejusb.blogspot.com/2011/03/how-to-enable-create-operation-security.html -
BAPI_ALM_ORDER_MAINTAIN Operation User Status Update
Hi All,
I am trying to use this BAPI_ALM_ORDER Maintain to update the user status at the Operation level, but am facing the following issue:
In the IT_METHODS table, I am passing the USERSTATUS CHANGE (with the right object key - aufnr + vornr), and SAVE Method.
And am filling the User Status table (IT_USERSTATUS) with the correct user status to be updated at the Operation Level.
But when I execute the BAPI - it throws an error saying that the User status XXXX doesnt exist in the XXXXXX (This is the wrong profile. This profile is at the Header level and not at the operation level) Profile.
So somehow its trying to update at the Header level and not at the operation level.
Any idea what can be the reason?
Regards
AnkurHi,
BAPI_ALM_ORDER_MAINTAIN user status Change
check out this link..
Thanks & regards. -
Problem in creating Maintenance Order with multiple operations
Hello all,
I am facing problem while creating Maintenance Order with multiple operations and sub-operations. I am using BAPI : BAPI_ALM_ORDER_MAINTAIN.
For single operation it is working fine,but i am unable to create MO with multiple operations and sub-operations.
Please, provide me the inputs required,
I have used methods :
ORDER CREATE,
OPERATION CREATE
and SAVE.
Regards,
SiddharthaHi,
The FM you are using is a perfect one. This FM is bit tricky to use. You need to perfectly pass the Reference number field. which links various input table parameters of this FM.
Thanks & Regards,
Navneeth K. -
BAPI_ALM_ORDER_MAINTAIN want to create partner .
hello all ,
I want to create partner using BAPI_ALM_ORDER_MAINTAIN ,
put i am not able to create it please help me .
Thanks and regards,
PremHello,,
Below things i got from Help from FM
OBJECTKEY SAP-external object key-->
This key is for assigning the lower-level objects correctly to the corresponding objects, as there is always just one key in the data table. The key must have the following structure:
1-12 Order number
When creating orders with internal number assignment, a reference number beginning with % must be entered here. The BAPI then returns this number and the number actually assigned.
13-16 Operation number
17-20 Suboperation number
For relationships, the key is structured as follows:
1-12 Order number from
13-16 Operation number from
17-28 Order number to
29-32 Operation number to
The following methods are possible for the individual methods:
HEADER
CREATE, CHANGE, RELEASE, TECHNICALCOMPLETE, ATPCHECK, CALCUALTE, SCHEDULE, CREATETONOTIF
OPERATION
CREATE, CHANGE, DELETE, DELETEDSEX
PARTNER, RELATION, COMPONENT, USERSTATUS, TEXT, SRULE, OBJECTLIST, PRT
CREATE, CHANGE, DELETE
OLISTRELATION
CREATE, DELETE
TASKLIST
ADD
(empty)
SAVE, DIALOG, TRACE
Regards,
Rakesh -
How to create an order based on Notification through BAPI_ALM_ORDER_MAINTAIN
Hi
I need to create an order based on the notification no. This is manually can be done using the Standard T.Code IW34.I am using BAPI_ALM_ORDER_MAINTAIN to create an order based on Notification. I am getting the below message( which is success message)
Order %00000000001 saved with number 40001258
BAPI control was ended
Though order is created it not assigned to notification No. I am using ref key as '%00000000001' and also I tried with '%0000000000140232323' where 40232323 is notification No.
And if I checked in order the notification No is assigned to order as '%00000000001'. And when I check back the Notification, the order is not assigned to Notification No. How to assign the created order no to Notification No.
Code is attached for Ref.
Now the problem is the order is not assigned to notification no. Is there any FM or BAPI to do the same fucntionality..!
Regards,
AmarHello Amarnadh,
Keng Haw Soon is right, object key should always have the client like 010.
In your code you were passing it without the client.
Pass like below and it will work.
ls_methods-objectkey = '%00000000001000040232323'.
Regards,
Thanga -
Create work order using BAPI_ALM_ORDER_MAINTAIN
Does anybody know how to use BAPI_ALM_ORDER_MAINTAIN to create a maintenance order? I did a where used and it isn't used by SAP. The documentation makes it look like I can use it for create but I am not sure how to do that.
Regards,
DavisHi,
I have one sample code piece. try to fit your requirement.
TYPES: t_alm_method type bapi_alm_order_method occurs 1.
TYPES: t_alm_component type bapi_alm_order_component occurs 1.
TYPES: t_alm_component_up type bapi_alm_order_component_up occurs 1.
TYPES: BEGIN of tp_sv_update,
aufnr type aufnr,
method type t_alm_method,
component type t_alm_component,
component_up type t_alm_component_up,
END of tp_sv_update.
DATA: ls_method type bapi_alm_order_method.
DATA: ls_component type bapi_alm_order_component.
DATA: ls_component_up type bapi_alm_order_component_up.
DATA: ls_sv_update type tp_sv_update.
DATA: lv_tabix like sy-tabix.
STATICS: sv_refno type i.
clear: lv_tabix, sv_refno.
ls_sv_update-aufnr = gt_alv1_data-aufnr.
endif.
sv_refno = sv_refno + 1.
ls_method-refnumber = sv_refno.
ls_method-objecttype = 'COMPONENT'.
ls_method-method = 'CHANGE'.
ls_method-objectkey = gt_alv1_data-aufnr.
APPEND ls_method to ls_sv_update-method.
if sv_refno eq 1.
ls_method-refnumber = sv_refno.
ls_method-objecttype = space.
ls_method-method = 'SAVE'.
ls_method-objectkey = gt_alv1_data-aufnr.
APPEND ls_method to ls_sv_update-method.
endif.
ls_component-reserv_no = gt_alv1_data-rsnum.
ls_component-res_item = gt_alv1_data-rspos.
ls_component-activity = gt_alv1_data-vornr.
ls_component-material = gt_alv1_data-matnr.
if gt_alv1_data-menge_up is not initial.
ls_component-requirement_quantity = gt_alv1_data-menge_up.
endif.
if gt_alv1_data-netpr_up is not initial.
ls_component-price = gt_alv1_data-netpr_up.
ls_component-currency = gt_alv1_data-waers.
* It appears the Price is not updated unless the quantity is
if gt_alv1_data-menge_up is initial.
ls_component-requirement_quantity = gt_alv1_data-bdmng.
endif.
endif.
APPEND ls_component to ls_sv_update-component.
if gt_alv1_data-menge_up is not initial.
ls_component_up-requirement_quantity = 'X'.
endif.
if gt_alv1_data-netpr_up is not initial.
ls_component_up-price = 'X'.
ls_component_up-currency = 'X'.
* It appears the Price is not updated unless the quantity is
ls_component_up-requirement_quantity = 'X'.
endif.
APPEND ls_component_up to ls_sv_update-component_up.
if lv_tabix is not initial.
SORT ls_sv_update-method by method.
MODIFY gt_sv_update from ls_sv_update
index lv_tabix transporting method component component_up.
else.
APPEND ls_sv_update to gt_sv_update.
endif.
if gt_alv1_data-menge_up is not initial.
move 'UPDATED' to gt_alv1_data-input_menge.
endif.
if gt_alv1_data-netpr_up is not initial.
move 'UPDATED' to gt_alv1_data-input_netpr.
endif.
modify gt_alv1_data transporting input_menge input_netpr.
LOOP at gt_sv_update.
CLEAR: lt_return[].
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = gt_sv_update-method
it_component = gt_sv_update-component
it_component_up = gt_sv_update-component_up
return = lt_return.
ENDLOOP. -
Creating a Service Order automatically when saving a Sales Order
Hello SDN,
I'm trying to have SAP automatically create a Service Order when a Sales Order is created. To this end, I've tried implementing BADI workitem_template and have been using method before_update. I've been using BAPI BAPI_ALM_ORDER_MAINTAIN to create the service order.
The problem is that in order for the BAPI to save the service order, the sales order needs to be fully saved and operational. Otherwise it just keeps saying 'sales order does not exist'. So the problem is that the BADI is intervening too soon in the saving process. The temporary sales order numbers have been replaced with actual ones, but the records do not show in the database just yet. I think there's a commit that still needs to be done or something.
However, I cannot find a BADI or user exit that intervenes after the sales order is saved into the database, so this leaves me stranded.
Any suggestions would be heartily apprechiated.
Kind Regards,
Niels.
Edited by: Niels Ruelens on Feb 20, 2008 4:20 PM
Edited by: Niels Ruelens on Feb 20, 2008 4:22 PMFollowing your suggestions, I've created an update function module and inserted it into the USEREXIT_SAVE_DOCUMENT. In this function module, I'm calling the BAPI.
Problem with this approach is that I cannot debug, nor is he actually doing anything. Here's the code that is put in the function. Is there anything wrong with the way I call the BAPI perhaps?
DATA:
lt_srule TYPE TABLE OF bapi_alm_order_srule,
lt_bheader TYPE TABLE OF bapi_alm_order_headers_i,
lt_srule_up TYPE TABLE OF bapi_alm_order_srule_up,
lt_methods TYPE TABLE OF bapi_alm_order_method,
lt_return TYPE TABLE OF bapiret2,
ls_vbak TYPE vbak,
ls_vbap TYPE vbap,
ls_bheader TYPE bapi_alm_order_headers_i,
* ls_header TYPE cobai_s_header,
ls_prps TYPE prps,
ls_srule TYPE bapi_alm_order_srule,
ls_srule_up TYPE bapi_alm_order_srule_up,
ls_methods TYPE bapi_alm_order_method.
* ls_item TYPE cobai_s_item.
SELECT SINGLE * INTO ls_vbak
FROM vbak
WHERE vbeln = vbeln.
SELECT SINGLE * INTO ls_vbap
FROM vbap
WHERE vbeln = vbeln.
FREE: lt_methods, lt_bheader, lt_srule.
* Fill methods
CLEAR ls_methods.
ls_methods-refnumber = 1.
ls_methods-objecttype = 'HEADER'.
ls_methods-method = 'CREATE'.
ls_methods-objectkey = '%00000000001'.
APPEND ls_methods TO lt_methods.
* CLEAR ls_methods.
* ls_methods-refnumber = 1.
* ls_methods-objecttype = 'SRULE'.
* ls_methods-method = 'CREATE'.
* ls_methods-objectkey = '%00000000001'.
* APPEND ls_methods TO lt_methods.
CLEAR ls_methods.
ls_methods-refnumber = 1.
ls_methods-objecttype = ''.
ls_methods-method = 'SAVE'.
ls_methods-objectkey = '%00000000001'.
APPEND ls_methods TO lt_methods.
* Fill header
CLEAR ls_bheader.
ls_bheader-orderid = '%00000000001'.
ls_bheader-order_type = 'ZM02'.
ls_bheader-funct_loc = 'FERBL_TD5C_DER'.
ls_bheader-planplant = 'B006'.
ls_bheader-sales_ord = vbeln.
ls_bheader-s_ord_item = '00010'.
APPEND ls_bheader TO lt_bheader.
** Convert the internal WBS to an external WBS element
* SELECT SINGLE * INTO ls_prps
* FROM prps
* WHERE pspnr = ls_vbap-ps_psp_pnr.
** Fill settlement rules
* ls_srule-objnr = ls_item-aufnr.
**** ls_srule-sales_ord = caufvd_imp-kdauf_aufk.
**** ls_srule-s_ord_item = caufvd_imp-kdpos_aufk.
* ls_srule-wbs_element = ls_item-projn.
* ls_srule-settl_type = 'FUL'.
* ls_srule-percentage = 100.
* ls_srule-extnr = 1.
* APPEND ls_srule TO lt_srule.
* ls_srule_up-wbs_element = 'X'.
* ls_srule_up-sales_ord = 'X'.
* ls_srule_up-s_ord_item = 'X'.
* ls_srule_up-orderid = 'X'.
* ls_srule_up-settl_type = 'X'.
* ls_srule_up-percentage = 'X'.
* ls_srule_up-extnr = 'X'.
* APPEND ls_srule_up TO lt_srule_up.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = lt_methods
it_header = lt_bheader
* 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 = lt_srule
* it_srule_up = lt_srule_up
* IT_TASKLISTS =
* EXTENSION_IN =
return = lt_return.
* ET_NUMBERS =.
IF sy-subrc = 0.
ENDIF.
Edited by: Niels Ruelens on Feb 20, 2008 4:58 PM -
Error while executing Bapi_Alm_Order_Maintain...
Hi All,
I'm getting this error while executing Bapi_Alm_Order_Maintain.
"BAPI call-up must have a SAVE or DIALOG method"
The following is the input data structures:
IT_METHOD
RefNumber ObjectType Method ObjectKey
1 HEADER CREATE %00000000001
1 OPERATION CREATE %00000000001
IT_HEADER
OrderId Order_Type Short_Text Priority Mn_Wk_Ctr Wbs_Elem
%00000000001 ZWO1 Test 3 1010 00000101
IT_OPERATION
Activity Sub_Activity Description Work_Cntr Plant Control_Key
0010 0010 Test TS-1074 ZWO1
What I need to do to create a work order transaction?
Thanks
SundarTry adding following line in IT_METHODS after OPERATION.
RefNumber ObjectType Method ObjectKey
1 SAVE %00000000001
Reward points for all the helpful answers. -
Regarding Service Order(IW34) creation using BAPI_ALM_ORDER_MAINTAIN
Hi Gurus,
While Creating Service order through BAPI:BAPI_ALM_ORDER_MAINTAIN, Operations tab is only updating for One activity eventhough I Passed 4 activities. also the components tab with the same problem.
Could any plz suggest....
Thanks in Advance..
Regards,
Venkat.Venkat,
Check whether you have maintained the proper methods for the key in IT_METHODS table parameter.You should be able to find the relevant values to be passed on the long text of the parameter within the BAPI.
Regards
Narasimhan -
BAPI for transaction IW31 (creating a work order)
Hi all,
I need to be able to create a work order ( IW31) using ABAP code and was wondering if any knew if there was a BAPI that should be used for this functionality.
Thanks in advance
Marthi,
You can use
BAPI_ALM_ORDER_MAINTAIN.
Have a look at the following documentation.
FU BAPI_ALM_ORDER_MAINTAIN
Text
Process Maintenance-/Service Order
Functionality
This Business Application Programming Interface (BAPI) is used for changing maintenance- or service orders and their lower-level objects. The following objects of an order can be processed (for restrictions, see the note at the end of the documentation):
Order header
Partner
User status
Order operations
Relationships
Components
Long texts for order header, operations, and components
Function
Calling up this BAPI once allows you to perform all the operations. For this the system supplies the function module with a method table containing the methods to be performed. The entries in the method table refer to data records in the optionally filled-out data tables. All the methods from the method table are performed. Alternatively, just lower- level objects from existing orders can be changed.
You can process the transferred data with the Business Add-In (BAdI) IBAPI_ALM_ORD_MODIFY to, for example, merge data from the external system with data from the R/3 system. The BAdI is called up as soon as the transferred data is converted into the internal format. The tests then take place after this.
Construction of Method Table
REFNUMBER Reference number for linking object methods - attributes
The reference number is the line of the database which contains the corresponding data. The data table is determined by the object type.
OBJECTTYPE Object category
The object category specifies which object from the order should be processed. The key words listed here are not language-dependent and must be transferred exactly as they are. The following objects exist:
HEADER Order header
PARTNER Partner data
USERSTATUS User status
OPERATION Operation data
RELATION Relationships
COMPONENT Components
TEXT Long texts
(empty) ,General BAPI functions (save)
METHOD Methods
The methods with which the data should be processed. The following functions exist:
CREATE Create objects
CHANGE Change objects
DELETE Delete objects
RELEASE Release
TECHNICALCOMPLETE Technically complete
ATPCHECK Availability check
CALCULATE Calculate
SCHEDULE Schedule
DELELTEDSEX Delete the status for external scheduling at operation level
SAVE Save all data
DIALOG Call-up dialog. See explanation below.
TRACE Write trace file in the specified file to the frontend
OBJECTKEY SAP external object key
This key is for assigning the lower-level objects correctly to the corresponding objects, as there is always just one key in the data table. The key must have the following structure:
1-12 Order number
When creating orders with internal number assignment, a reference number beginning with % must be entered here. The BAPI then returns this number and the number actually assigned.
13-16 Operation number
17-20 Sub-operation number
For relationships, the key is structured as follows:
1-12 ,Order number from
13-16 Operation number from
17-28 Order number to
29-32 Operation number to
The following methods are permissible for the individual objects:
HEADER:
CREATE, CHANGE, RELEASE, TECHNICALCOMPLETE, ATPCHECK, CALCUALTE, SCHEDULE
OPERATION
CREATE, CHANGE, DELETE, DELETEDSEX
PARTNER, RELATION, COMPONENT, USERSTATUS, TEXT:
CREATE, CHANGE, DELETE
(empty):
SAVE, DIALOG, TRACE
Data tables and update tables
The objects have one or more data tables. For some objects you can specify which of the fields specified in the structure should be changed. For this you must set the field in the corresponding table to X as in the data table. If no update-table is transferred, then only those fields are set that have a value that is not initial. This simplifies the transfer data. However, this means it is not possible to delete fields. If an update structure should only be specified for some data records, the table with the update fields must nonetheless have the same amount of lines as the data table. The empty lines are then treated as if no update structure was transferred. The objects "Partner", "User Status", and "Text" have no update tables. The whole data record is always copied here.
References
The objects use the field REFNUMBER from the method table to refer to the lines in the data table. Counting always begins with 1. In doing this, REFNUMBER also refers to the update table. However, in the method table there is a second reference to higher-level objects for lower-levels objects. The field OBJECTKEY must be filled with order number, operation number, and sub-operation number, as specified above. If lower-level objects of a newly-created order should be changed, then you must enter a temporary order number that must begin with %. Several orders can be numbered serially, for example, with %00000000001, %00000000002 ... .
The following objects have special treatment for REFNUMBER:
Partner
Texts
Partners have an order number in the data table. During processing of the method table, all those entries in the data table are processed which have an order number that is the same as that in the line to which the method refers. Thus, through just one entry in the method table, several partners can be changed.
Texts are composed of two tables. The first table (IT_TEXT) is made up of the header data of the text. Here you must specify the object and the first and last line of the text table (respectively inclusive, counting from 1). Through this, a line segment is specified in the text line table (IT_TEXT_LINES).
Peculiarities in processing
The BAPI processes the transferred methods in a particular sequence, which must not correspond to the sequence in the methods table.
Write trace file
Change user status time period 1
Delete objects (dependent first)
Create new objects
Change existing or newly-created objects
Change user status time period 2
Status change of order
Save data
The methods are performed such that lower-level objects can also be assigned to newly-created objects. For example, first the operations are created, and then the components. Long texts can also be created for the objects.
Components have an exceptional position. Components are created through the assignment to an operation, that is, using the "key" order/ operation (item number). However, as this is not the unique component key, you can only access the components to change them, delete them, or add long texts by using the reservation number/-item, which is only given after saving. This means that, for example, you cannot create a long text when you create the component.
User status changes can take place at two different time points. Time point 1 is before the object changes, time point 2 is after the object changes and before the status change of the system. These time points should be defined in the transfer table in the field CHANGE_EVENT. The field documentation contains the possible values.
The external scheduling is offered by the BAPI as a special function. THe BAPI can set the date field directly at the operation level, and select the operation with the status DSEX "Date set by external system". This status prevents any further scheduling of the operation, it keeps the transferred dates. For this, set the category 'X' in the restriction categories. When reading the operation, this category is also returned, independent of the category of restriction set in the dialog. To delete the status, you can call up the method DELETEDSEX for the object operation. The external scheduling cannot be influenced in the dialog. All changes to the scheduling restrictions in the dialog are saved as normal, but are not relevant for the scheduling as long as the status DSEX is active.
Every time the BAPI is called up, a SAVE or DIALOG method must be transferred. Normally, calling up a BAPI is seen as a transaction. All data that is changed in the BAPI should be saved to the database immediately. The BAPI checks whether a SAVE method exists, otherwise it terminates processing. A test run of the BAPI is composed of a normal call-up using the SAVE method and a subsequent BAPI_TRANSACTION_ROLLBACK. To call up the BAPI without the SAVE method, for example, to realize dialog transactions, the BAPI can be called up with the DIALOG method. This switches off the check for the SAVE method. The processor must then ensure that later either a SAVE method or a BAPI_TRANSACTION_ROLLBACK is called up.
A BAPI_TRANSACTION_COMMIT without SAVE method terminates processing in the update to ensure that no inconsistent data is written to the database. The processor who called up the BAPI does not receive any confirmation for the termination of the update in the target system. This logic is necessary as the order data was flagged for updating with BAPI_TRANSACTION_COMMIT through the SAVE method. However, the status information was already flagged for updating when the BAPI was called up. A BAPI_TRANSACTION_COMMIT without SAVE method then just saves the status information and would generate inconsistent orders, if the updating was not terminated.
Customer Enhancement
The BAdI IBAPI_ALM_ORD_MODIFY can be used to change the transferred data. The BAdI is called up after the conversion of the transfer structure into the structures used internally. Additional data can be transferred using the table EXTENSION_IN. Only then is the data checked.
Example
The following examples should clarify the use.
Creating an order
OBJECTKEY should be filled with a temporary key. The BAPI returns this key together with the assigned order number in the return table ET_NUMBERS . The order number in the HEADER table should also be filled with the number. For external number assignment, the external number should be specified. The update structure can be transferred if necessary.
Methods table
REFNUMBER OBJECTTYPE METHOD OBJECTKEY
1 HEADER CREATE %00000000001
IT_HEADER
ORDERID ORDER_TYPE PLANPLANT ...
%00000000001 PM01 1000 ...
Creating an order with operation and long text
Methods table
REFNUMBER OBJECTTYPE METHOD OBJECTKEY
1 HEADER CREATE %00000000001
1 OPERATION CREATE %00000000001
1 TEXT CREATE %000000000010010
IT_HEADER
ORDERID ORDER_TYPE PLANPLANT ...
%00000000001 PM01 1000 ...
IT_OPERATION
ACTIVITY SUB_ACTIVITY CONTROL_KEY WRK_CNTR ...
10 PM01 MECHANIC ...
IT_TEXT
ACTIVITY ... TEXTSTART TEXTEND
10 ... 1 2
IT_TEXT_LINES
TDFORMAT TDLINE
Longtext for operation 10, line 1
Line 2 of the long text
Notes
Using the BAPI to process the order data cannot support all the functions of the transaction. This applies in particular for the following functions:
Order header data
The object list cannot be processed.
Refurbishment orders are not supported.
The estimated costs cannot be processed - only the estimated overall costs of the order.
Notification data cannot be processed with the order BAPI. Even if the settings in Customizing are such that the orders and notifications can be maintained on one screen, no notification is created for the order.
Permits cannot be processed.
The order addresses cannot be processed.
Individual partner addresses cannot be maintained.
The settlement rule cannot be maintained.
Order functions
Printing the papers is not possible.
Locking and unlocking the order is not possible.
Accepting and rejecting quotations is not possible.
Business completion is not possible.
Flagging for deletion is not possible.
The log cannot be displayed.
User default values are not used.
The field selection is not checked.
The Customer Exits/BAdIs are not executed completely.
Joint ventures are not supported.
Funds Management is not supported.
Investment orders are not supported.
No integration of service products with task lists possible.
No integration of configurable service products possible.
Assignment of sales document items with service products in accordance with the aforementioned conditions.
Operation data
A change of the control key in the operation is not possible, if this leads to a change of the processing type (internal-/external processing)
User status change not possible.
Production resources and tools cannot be processed.
Service lines cannot be processed.
Task list integration is not supported.
Linking operations with object list is not supported.
Component data
User status change not possible.
BOM data cannot be processed.
The delivery address cannot be processed.
Further Information
See also the documentation for the individual transfer tables.
Parameters
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_TEXT
IT_TEXT_LINES
EXTENSION_IN
RETURN
ET_NUMBERS
Exceptions
Function Group
IBAPI_ALM_ORDER
~~Guduri -
Fields that needs to be populated for executing BAPI_ALM_ORDER_MAINTAIN
Hi,
I need to execute BAPI_ALM_ORDER_MAINTAIN to create Production Orders, Components, Operations and Equivalence numbers for co-procuts components.
Could you please help me with the fields that needs to be populated so that the BAPI can be successfully executed to get the desired result.
Thanks in advance !!Hi,
Please check this links
http://abap.wikiprog.com/wiki/BAPI_ALM_ORDER_MAINTAIN
Problem with BAPI_ALM_ORDER_MAINTAIN Change Activity
Re: Use BAPI_ALM_ORDER_MAINTAIN - code example
Hope it helps.
Regards
Hiren K.Chitalia
Maybe you are looking for
-
How to call a SAPME web service from MII
Dears, How can I call a SAPME web service from MII such as PlaceFutureHold? By using MII, I would like to develop some logic to check some values which query from SAPME database, if the value is out of spec, it needs to send a emal to inform user ans
-
HP Laserjet 1012 -- suddenly stopped printing; gives cryptic message
I have an HP Laserjet 1012 hooked up to my iMac. The driver is already installed on the system, and there is no updated driver available from HP. It's been performing wonderfully until today. Now, everytime I attempt to print, it just prints a page w
-
My iCloud is defaulting to an old Hotmail address that I no longer use, my apple ID is currently functioning fine with a gmail account. I'm not able to change my iCloud email on my phone or on desktop... Any advice?
-
My account settings deleted & cannot get mail, how to reset?
My Account settings were deleted apparently when a key was touched by mistake. The Server settings are gone. All I have left are the Outgoing Server (which is same as the Incoming server, which is no longer there) and Junk Settings and Disk Space. Lo
-
I have CS3 and today I cannot select "gamut warning" when I proof colors. The Mode is set to RBG. If I set the mode to CMYK or Lab Color then it will allow me to select gamut warning. There must be some setting I changed but I cannot figure out ho