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
Mart

hi,
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

Similar Messages

  • Bapi for transaction va21

    hi!
    is there any bapi for transaction va21 creating qoutation?
    regards
    yifat

    Hi Yifat,
        There are two BAPI's to create Quotation.
    BAPI_QUOTATION_CREATEFROMDATA
    This BAPI has been released.
    BAPI_QUOTATION_CREATEFROMDATA2
    This BAPI has not been released yet.
    There is small problem when you use these two BAPI's they dont update the document flow (i.e) these BAPI's will allow you to create 'n' number quotations for a single Inquiry, which according to business is not allowed.
    You can do an alternate method, which you can use a BDC to create a Quotation and the updation part for that Quotation can be done with a BAPI 'BAPI_CUSTOMERQUOTATION_CHANGE'.
    Hope this might be useful.
    Regards,
    Tushar
    Reward points if found useful.

  • Create a work order using the BAPI for IW31

    Hi,
          I want to create a work order using the BAPI for IW31 tr. can any one help me with the program description.
    Full points will be awarded for the useful answers.
    Thanks and regards,
    Sunil

    hi,
      first use fm "bapi_po_create".
      then use fm "BAPI_ACC_GL_POSTING_POST"
    The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
    •     No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
    •     In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
    •     A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM).

  • LSMW method for transaction IW31 (Service Order)

    Hi all,
    I am looking for a way to create multiple Service Orders using LSMW, but no Recording.
    Transaction would be IW31.
    Can you give some tips please?
    Thank you! Walter.

    Hi Brenda, thanks for the confirmation you found in the notes!
    Can you tell me how to use the BAPI for mass-upload / migration? I haven't done that before, but it looks to me that we won't use LMSW for that, but tr.code SE37, right?
    I found out that the BAPI you mention belongs to Business Object BUS2088A, wich cannot be selected in the first LSMW-step.
    So the idea is then to write an Abap-program which reads my input-file (which contains all the data to create the service-orders) and then call the BAPI several times to create the Service-Orders one by one. Am I right, or is there a standard way to use this BAPI for mass-upload?
    Thanx again, Walter.

  • Customization for create 2 Work orders for different vendors against 1 PR

    Hi,
    What are the customization settings  to create 2 work orders for 2 different vendors against 1 PR with half-half quantity?

    thank you Mario.
    Actuly its infrastructure cmpany & user wants create Purchase order(service work order) for two different vendors with reference to single PR with alocating 60% quantity to 1st vendor & remaining 40% to another vendor.
    user allready created Po for 1st vendor (60% Quantity).
    Now system showing error " Quantity is allready full for reference PR"
    I want to know what is the procedue to solve this issue & customization.

  • Creating new work order - error on %001

    Hi all,
    Creating a new work order from the SAP Work Manager 6.0 application should be a standard functionality,
    However, on the system of our client, this goes wrong.
    Upon creating a new work order, we get the error 'Enter a numerical operation number'.
    New objects get an ID that starts with 'LOCAL_xx:xx:xx', which is converted to %001.
    SAP should recognize this and convert this automatically to 0010, 0020, ...
    how come this does not happen?
    it works fine on our SAP system, our customer's system gives an error.
    Kind regards,
    Judith

    Have you done any enhancement to  standard  product "specifically create method of  Work  Order Class handler" . or the standard product functionality itself is not working ?
    I don't see any reason why it works in your system but not in customer system. Try to put break point in create method of Work order class handler and check what  values are passed  for operation  number before invoking Work  Order create BAPI. 
    Infact Work Manager product converts local numbers to incremental  sequential  numbers before invoking create BAPI for Work Order.
    BR,
    Manju - SAP CEG UX/Mobile

  • LSMW for changing user status on work order(IW32)

    Hi All,
    I have created a LSMW for changing user status on work order using transaction IW32. It does not change the status when i run the LSMW. In the recording for the LSMW, i select the radio button on the user status i want to select.
    When i run the LSMW in the foreground, it does everything except select the correct status.
    Is there a way to fix this or is it a problem with LSMW. I'm using ECC6
    Kind Regards
    Emanuel

    Hi ,
    I am not sure whether it would work with LSMW but if your on ECC 6.00 ,Enhacement Pack 3 then you have BADIs which allow you to make collective status changes in IW38 .The below are those BADIs :-
    BADI_EAM_RIAUFK20_FCODE_CUS1 :Implement Customer Function Code in Order List
    BADI_EAM_RIAUFK20_FCODE_SAP1 :Implement SAP Function Code in Order List
    Else if your on lower version then write up a batch programme which checks the PM Order types with specific status and sets user status using FM STATUS_CHANGE_EXTERN[This is used to set or delete User Status] in SE37 ..
    regrds
    pushpa

  • BAPI for Transaction VA01?

    How to Develope an interface program to upload the sales order data from legacy system to SAP using BAPI for Transaction VA01.Explain me clearly?

    VA01:
    BAPI_SALESORDER_CREATEFROMDAT1
    BAPI_SALESORDER_CREATEFROMDAT2
    steps for bapi creation
    STEP 1 - Define a structures for the BAPI
    In this step a structures for the parameters and tables of the function module used for the BAPI are defined.
    Use Data type -> Structure
    Define the following structures:
    ZBAPI_ORDER_STATUS_IMPORT which contains the following fields:
    ORDERID Order number (Keyfield)
    SPRAS Language
    ExcludeInactive - Checkbox - Exclude inactive status
    ZBAPISTAT:
    STEP 2 - Write Function Module
    Important notes:
    Each BAPI must have its own function group.
    Under the attributes tab remember to select Processing Type Remote Enabled module, otherwise the function module cannot be invoked via RFC and used as a BAPI
    Import/Export parameters can only be BY VALUE for an RFC enabled function module
    We are only creating one BAPI in this example, but you can create related BAPIs in the same function pool, so they will be able to share global data.
    Code
    Notes:
    The subroutine SET_RETURN_MESSAGE is a standard routine used for BAPIs that use the BAPIRETURN structure
    In form Z_BAPI_GET_ORDER_SYSTEM_STATUS there is a test IF 1 = 2. If the test is true a message is displayed. The condition will obviously never be true, and we will never want to display a message in a BAPI. The reason why it is included is, that it create a reference for the message, so that the WHERE USED functionality can be used for the message. This is the SAP standard way to handle it, copied from the Company Code GetList BAPI.
    INCLUDE LZBAPISTATUSUXX
      THIS FILE IS GENERATED BY THE FUNCTION LIBRARY.             *
      NEVER CHANGE IT MANUALLY, PLEASE!                           *
    INCLUDE LZBAPISTATUSU02.
                        "Z_BAPI_GET_ORDER_SYSTEM_STATUS
    INCLUDE LZBAPISTATUSTOP - Global data
    FUNCTION-POOL ZBAPISTATUS.                  "MESSAGE-ID Z3
    Types:
      begin of Type_tj02t,
        istat  like tj02t-istat,
        txt04  like tj02t-txt04,
        txt30  like tj02t-txt30,
      end of type_tj02t.
    DATA:
    Declarations for TABLE parameter
      T_BAPISTAT like ZBAPISTAT occurs 0,
      G_BAPISTAT like ZBAPISTAT,
    Table for object texts
      t_tj02t    type type_tj02t occurs 0,
      g_tj02t    type type_tj02t.
    Structure for return messages
    DATA:
      BEGIN OF MESSAGE,
        MSGTY LIKE SY-MSGTY,
        MSGID LIKE SY-MSGID,
        MSGNO LIKE SY-MSGNO,
        MSGV1 LIKE SY-MSGV1,
        MSGV2 LIKE SY-MSGV2,
        MSGV3 LIKE SY-MSGV3,
        MSGV4 LIKE SY-MSGV4,
      END OF MESSAGE.
    INCLUDE LZBAPISTATUSF01 - Subroutines
    ***INCLUDE LZBAPISTATUSF01 .
    *&      Form  SET_RETURN_MESSAGE
    This routine is used for setting the BAPI return message.
    The routine is a standard routine for BAPIs that handles the message
    structure for the BAPIRETURN structure. It has been copied from the
    BAPI Company Code Getlist
         -->P_MESSAGE  text
         <--P_RETURN  text
    form SET_RETURN_MESSAGE USING    VALUE(P_MESSAGE)   LIKE MESSAGE
                            CHANGING P_RETURN  LIKE BAPIRETURN.
      CHECK NOT MESSAGE IS INITIAL.
      CALL FUNCTION 'BALW_BAPIRETURN_GET'
           EXPORTING
                TYPE       = P_MESSAGE-MSGTY
                CL         = P_MESSAGE-MSGID
                NUMBER     = P_MESSAGE-MSGNO
                PAR1       = P_MESSAGE-MSGV1
                PAR2       = P_MESSAGE-MSGV2
                PAR3       = P_MESSAGE-MSGV3
                PAR4       = P_MESSAGE-MSGV4
             LOG_NO     = ' '
             LOG_MSG_NO = ' '
           IMPORTING
                BAPIRETURN = P_RETURN
           EXCEPTIONS
                OTHERS     = 1.
    endform.                    " SET_RETURN_MESSAGE
    FUNCTION Z_BAPI_GET_ORDER_STATUS
    FUNCTION z_bapi_get_order_system_status.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(I_AUFNR) TYPE  AUFNR
    *"     VALUE(I_SPRAS) TYPE  SPRAS DEFAULT SY-LANGU
    *"     VALUE(I_EXCLUDEINACTIVE) TYPE  CHAR1 OPTIONAL
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRETURN
    *"  TABLES
    *"      T_BAPISTAT STRUCTURE  ZBAPISTAT
    DATA:
       l_aufnr LIKE afko-aufnr,
       l_objnr LIKE jest-objnr.
    Check if order exists
    SELECT SINGLE aufnr
        FROM afko
        INTO  l_aufnr
        WHERE aufnr = BAPI_ORDER_STATUS_IMPORT-orderid.
      IF sy-subrc NE 0.
        CLEAR message.
        message-msgty = 'E'.
        message-msgid = 'Z3'.
        message-msgno = '000'.
        message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.
        PERFORM set_return_message USING    message
                                   CHANGING return.
        IF 1 = 2.
        The only reason to include this statement, that will obviously
        never execute, is that it will create a referecence so that you
        can find out where a particular message is being used. This
        functionality is used by the BAPIs programmed by SAP
          MESSAGE e000(z3).
        ENDIF.
      ENDIF.
      CHECK return IS INITIAL.
    Read order status
    CONCATENATE 'OR' BAPI_ORDER_STATUS_IMPORT-orderid INTO l_objnr.
      IF BAPI_ORDER_STATUS_IMPORT-i_excludeinactive = 'X'.
        SELECT objnr stat inact
          FROM  jest
          INTO  TABLE t_bapistat
          WHERE objnr = l_objnr AND
                inact  'X'.
      ELSE.
        SELECT objnr stat inact
          FROM  jest
          INTO  TABLE t_bapistat
          WHERE objnr = l_objnr.
      ENDIF.
      IF sy-subrc  0.
      No object status found
        CLEAR message.
        message-msgty = 'E'.
        message-msgid = 'Z3'.
        message-msgno = '001'.
        message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.
        PERFORM set_return_message USING    message
                                   CHANGING return.
        IF 1 = 2.
          MESSAGE e001(z3).
        ENDIF.
      ENDIF.
      CHECK return IS INITIAL.
    Read order status texts
      SELECT istat txt04 txt30
        FROM tj02t
        INTO TABLE t_tj02t
        FOR ALL ENTRIES IN t_bapistat
        WHERE istat = t_bapistat-stat AND
              spras = BAPI_ORDER_STATUS_IMPORT-i_spras.
      SORT t_tj02t BY istat.
      LOOP AT t_bapistat INTO g_bapistat.
        READ TABLE t_tj02t
          WITH KEY istat = g_bapistat-stat BINARY SEARCH
         INTO g_tj02t.
        IF sy-subrc = 0.
          MOVE:
            g_tj02t-txt04 TO g_bapistat-txt04,
            g_tj02t-txt30 TO g_bapistat-txt30.
          MODIFY t_bapistat FROM g_bapistat TRANSPORTING txt04 txt30.
        ENDIF.
    ENDLOOP.
    ENDFUNCTION.
    OBJNR like JEST-OBJNR
    STAT like JEST-STAT
    INACT like JEST-INACT
    TXT04 like TJ02T-TXT04
    TXT30 likeTJ02T-TXT30
    Important note:
    You will have to define a structure for every parameter in the BAPI. You cannot use the same structures used in existing applications because BAPI structures are frozen when BAPIs are released and then there are restrictions on changing them.
    STEP 3 - Create the API Method Using the BAPI WIZARD
    The BAPI wizard is used toTo expose the remote function module as a BAPI. The wizard will generate some additional code, so the function module is a valid method of the BOR. This allows the BAPi to be called as a workflow method in addition to be called by an outside program.
    Note: Each function module corresponds to a method in the BOR
    Go to the Business Object Builder SWO1.
    You can either create the new Object type as a subtype of an existing business object or create a new business object from scratch. In this example it would be obvious to create the Object type as a subtype of BUS2005 Production order. However, to illustrate how to create a new Object type from scratch, we will do this.
    In the Object/Interface type field write the name of the new Business Object: ZORDERSTAT. Press enter and fill in the additional fields necessary to create the object type.
    Supertype: Not relevant because we are creating our object from scratch
    Program. This is the name of the program where the wizard generates code for the Object type, NOT the function module we created earlier. The program name must not be the name of an existing program.
    Press enter and create the new business object. Note that when you create the business object a standard interface, an attribute ObjectType and the methods ExistenceCheck and Display are automatically generated. These cannot be changed !
    The next step is to add the Z_BAPI_GET_ORDER_STATUS method to the business object. Select Utilities -> API methods -> Add method and write the name of the function module in the dialog box. Next the dialog ox show below will be shown. This is the start screen of the BAPI wizard. Proceed with wizard by pressing the button.
    After you have finished the wizard, you will notice that the ZGetOrderStatus has been added to the business object:
    You can double-click on the method to see its properties. To use the business object you must change the Object type status to Implemented. Use menu Edit->Change releases status->Object type->To implemented. No you can test the object (Press F8).
    Note that the BAPI wizard has added a wrapper class for the function module so it can be sued as method in the business object. Choose menu Goto->Program to display the program:
              Implementation of object type ZORDERSTAT           *****
    INCLUDE <OBJECT>.
    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,
          KEY LIKE SWOTOBJID-OBJKEY.
    END_DATA OBJECT. " Do not change.. DATA is generated
    BEGIN_METHOD ZGETORDERSTATUS CHANGING CONTAINER.
    DATA:
          BAPIORDERSTATUSIMPORT LIKE ZBAPI_ORDER_STATUS_IMPORT,
          RETURN LIKE BAPIRETURN,
          TBAPISTAT LIKE ZBAPISTAT OCCURS 0.
      SWC_GET_ELEMENT CONTAINER 'BapiOrderStatusImport'
           BAPIORDERSTATUSIMPORT.
      SWC_GET_TABLE CONTAINER 'TBapistat' TBAPISTAT.
      CALL FUNCTION 'Z_BAPI_GET_ORDER_STATUS'
        EXPORTING
          BAPI_ORDER_STATUS_IMPORT = BAPIORDERSTATUSIMPORT
        IMPORTING
          RETURN = RETURN
        TABLES
          T_BAPISTAT = TBAPISTAT
        EXCEPTIONS
          OTHERS = 01.
      CASE SY-SUBRC.
        WHEN 0.            " OK
        WHEN OTHERS.       " to be implemented
      ENDCASE.
      SWC_SET_ELEMENT CONTAINER 'Return' RETURN.
      SWC_SET_TABLE CONTAINER 'TBapistat' TBAPISTAT.
    END_METHOD.
    STEP 4 - Final stepsWhen the Business object has been checked and the documentation created, the following steps must be carried out:
    Release the BAPI function module (in the Function Builder).
    Release the business object type (in the BOR ObjectType -> Change release status to -> Implemented ).
    Release the BAPI as a method in the BOR (Release the methods you has created - Set the cursor on the method then
    Edit -> Change release status -> Object type component -> To released )
    For potential write BAPIs: Release the IDoc and its segments
    You can now display the BAPI in the BAPI Explorer:
    for detailed expalnation
    http://www.erpgenie.com/abap/bapi/example.htm
    do reward if helpful

  • IDOC/ BAPI for transaction FB60

    Hi Experts,
    Can anybody tell me IDOC/ BAPI for transaction FB60 for document type (KR = Original Invoice).
    Thanks

    Hi Venkata,
    Please refer below code, this works similar to FB60.
    REPORT z_bapi_test.
    *REPORT acc_bapi_test_document .
    SELECTION-SCREEN BEGIN OF BLOCK bl01 .
    PARAMETERS:
    check_l RADIOBUTTON GROUP rb1,
    check_a DEFAULT 'X' RADIOBUTTON GROUP rb1,
    post RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN ULINE.
    PARAMETERS:
    rev_c RADIOBUTTON GROUP rb1,
    rev_p RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN ULINE.
    PARAMETERS:
    ref_key LIKE bapiache01-obj_key DEFAULT 'TEST000001BAPICALL',
    dest LIKE bdi_logsys-logsys DEFAULT ' '.
    SELECTION-SCREEN END OF BLOCK bl01 .
    DATA:
    gd_documentheader LIKE bapiache09,
    gd_customercpd LIKE bapiacpa09,
    gd_fica_hd LIKE bapiaccahd,
    it_accountreceivable LIKE TABLE OF bapiacar09 WITH HEADER LINE,
    it_accountgl LIKE TABLE OF bapiacgl09 WITH HEADER LINE,
    it_accounttax LIKE TABLE OF bapiactx09 WITH HEADER LINE,
    it_criteria LIKE TABLE OF bapiackec9 WITH HEADER LINE,
    it_valuefield LIKE TABLE OF bapiackev9 WITH HEADER LINE,
    it_currencyamount LIKE TABLE OF bapiaccr09 WITH HEADER LINE,
    it_return LIKE TABLE OF bapiret2 WITH HEADER LINE,
    it_receivers LIKE TABLE OF bdi_logsys WITH HEADER LINE,
    it_fica_it LIKE TABLE OF bapiaccait WITH HEADER LINE,
    it_accountpayable LIKE TABLE OF bapiacap09 WITH HEADER LINE,
    it_paymentcard LIKE TABLE OF bapiacpc09 WITH HEADER LINE,
    it_ext LIKE TABLE OF bapiacextc WITH HEADER LINE.
    it_re LIKE TABLE OF bapiacre09 WITH HEADER LINE,
    it_ext2 LIKE TABLE OF bapiparex WITH HEADER LINE.
    PERFORM fill_internal_tables.
    IF check_l = 'X'.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    DESTINATION dest
    EXPORTING
    documentheader = gd_documentheader
    customercpd = gd_customercpd
    contractheader = gd_fica_hd
    TABLES
    accountgl = it_accountgl
    accountreceivable = it_accountreceivable
    accountpayable = it_accountpayable
    accounttax = it_accounttax
    currencyamount = it_currencyamount
    criteria = it_criteria
    valuefield = it_valuefield
    extension1 = it_ext
    return = it_return
    paymentcard = it_paymentcard
    contractitem = it_fica_it.
    extension2 = it_ext2
    realestate = it_re.
    WRITE: / 'Result of check lines:'. "#EC NOTEXT
    PERFORM show_messages.
    ENDIF.
    IF check_a = 'X'.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    DESTINATION dest
    EXPORTING
    documentheader = gd_documentheader
    customercpd = gd_customercpd
    contractheader = gd_fica_hd
    TABLES
    accountgl = it_accountgl
    accountreceivable = it_accountreceivable
    accountpayable = it_accountpayable
    accounttax = it_accounttax
    currencyamount = it_currencyamount
    criteria = it_criteria
    valuefield = it_valuefield
    extension1 = it_ext
    return = it_return
    paymentcard = it_paymentcard
    contractitem = it_fica_it.
    extension2 = it_ext2
    realestate = it_re.
    WRITE: / 'Result of check all:'. "#EC NOTEXT
    PERFORM show_messages.
    ENDIF.
    IF post = 'X'.
    DATA: l_type LIKE gd_documentheader-obj_type,
    l_key LIKE gd_documentheader-obj_key,
    l_sys LIKE gd_documentheader-obj_sys.
    IF dest = space OR
    dest = gd_documentheader-obj_sys.
    post synchron
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
    EXPORTING
    documentheader = gd_documentheader
    customercpd = gd_customercpd
    contractheader = gd_fica_hd
    IMPORTING
    obj_type = l_type
    obj_key = l_key
    obj_sys = l_sys
    TABLES
    accountgl = it_accountgl
    accountreceivable = it_accountreceivable
    accountpayable = it_accountpayable
    accounttax = it_accounttax
    currencyamount = it_currencyamount
    criteria = it_criteria
    valuefield = it_valuefield
    extension1 = it_ext
    return = it_return
    paymentcard = it_paymentcard
    contractitem = it_fica_it.
    extension2 = it_ext2
    realestate = it_re.
    WRITE: / 'Result of post:'. "#EC NOTEXT
    PERFORM show_messages.
    ELSE.
    create Idoc
    it_receivers-logsys = dest.
    APPEND it_receivers.
    CALL FUNCTION 'ALE_ACC_DOCUMENT_POST'
    EXPORTING
    documentheader = gd_documentheader
    customercpd = gd_customercpd
    contractheader = gd_fica_hd
    TABLES
    accountgl = it_accountgl
    accountreceivable = it_accountreceivable
    accountpayable = it_accountpayable
    accounttax = it_accounttax
    currencyamount = it_currencyamount
    criteria = it_criteria
    valuefield = it_valuefield
    extension1 = it_ext
    paymentcard = it_paymentcard
    contractitem = it_fica_it
    extension2 = it_ext2
    realestate = it_re
    receivers = it_receivers
    COMMUNICATION_DOCUMENTS* APPLICATION_OBJECTS EXCEPTIONS
    error_creating_idocs = 1
    OTHERS = 2 .
    IF sy-subrc = 0.
    WRITE: / 'IDoc created'. "#EC NOTEXT
    ELSE.
    WRITE: sy-msgid.
    ENDIF.
    ENDIF.
    ENDIF.
    IF rev_p = 'X' OR rev_c = 'X'.
    DATA: rev LIKE bapiacrev,
    rev_key LIKE ref_key.
    rev_key = ref_key.
    rev_key(1) = 'R'.
    rev-obj_type = gd_documentheader-obj_type.
    rev-obj_key = rev_key.
    rev-obj_sys = gd_documentheader-obj_sys.
    rev-obj_key_r = ref_key.
    IF rev_c IS INITIAL.
    IF dest = space OR
    dest = gd_documentheader-obj_sys.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_REV_POST'
    EXPORTING
    reversal = rev
    bus_act = gd_documentheader-bus_act
    TABLES
    return = it_return.
    ELSE.
    it_receivers-logsys = dest.
    APPEND it_receivers.
    CALL FUNCTION 'ALE_ACC_DOCUMENT_REV_POST'
    EXPORTING
    reversal = rev
    busact = gd_documentheader-bus_act
    OBJ_TYPE = 'BUS6035'
    SERIAL_ID = '0'
    TABLES
    receivers = it_receivers
    COMMUNICATION_DOCUMENTS* APPLICATION_OBJECTS EXCEPTIONS
    error_creating_idocs = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    WRITE: / 'IDoc created'. "#EC NOTEXT
    ENDIF.
    ENDIF.
    ELSE.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_REV_CHECK'
    EXPORTING
    reversal = rev
    bus_act = gd_documentheader-bus_act
    TABLES
    return = it_return.
    ENDIF.
    WRITE: / 'Result of Reversal Posting:'. "#EC NOTEXT
    PERFORM show_messages.
    ENDIF.
    COMMIT WORK.
    Kindly close if it helps you.
    Regards
    Abhii...

  • Any BAPI for Transaction VF01??

    Hi Experts ,
    Is there any Bapi for transaction VF01.
    If it is then plz. do help me to use that one with coding .
    Regards,
    Rahul

    Hi,
    Check this sample code of creating the billing document using the bapi BAPI_BILLINGDOC_CREATEMULTIPLE.
    DATA: t_success TYPE STANDARD TABLE OF bapivbrksuccess WITH HEADER LINE.
    DATA: t_billing TYPE STANDARD TABLE OF bapivbrk WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapireturn1 WITH HEADER LINE.
    t_billing-salesorg = vbak-vkorg.
    t_billing-DISTR_CHAN = vbak-vtweg.
    t_billing-DIVISION = vbak-spart.
    t_billing-DOC_TYPE = vbak-auart.
    t_billing-ref_doc = vbak-vbeln.
    t_billing-ref_item = vbap-posnr.
    t_billing-doc_number = vbak-vbeln.
    t_billing-ITM_NUMBER = vbap-posnr.
    t_billing-ordbilltyp = 'BILLING TYPE'.
    t_billing-price_date = sy-datum.
    t_billing-ref_doc_ca = vbak-vbtyp.
    t_billing-sold_to = vbak-kunnr.
    t_billing-material = vbap-matnr.
    t_billing-plant = vbap-werks.
    APPEND t_billing.
    CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
    TABLES
    billingdatain = t_billing
    return = t_return
    success = t_success.
    commit work.
    <b>Reward points</b>
    Regards

  • BAPI for Transaction ME51N?

    How to devlop Purchase Requisition BAPI for Transaction ME51N?

    Hi vamshi,
    We have BAPI
    BAPI_REQUISITION_CREATE
    BAPI_PR_CREATE
    BAPI_REQUISITION_CHANGE
    BAPI_PR_CHANGE
    Please check this link
    FOR CREATING:
    http://www.erpgenie.com/abap/bapi/example.htm
    http://www.****************/Tutorials/BAPI/CustomBAPICreation2/page1.htm
    Best regards,
    raam

  • BAPI call to actual cost of work order

    Is there a BAPI call to actual cost of work order operations in PM?
    I am looking for to read these actual cost in a PM order and populate the data to the none-SAP application.
    Any helps appreciate it.
    Tim

    I think I have just found it:
    IBAPI_ALM_ORDERCOSTS_READ
    But, thanks anyway for your quick reply and helpful tips.
    points rewarded.

  • When Creating a Work Order Import Standard Operations

    A client is requesting the following functionality when creating a Work Order: Create the first nine operations with different work centers and number operations 0001 u2013 0009.  For operation ten continue numbering with 0010 and increase by 10, ie, 0020, 0030, etcu2026 .   And operation 0010 would default header data.
    Can this be accomplished through standards configuration or would this entail a user exit?
    Thanks in advance!!
    JAM

    It can be possible, depending on how you create the Work Order.   If these operations are used often and are in a task list, you can create a work order and import the task list operations by using the menu "extras -> task List selections" inside the work order.    If it is part of a preventative maintenance plan, you can configure that your task list is automatically copied to the notification/work order when generated by your maintenance plan.  Of course in the task list you could save all the increments and work centers as you want.   But this would never be a dynamic check to your header data, it would only be as accurate as your task list.

  • BAPI for transaction MI10

    Hi Gurus,
    Can you please tell me if there is any BAPI for transaction MI10(post document,count and difference: initial screen).
    Is there any standard IDOC type for inventory management or any message type associated with inventory management IDoc.
    Thanks

    Hi,
       check with below BAPIs
    BAPI_MATPHYSINV_CHANGECOUNT Change count for particular items of a phys. inv. doc.
    BAPI_MATPHYSINV_COUNT Enter count for particular items of a phys. inv. doc.
    BAPI_MATPHYSINV_CREATE Create physical inventory document
    BAPI_MATPHYSINV_CREATE_MULT Create physical inventory document
    BAPI_MATPHYSINV_GETDETAIL Read items for a physical inventory document
    BAPI_MATPHYSINV_GETITEMS Read list of physical inventory documents with items
    BAPI_MATPHYSINV_GETLIST Read list of phys. inv. documents
    BAPI_MATPHYSINV_POSTDIFF Post differences for certain items in a phys. inv. document
    Thanks,
    Asit Purbey.

  • Bapi for transaction FOB1

    Hi everyone,
    Is there a BAPI for transaction FOB1 ? I allready looked into some lists of BAPI's, but i'm not sure what to be looking for...
                   Thanks in advance...
                           Nuno

    Anyone ? Isn't this possible ? Do i have to do it with batch? If so, if i put the batch running in background, how can i caught the number of the documents created to print them on screen ?

Maybe you are looking for