Use of BApi

Wat is the use of bapi .in sap...
thx.
regurds .
nainesh.

hi,
what is BAPI?
BAPI stands for Business API(Application Program Interface).
A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
The following standardized BAPIs are provided:
Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
Create( ) and CreateFromData! ( )
The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
Change( )
The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
just refer to the link below
http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g
list of all bapis
http://www.planetsap.com/LIST_ALL_BAPIs.htm
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Also refer to the following links..
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
Example Code
U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.
U can find these parameters for a particular condition type in table KONV.
*& Form saveTransactionJOCR
text
--> p1 text
<-- p2 text
FORM saveTransactionJOCR .
data: salesdocument like BAPIVBELN-VBELN,
order_header_inx like bapisdh1x,
order_header_in like bapisdh1,
return type standard table of bapiret2 with header line,
conditions_in type standard table of bapicond with header line,
conditions_inx type standard table of bapicondx with header line,
logic_switch like BAPISDLS,
step_nr like conditions_in-cond_st_no,
item_nr like conditions_in-itm_number,
cond_count like conditions_in-cond_count,
cond_type like conditions_in-cond_type.
salesdocument = wa_order_information-VBELN.
LOGIC_SWITCH-COND_HANDL = 'X'.
order_header_inx-updateflag = 'U'.
conditions
clear conditions_in[].
clear conditions_inx[].
clear: step_nr,
item_nr,
cond_count,
cond_type.
step_nr = '710'.
item_nr = '000000'.
cond_count = '01'.
cond_type = 'ZCP2'.
CONDITIONS_IN-ITM_NUMBER = item_nr.
conditions_in-cond_st_no = step_nr.
CONDITIONS_IN-COND_COUNT = cond_count.
CONDITIONS_IN-COND_TYPE = cond_type.
CONDITIONS_IN-COND_VALUE = 666.
CONDITIONS_IN-CURRENCY = 'EUR'.
append conditions_in.
CONDITIONS_INX-ITM_NUMBER = item_nr.
conditions_inx-cond_st_no = step_nr.
CONDITIONS_INX-COND_COUNT = cond_count.
CONDITIONS_INX-COND_TYPE = cond_type.
CONDITIONS_INX-UPDATEFLAG = 'U'.
CONDITIONS_INX-COND_VALUE = 'X'.
CONDITIONS_INX-CURRENCY = 'X'.
append conditions_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = salesdocument
ORDER_HEADER_IN = order_header_in
ORDER_HEADER_INX = order_header_inx
LOGIC_SWITCH = logic_switch
TABLES
RETURN = return
CONDITIONS_IN = conditions_in
CONDITIONS_INX = conditions_inx
if return-type ne 'E'.
commit work and wait.
endif.
ENDFORM. " saveTransactionJOCR
Bdc to Bapi
The steps to be followed are :
1. Find out the relevant BAPI (BAPI_SALESORDER_CHANGE for VA02).
[for VA01 use BAPI_SALESORDER_CREATEFROMDAT2]
2. Create a Z program and call the BAPi (same as a Funtion module call).
2. Now, if you see this BAPi, it has
-> Importing structures.
eg: SALESDOCUMENT: this will take the Sales order header data as input.
-> Tables parameters:
eg: ORDER_ITEM_IN: this will take the line item data as input.
Note :
Only specify fields that should be changed
Select these fields by entering an X in the checkboxes
Enter a U in the UPDATEFLAG field
Always specify key fields when changing the data, including in the checkboxes
The configuration is an exception here. If this needs to be changed, you need to complete it again fully.
Maintain quantities and dates in the schedule line data
Possible UPDATEFLAGS:
U = change
D = delete
I = add
Example
1. Delete the whole order
2. Delete order items
3. Change the order
4. Change the configuration
Notes
1. Minimum entry:
You must enter the order number in the SALESDOCUMENT structure.
You must always enter key fields for changes.
You must always specify the update indicator in the ORDER_HEADER_INX.
2. Commit control:
The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.
For further details... refer to the Function Module documentation for the BAPi.
Bapi to VB(Visual Basic)
Long back I had used the following flow structure to acheive the same.
Report -> SM59 RFC destination -> COM4ABAP -> VB.exe
my report uses the rfc destination to create a COM session with com4abap. com4abap calls the vb.exe and manages the flow of data between sap and vb exe.
You need to have com4abap.exe
If com4abap is installed you will find it in sapgui installatin directory , C:\Program Files\SAPpc\sapgui\RFCSDK\com4abap.
else refer OSS note 419822 for installation of com4abap
after making the settings in com4abap to point to the vb program and setting up rfc destination in sm59 to point to com4abap session , you can use the following function modules to call the vb code.
for setting up com4abap and rfc destination please refer to the documentation for com4abap.
Invoke NEW DCOM session
call function 'BEGIN_COM_SESSION'
exporting
service_dest = service_dest "(this will be a RFC destination created in SM59)
importing
worker_dest = worker_dest
exceptions
connect_to_dcom_service_failed = 1
connect_to_dcom_worker_failed = 2
others = 3.
call function 'create_com_instance' destination worker_dest
exporting
clsid = g_c_clsid
typelib = g_c_typelib
importing
instid = g_f_oid
exceptions
communication_failure = 1 message g_f_msg
system_failure = 2 message g_f_msg
invalid_instance_id = 3
others = 4.
call function 'com_invoke' destination worker_dest
exporting
%instid = g_f_oid
%method = 'UpdatePDF'
sntemp = g_v_const_filent
snsysid = sy-sysid
snflag = 'N'
tables
rssaptable = g_t_pdfdetail1
%return = g_t_pdfdetail1 "t_test
exceptions
communication_failure = 1 message g_f_msg
system_failure = 2 message g_f_msg
invalid_instance_id = 3
others = 4.
then close the com session , using
FM delete_com_instance
FM END_COM_SESSION
cheers,
Hema.

Similar Messages

  • Open Purchase Order UPload Using the BAPI 's

    i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out  using the BAIP's for upload the PO, i need sample code for this ........
    Thanks & Regards
    Raghu
    <u>Field Name     Field Description                              Type     Length</u>
    <b>EBELN             Purchasing Document Number                         CHAR     010          X
    BUKRS             Company Code                                                     CHAR    004     MN10     C
    EKORG             Purchasing Organization                              CHAR     004     MN00     C
    EKGRP             Purchasing group                              CHAR     003          X
    BSART             Order type (Purchasing)                              CHAR     004          X
    LIFNR             Account Number of Vendor or Creditor                    CHAR     010          X
    BEDAT             Purchase Order Date                              DATS     010          X
    ZTERM             Terms of payment key                              CHAR     004          X
    WAERS             Currency Key                                   CUKY     005          X
    INCO1             Incoterms (part 1)                              CHAR     003          X
    INCO2             Incoterms (part 2)                              CHAR     028          X</b>
    EBELP             Item Number of Purchasing Document                    NUMC     005          X
    EMATN             Material number                                   CHAR     018          X
    WERKS             Plant                                        CHAR     004          X
    LGORT             Storage location                              CHAR     004          X
    EPSTP             Item category in purchasing document                    CHAR     001          X
    KNTTP             Account assignment category                         CHAR     001          X
    EINDT             Item delivery date                              DATS     010          X
    MENGE            "Purchase order quantity (direct input, transfer of POs)"     CHAR     013          X
    MEINS            Order unit                                   UNIT     003          X
    NETPR            "Net price: Document currency (direct input, transfer of"     CHAR     011          X
    PEINH            "Price unit (direct input, transfer of POs)"               CHAR     005          X
    BPRME            Order Price Unit (Purchasing)                         UNIT     003          X
    BPUMZ            Numerator: Conversion OPUn into OUn (direct input of POs          CHAR     005          X
    BPUMN            Denominator: Conversion OPUn into OUn (direct input of P          CHAR     005          X
    SAKTO            Cost element                                   CHAR     010          X
    KOSTL              Cost Center                                   CHAR     010          X
    VBELN          Sales and Distribution Document Number                    CHAR     010          X
    VBELP          Sales document item                              NUMC     006          X
    WEMPF          Goods recipient                                   CHAR     012          X
    WEBTH          "Amount in local currency (direct input, transfer of POs)"     CHAR     013          X
    WEBTF          "Amount in document currency (direct input, transfer of P"     CHAR     013          X
    WEREF          Flag for treatment of GR/IR (direct input of POs)          CHAR     001          X
    SPINF          Indicator: Update info record                         CHAR     001          X
    WEPOS          Goods Receipt Indicator                              CHAR     001          X
    REPOS          Invoice receipt indicator                         CHAR     001          X

    i need to upload the open Purchase Order using the BAPI function BAPI_PO_CREATE1., below is the given fileds blod are for Header, header will Repeat for the line items,can any one help me out  using the BAIP's for upload the PO, i need sample code for this ........
    Thanks & Regards
    Raghu
    <u>Field Name     Field Description                              Type     Length</u>
    <b>EBELN             Purchasing Document Number                         CHAR     010          X
    BUKRS             Company Code                                                     CHAR    004     MN10     C
    EKORG             Purchasing Organization                              CHAR     004     MN00     C
    EKGRP             Purchasing group                              CHAR     003          X
    BSART             Order type (Purchasing)                              CHAR     004          X
    LIFNR             Account Number of Vendor or Creditor                    CHAR     010          X
    BEDAT             Purchase Order Date                              DATS     010          X
    ZTERM             Terms of payment key                              CHAR     004          X
    WAERS             Currency Key                                   CUKY     005          X
    INCO1             Incoterms (part 1)                              CHAR     003          X
    INCO2             Incoterms (part 2)                              CHAR     028          X</b>
    EBELP             Item Number of Purchasing Document                    NUMC     005          X
    EMATN             Material number                                   CHAR     018          X
    WERKS             Plant                                        CHAR     004          X
    LGORT             Storage location                              CHAR     004          X
    EPSTP             Item category in purchasing document                    CHAR     001          X
    KNTTP             Account assignment category                         CHAR     001          X
    EINDT             Item delivery date                              DATS     010          X
    MENGE            "Purchase order quantity (direct input, transfer of POs)"     CHAR     013          X
    MEINS            Order unit                                   UNIT     003          X
    NETPR            "Net price: Document currency (direct input, transfer of"     CHAR     011          X
    PEINH            "Price unit (direct input, transfer of POs)"               CHAR     005          X
    BPRME            Order Price Unit (Purchasing)                         UNIT     003          X
    BPUMZ            Numerator: Conversion OPUn into OUn (direct input of POs          CHAR     005          X
    BPUMN            Denominator: Conversion OPUn into OUn (direct input of P          CHAR     005          X
    SAKTO            Cost element                                   CHAR     010          X
    KOSTL              Cost Center                                   CHAR     010          X
    VBELN          Sales and Distribution Document Number                    CHAR     010          X
    VBELP          Sales document item                              NUMC     006          X
    WEMPF          Goods recipient                                   CHAR     012          X
    WEBTH          "Amount in local currency (direct input, transfer of POs)"     CHAR     013          X
    WEBTF          "Amount in document currency (direct input, transfer of P"     CHAR     013          X
    WEREF          Flag for treatment of GR/IR (direct input of POs)          CHAR     001          X
    SPINF          Indicator: Update info record                         CHAR     001          X
    WEPOS          Goods Receipt Indicator                              CHAR     001          X
    REPOS          Invoice receipt indicator                         CHAR     001          X

  • Assignment on Sales Order creation using a BAPI

    hi,
    i m new 2 bapi,so i usually knw how 2 create BAPI
    1.     Create a sales order using BAPI with the header details from selection screen and item details from the file.
    2.     Have the minimum required header fields for a sales order  – Sales order type, sales org, distribution channel, division, customer, purchase order type, purchase order number as the selection screen parameters.
    3.     Have a field to enter the presentation server path on the selection screen where the file with item details is stored. File will have material, size and quantity required.
    4.     Validate all the relevant selection screen entries.
    5.     Create a sales order with the obtained details using the BAPI
          BAPI_SALESORDER_CREATEFROMDAT2
    6.     Catch all the BAPI errors and display a report. If the BAPI call was successful display the sales order document number and the items. If the call fails, display all the error message encountered.

    Hi Priya,
    Here is the sample program , it may helpful check,
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Sales organization
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Distribution channel
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Division.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
    PARAMETERS: p_spart TYPE spart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Sold-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Ship-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Material
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Quantity.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Plant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Data declarations.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    Initialization.
    INITIALIZATION.
    v_text = 'Order type'.
    v_text1 = 'Sales Org'.
    v_text2 = 'Distribution channel'.
    v_text3 = 'Division'.
    v_text4 = 'Sold-to'.
    v_text5 = 'Ship-to'.
    v_text6 = 'Material'.
    v_text7 = 'Quantity'.
    v_text9 = 'Plant'.
    Start-of-selection.
    START-OF-SELECTION.
    Header data
    Sales document type
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    Sales organization
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    Distribution channel
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    Division
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    Partner data
    Sold to
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    Ship to
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    ITEM DATA
    itemx-updateflag = 'I'.
    Line item number.
    item-itm_number = '000010'.
    itemx-itm_number = 'X'.
    Material
    item-material = p_matnr.
    itemx-material = 'X'.
    Plant
    item-plant = p_plant.
    itemx-plant = 'X'.
    Quantity
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    APPEND item.
    APPEND itemx.
    Fill schedule lines
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty = p_menge.
    APPEND lt_schedules_in.
    Fill schedule line flags
    lt_schedules_inx-itm_number = '000010'.
    lt_schedules_inx-sched_line = '0001'.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
    sales_header_in = header
    sales_header_inx = headerx
    IMPORTING
    salesdocument_ex = v_vbeln
    TABLES
    return = return
    sales_items_in = item
    sales_items_inx = itemx
    sales_schedules_in = lt_schedules_in
    sales_schedules_inx = lt_schedules_inx
    sales_partners = partner.
    Check the return table.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
    WRITE: / 'Error in creating document'.
    ELSE.
    Commit the work.
    COMMIT WORK AND WAIT.
    WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.

  • Need to upload mass excel sheet using the bapi bapi_acc_document_post.

    I am assigned with an object, where I need to post the records from a mass excel sheet in to ECC or/and BW basing the dimensions using the bapi bapi_acc_document_post.the excel sheet has header and Item data. I am pretty much new to this bapi's
    please do the need ful

    Check report "ACC_BAPI_TEST_INVOICE_RECEIPT",
    this report calls BAPI "BAPI_ACC_INVOICE_RECEIPT_POST",
    but the parameters are nearly the same.
    Best Regards, Dirk

  • Create a Purchase order using the BAPI using the data in the XML file.

    Hello Gurus,
    here is the scenario can anyone help me how to proceed explaining the procedure?
    Create a Purchase order using the BAPI using the data in the XML file.
    comprehensive explanations are appreciated.
    thanks in advance.

    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).

  • Need Help ! PO using a BAPI -  BAPI_PO_CREATE1

    Hi friends,
    Need some help. I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    <i><b>I want the new PO to have all the characteristics of an existing PO. which is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in  the std FM  - MEPO_DOC_ITEM_GET . It raises an exception of failure.</b></i>
    Am i making any mistake while filling the header or item or schedule lines before BAPI_PO_CREATE1 ?
    MOVE: wa_order_split_create-docnr TO i_ebeln,
    wa_order_split_create-docitm TO i_ebelp .
    CALL FUNCTION 'ME_EKKO_SINGLE_READ'
    EXPORTING
    pi_ebeln = i_ebeln
    IMPORTING
    po_ekko = i_ekko
    EXCEPTIONS
    no_records_found = 1
    OTHERS = 2.
    IF sy-subrc <> 0 .
    ENDIF .
    Fill PO Header
    i_bpoh-comp_code = i_ekko-bukrs .
    i_bpoh-doc_type = i_ekko-bsart .
    i_bpoh-vendor = i_ekko-lifnr .
    i_bpoh-langu = i_ekko-spras .
    i_bpoh-pmnttrms = i_ekko-zterm .
    i_bpoh-purch_org = i_ekko-ekorg .
    i_bpoh-pur_group = i_ekko-ekgrp .
    i_bpoh-currency = i_ekko-waers .
    i_bpoh-agreement = i_ekko-konnr .
    i_bpoh-incoterms1 = i_ekko-inco1 .
    i_bpoh-incoterms2 = i_ekko-inco2 .
    Fill PO update indicator 'X'
    i_bpohx-comp_code = c_char_x .
    i_bpohx-doc_type = c_char_x .
    i_bpohx-vendor = c_char_x .
    i_bpohx-langu = c_char_x .
    i_bpohx-pmnttrms = c_char_x .
    i_bpohx-purch_org = c_char_x .
    i_bpohx-pur_group = c_char_x .
    i_bpohx-currency = c_char_x .
    i_bpohx-agreement = c_char_x .
    i_bpohx-incoterms1 = c_char_x .
    i_bpohx-incoterms2 = c_char_x .
    CALL FUNCTION 'ME_EKPO_SINGLE_READ'
    EXPORTING
    pi_ebeln = i_ebeln
    pi_ebelp = i_ebelp
    IMPORTING
    po_ekpo = i_ekpo
    EXCEPTIONS
    no_records_found = 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.
    ENDIF .
    Fill PO Item
    i_wa_bpoi-po_item = i_ekpo-ebelp .
    i_wa_bpoi-material = i_ekpo-matnr .
    i_wa_bpoi-plant = i_ekpo-werks .
    i_wa_bpoi-stge_loc = i_ekpo-lgort .
    i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
    i_wa_bpoi-po_unit = i_ekpo-meins .
    i_wa_bpoi-tax_code = i_ekpo-mwskz .
    i_wa_bpoi-val_type = i_ekpo-bwtar .
    i_wa_bpoi-item_cat = i_ekpo-pstyp .
    i_wa_bpoi-acctasscat = i_ekpo-knttp .
    i_wa_bpoi-agreement = i_ekpo-konnr .
    i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
    APPEND i_wa_bpoi TO i_bpoi .
    Fill PO Item update indicator 'X'
    i_wa_bpoix-po_item = i_ekpo-ebelp .
    i_wa_bpoix-po_itemx = c_char_x .
    i_wa_bpoix-material = c_char_x .
    i_wa_bpoix-plant = c_char_x .
    i_wa_bpoix-stge_loc = c_char_x .
    i_wa_bpoix-quantity = c_char_x .
    i_wa_bpoix-po_unit = c_char_x .
    i_wa_bpoix-tax_code = c_char_x .
    i_wa_bpoix-val_type = c_char_x .
    i_wa_bpoix-item_cat = c_char_x .
    i_wa_bpoix-acctasscat = c_char_x .
    i_wa_bpoix-agreement = c_char_x .
    i_wa_bpoix-agmt_item = c_char_x .
    APPEND i_wa_bpoix TO i_bpoix .
    Fill PO Item Schedule
    i_wa_bpos-po_item = i_ekpo-ebelp .
    i_wa_bpos-sched_line = '0001' .
    i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
    i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
    APPEND i_wa_bpos TO i_bpos .
    Fill PO Item schedule update indicator 'X'
    i_wa_bposx-po_item = i_ekpo-ebelp .
    i_wa_bposx-sched_line = '0001' .
    i_wa_bposx-delivery_date = c_char_x .
    i_wa_bposx-quantity = c_char_x .
    APPEND i_wa_bposx TO i_bposx .
    CLEAR: i_pargr .
    SELECT SINGLE pargr
    INTO i_pargr
    FROM t161
    WHERE bstyp = i_ekko-bstyp
    AND bsart = i_ekko-bsart .
    CLEAR i_ekpa[].
    CALL FUNCTION 'MM_READ_PARTNERS'
    EXPORTING
    application = c_char_p
    ebeln = i_ebeln
    bstyp = i_ekko-bstyp
    pargr = i_pargr
    TABLES
    x_ekpa = i_ekpa[].
    LOOP AT i_ekpa INTO i_wa_ekpa .
    i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
    i_wa_bpop-langu = sy-langu .
    IF NOT i_wa_ekpa-lifn2 IS INITIAL .
    i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
    ELSE .
    i_wa_bpop-buspartno = i_wa_ekpa-parnr .
    ENDIF .
    APPEND i_wa_bpop TO i_bpop .
    CLEAR: i_wa_ekpa, i_wa_bpop .
    ENDLOOP .
    CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = i_bpoh
    poheaderx = i_bpohx
    IMPORTING
    exppurchaseorder = i_new_ebeln
    TABLES
    return = i_bapiret2
    poitem = i_bpoi[]
    poitemx = i_bpoix[]
    poschedule = i_bpos[]
    poschedulex = i_bposx[].
    i_order = i_new_ebeln .
    SHIFT i_order LEFT DELETING LEADING '0' .
    i_return-errortype = c_char_i .
    i_return-workarea = c_zsw .
    i_return-message = '064' .
    i_return-variable1 = i_order .
    loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
    append i_bapiretn to t_bapi_return .
    endloop .
    if t_bapi_return[] is initial .
    i_create_order = c_char_x .
    CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
    EXPORTING
    act_return = i_return.

    Hi,
    Make the required settings to trigger an idoc during the creation of a PO in Me21N with multiple line items, check how the idoc is being created, This should be starting point to know how to create idoc with multiple line items.
    Hope this works for you.
    Rajeev

  • How to get custom field value in vbkd table using "SD_SALESDOCUMENT_CREATE" bapi

    Hi Experts,
    Need your help . In one program Iam using SD_SALESDOCUMENT_CREATE bapi .
    i/p for my report is am excel.
    excel is having  below formatt.
    To create salesdoc we are using SD_SALESDOC_CREATE bapi.
    but After execution of the program we are unable to find the ZZFV_SBCNT (which is custom  field) in VBKD w.r.t salesdocument.
    Need your help what we need to do to reflect the value in vbkd table.
    Here temp will contains the data from excel
    1)
    FORM f_move_header_data .
       wg_header-doc_type            = wg_temp-auart .                   "Order type
       wg_header-sales_org           = wg_temp-vkorg .                   "Sales Organization
       wg_header-distr_chan          = wg_temp-vtweg .                   "Distribution Channel
       wg_header-division            = wg_temp-spart.                    "Division
       wg_header-sales_off           = wg_temp-vkbur .                   "Sales Office
       wg_header-sales_grp           = wg_temp-vkgrp .                   "Sales Group
       wg_header-purch_no_c          = wg_temp-bstnk .                   "Customer purchase order number
       wg_header-pymt_meth           = wg_temp-zlsch  .                  "Payment Method
       wg_header-zzychan_role        = wg_temp-zzychan_role_i.           "Channel Role
       wg_header-zzysub_role         = wg_temp-zzysub_role  .            "Submitter Role
       wg_header-zzy_inv_for_opt     = wg_temp-zzinv_format  .           "Invoice Format Optio
       wg_header-ord_reason          = wg_temp-augru  .                  "Order Reason Code
       wg_header-bill_block          = wg_temp-faksp.                    "Billing Block
       wg_headerx-doc_type            = c_set .                   "Order type
       wg_headerx-sales_org           = c_set .                   "Sales Organization
       wg_headerx-distr_chan          = c_set .                   "Distribution Channel
       wg_headerx-division            = c_set.                    "Division
       wg_headerx-sales_off           = c_set .                   "Sales Office
       wg_headerx-sales_grp           = c_set .                   "Sales Group
       wg_headerx-purch_no_c          = c_set .                   "Customer purchase order number
       wg_headerx-pymt_meth           = c_set  .                  "Payment Method
       wg_headerx-zzychan_role        = c_set.                    "Channel Role
       wg_headerx-zzysub_role         = c_set .                   "Submitter Role
       wg_headerx-zzy_inv_for_opt     = c_set .                   "Invoice Format Option
       wg_headerx-ord_reason          = c_set .                   "Order Reason Code
       wg_headerx-bill_block           = c_set.                    "Billing Block
    ENDFORM.                    " F_MOVE_HEADER_DATA
    2)
    FORM f_move_item_data .
       wg_item-itm_number          =   g_itmnumber.                              "Item number
       wg_item-material            =   wg_process-matnr .                        "Material
       wg_item-target_qty          =   wg_process-target_qty.                    "Targeted Qty
       wg_item-item_categ          =   wg_process-pstyv.                         "Sales document item category
       wg_item-zzylegal_i          =   wg_process-zzlegal.                       "Legal Contract
    **********Added this line for vbkd-ZZFV_SBCNT****************************
       wg_item-zzfv_sbcnt          = wg_process-zzfv_sbcnt.      
    APPEND wg_item TO i_item.
    wg_itemx-material            =   c_set .                        "Material
       wg_itemx-target_qty          =   c_set.                         "Targeted Qty
       wg_itemx-item_categ          =   c_set.                         "Sales document item category
       wg_itemx-zzylegal_i          =   c_set.                         "Legal Contract
       wg_itemx-zzsteady_date       =   c_set .                        "Amortization Start Date
       wg_itemx-zzsteady_end_dat    =   c_set.                         "Amortization Stop Date
    **********Added this line for vbkd-ZZFV_SBCNT****************************
       wg_itemx-ZZFV_SBCNt     =   c_set.   "
       APPEND wg_itemx TO i_itemx.
       CLEAR : wg_itemx. 
    endform. 
    3)           
    FORM f_move_head_ext
    wg_extension-structure   = c_ext_vbak.
       wg_ext_vbak-zzinv_format = wg_temp-zzinv_format.
    wg_ext_vbak-zzychan_role = wg_temp-zzychan_role_i.
       wg_ext_vbak-zzysub_role  = wg_temp-zzysub_role.
       wg_extension+30 = wg_ext_vbak.
    APPEND wg_extension to i_extension.
    CLEAR wg_extension.
       wg_extensionx-structure =  c_ext_vbakx.
       wg_ext_vbakx-zzinv_format = c_set.
      wg_ext_vbakx-zzlegal      = c_set.
       wg_ext_vbakx-zzychan_role = c_set.
       wg_ext_vbakx-zzysub_role  = c_set.
       wg_extensionx+30 = wg_ext_vbakx.
       APPEND wg_extensionx TO i_extensionx.
       CLEAR wg_extensionx.
    ENDFORM.                    " F_MOVE_HEAD_EXT
    *&      Form  F_MOVE_ITEM_EXT
    *       Item Extension
    4)
    FORM f_move_item_ext .
    * Structure for BAPI parameter Extension
       wg_extension-structure = c_ext_vbap.
       wg_ext_vbap-posnr      = g_itmnumber.
       wg_ext_vbap-zzsteady_date       =   wg_process-zzsteady_date .                 "Amortization Start Date
       wg_ext_vbap-zzsteady_end_dat    =   wg_process-zzsteady_end_dat.               "Amortization Stop Date
       wg_ext_vbap-zzlegal             =   wg_process-zzlegal.                        "Legal Contract
       wg_extension+30 = wg_ext_vbap.
    APPEND wg_extension to i_extension.
    * Structure for BAPI parameter Extension - Update Indicator Fields
       wg_extensionx-structure =  c_ext_vbapx.
       wg_ext_vbapx-posnr = g_itmnumber.
       wg_ext_vbapx-zzsteady_date       =   c_set .
       wg_ext_vbapx-zzsteady_end_dat    =   c_set.
    *  wg_ext_vbapx-zzlegal             =   c_set.
    *wg_process-zzfv_sbcnt = c_set.
       wg_extensionx+30 = wg_ext_vbapx.
       APPEND wg_extensionx TO i_extensionx.
       CLEAR wg_extensionx.
    and bapi calling is like below.
    CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
         EXPORTING
           sales_header_in       = wg_header
           sales_header_inx      = wg_headerx
           logic_switch          = wg_logic_switch
           business_object       = fp_bus_obj
           status_buffer_refresh = 'X'
         IMPORTING
           salesdocument_ex      = g_sorder
         TABLES
          return                = i_return
           sales_items_in        = i_item
           sales_items_inx       = i_itemx
           sales_partners        = i_partner
           sales_conditions_in   = i_cond
           sales_conditions_inx  = i_condx
           sales_text            = i_text
           extensionin           = i_extension
         extensionex           = i_extensionx.
    still we are not getting ZZFV_SBCNT value in VBKD table w.r.t created salesdoc(g_sorder)
    Please help me from this issue.
    Thank You..

    Hi,
    Please let me know how to add custom fields in the characteristic list, My clients wants department and profit center grouping.
    Please tell me how to solve it..
    Thanks & Regards,
    Reena..

  • Netprice Picked up from last document-Open PO load using LSMW BAPI method.

    Hi Experts,
    I m doing Open PO load using LSMW BAPI method...(BAPI_PO_CREAT1).
    Inside the LSMW BAPI picks up the NETPR value from the last document and doesnt consider the value from load file...
    Please advice me how to handle this issue...
    I tried giving values to field CALCTYPE at item level or POCOND table with with carry out new pricing options....but nothig works for me...
    PLease give your valuable inputs to achieve the requirement....
    Bharathi.J

    read OSS Note 580225 - Purchasing BAPIs: Conditions and pricing

  • How to Use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA

    Hi ,
      How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
      May i know what are the input parameters & fields mandatory
      for each Table structures ct_data , ct_datax , it_descript , it_longtext.
      Can any one explain me Step by Step Process.
      B'cos i tried with below code. Equipment is not getting created.
      wa_itab-equipment_ext = '000000000100000001'.
      wa_itab-descript      = 'Test 2 -> Lube Oil Pump'.
      wa_itab-text_language = 'EN'.
      wa_itab-sdescript     = 'Short Description'.
      APPEND wa_itab TO it_itab.
      CLEAR  wa_itab.
      LOOP AT it_itab INTO wa_itab.
        ct_data-ta_guid       = '000000000000000001'.
        ct_data-equipment_ext = wa_itab-equipment_ext.
        ct_data-descript      = wa_itab-descript     .
        ct_data-valid_date    = sy-datum.
        ct_data-equicatgry    = 'M'.
        APPEND ct_data.
        CLEAR  ct_data.
        ct_datax-ta_guid       = '000000000000000001'.
        ct_datax-equipment_ext = 'X'.
        ct_datax-equipment     = 'X'.
        APPEND ct_datax.
        CLEAR  ct_datax.
        it_descript-ta_guid       = '000000000000000001'.
        it_descript-text_language = wa_itab-text_language.
        it_descript-descript      = wa_itab-sdescript    .
        APPEND it_descript.
        CLEAR  it_descript.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'LTXT'.
        it_longtext-text_line      = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'aaaaaaaaaaaaaaa'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'bbbbbbbbbbbb'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'cccccccccccccccc'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      call BAPI-function in this system
        CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
          TABLES
            ct_data     = ct_data
            ct_datax    = ct_datax
            it_descript = it_descript
            it_longtext = it_longtext
            return      = return
          EXCEPTIONS
            OTHERS      = 1.
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          WRITE : 'Successful'.
        ENDIF.
        IF NOT return IS INITIAL.
          LOOP AT return.
            IF return-type = 'A' OR return-type = 'E'.
              WRITE : 'Error'.
            ENDIF.
          ENDLOOP.
        ENDIF.
        REFRESH  return.
      ENDLOOP.
    Regards
    SUrendar

    Hi ,
      How to use PM BAPI for equipment Master upload : BAPI_EQUIPMENT_SAVEREPLICA.
      May i know what are the input parameters & fields mandatory
      for each Table structures ct_data , ct_datax , it_descript , it_longtext.
      Can any one explain me Step by Step Process.
      B'cos i tried with below code. Equipment is not getting created.
      wa_itab-equipment_ext = '000000000100000001'.
      wa_itab-descript      = 'Test 2 -> Lube Oil Pump'.
      wa_itab-text_language = 'EN'.
      wa_itab-sdescript     = 'Short Description'.
      APPEND wa_itab TO it_itab.
      CLEAR  wa_itab.
      LOOP AT it_itab INTO wa_itab.
        ct_data-ta_guid       = '000000000000000001'.
        ct_data-equipment_ext = wa_itab-equipment_ext.
        ct_data-descript      = wa_itab-descript     .
        ct_data-valid_date    = sy-datum.
        ct_data-equicatgry    = 'M'.
        APPEND ct_data.
        CLEAR  ct_data.
        ct_datax-ta_guid       = '000000000000000001'.
        ct_datax-equipment_ext = 'X'.
        ct_datax-equipment     = 'X'.
        APPEND ct_datax.
        CLEAR  ct_datax.
        it_descript-ta_guid       = '000000000000000001'.
        it_descript-text_language = wa_itab-text_language.
        it_descript-descript      = wa_itab-sdescript    .
        APPEND it_descript.
        CLEAR  it_descript.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'LTXT'.
        it_longtext-text_line      = 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'aaaaaaaaaaaaaaa'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'bbbbbbbbbbbb'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        it_longtext-ta_guid        = '000000000000000001'.
        it_longtext-text_language  = wa_itab-text_language.
        it_longtext-text_id        = 'INTV'.
        it_longtext-text_line      = 'cccccccccccccccc'.
        APPEND it_longtext.
        CLEAR  it_longtext.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      call BAPI-function in this system
        CALL FUNCTION 'BAPI_EQUIPMENT_SAVEREPLICA'
          TABLES
            ct_data     = ct_data
            ct_datax    = ct_datax
            it_descript = it_descript
            it_longtext = it_longtext
            return      = return
          EXCEPTIONS
            OTHERS      = 1.
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          WRITE : 'Successful'.
        ENDIF.
        IF NOT return IS INITIAL.
          LOOP AT return.
            IF return-type = 'A' OR return-type = 'E'.
              WRITE : 'Error'.
            ENDIF.
          ENDLOOP.
        ENDIF.
        REFRESH  return.
      ENDLOOP.
    Regards
    SUrendar

  • Issue with posting G/L using the BAPI " BAPI_ACC_DOCUMENT_POST"

    Hi all,
    I am trying to create a G/L document using the BAPI "BAPI_ACC_DOCUMENT_POST". The Bapi is returning me a success message, but i am not able to see the document in BKPF/BSEG.
    Can somebody please let me know if there is any customization that needs to be done to get the document number reflected in the corresponding tables after i execute this BAPI.
    Here is the part of the code that i am using to fill the header structure:
      docheader-obj_type = 'REACI'.
        docheader-obj_key = 'TEST'.
        docheader-obj_sys = 'ECSCLNT010'.
        docheader-bus_act = 'RFBU'.
        docheader-username = sy-uname.
        docheader-header_txt = 'HDR TEXT'.
        docheader-comp_code = 'SC01'.
        docheader-doc_date = sy-datum.
        docheader-pstng_date = sy-datum.
        CASE wa_input_tmp-batch_type .
          WHEN '0'.
            docheader-doc_type = 'SA'.
          WHEN '1'.
            docheader-doc_type = 'RA'.
        ENDCASE.
    Any help is much appreciated.
    Thanks in Advance,
    Suresh

    See the below code :
    I have tested program in my system :
    *&---HEADER DECLARATION
    DATA: HEADER TYPE BAPIACHE09.                " HEADER DATA
                 INTERNAL TABLE DECLARATION
    *&----G/L ACCOUNT ITEM
    DATA: ACCOUNTGL TYPE STANDARD TABLE OF BAPIACGL09.
    *&---CURRENCY ITEMS
    DATA: CURRENCY_AMOUNT TYPE STANDARD TABLE OF BAPIACCR09.
    *&----RETURN PARAMETER
    DATA: RETURN  TYPE STANDARD TABLE OF BAPIRET2 with header line.
                         WORK-AREA DECLARATION
    *&----WORKAREA FOR G/L ACCOUNT ITEM
    DATA: WA_ACCOUNTGL TYPE BAPIACGL09.
    *&---WORKAREA FOR CURRENCY ITEMS
    DATA: WA_CURRENCY_AMOUNT TYPE BAPIACCR09.
                        INITIALIZATION
    HEADER-HEADER_TXT  = 'TEST HEADER'.
    HEADER-USERNAME    = 'DEVELOPER'.
    HEADER-COMP_CODE   = '0002'.
    HEADER-FISC_YEAR   = '2007'.
    HEADER-DOC_DATE    = '20070502'.
    HEADER-PSTNG_DATE  = '20070502'.
    HEADER-TRANS_DATE  = '20070502'.
    HEADER-DOC_TYPE    = 'SA'.
    HEADER-BUS_ACT     = 'RFBU'.
    WA_ACCOUNTGL-ITEMNO_ACC  = '0000000010'.
    WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
    WA_ACCOUNTGL-ITEM_TEXT  = 'SO_DOC'.
    WA_ACCOUNTGL-DE_CRE_IND = 'S'.
    APPEND WA_ACCOUNTGL TO ACCOUNTGL.
    CLEAR WA_ACCOUNTGL.
    WA_ACCOUNTGL-ITEMNO_ACC  = '0000000020'.
    WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
    WA_ACCOUNTGL-ITEM_TEXT  = 'SO_DOC'.
    WA_ACCOUNTGL-DE_CRE_IND = 'H'.
    APPEND WA_ACCOUNTGL TO ACCOUNTGL.
    CLEAR WA_ACCOUNTGL.
    WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000010'.
    WA_CURRENCY_AMOUNT-AMT_DOCCUR = '500'.
    WA_CURRENCY_AMOUNT-CURRENCY   = 'INR'.
    APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
    CLEAR WA_CURRENCY_AMOUNT.
    WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000020'.
    WA_CURRENCY_AMOUNT-AMT_DOCCUR = '-500'.
    WA_CURRENCY_AMOUNT-CURRENCY   = 'INR'.
    APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
    CLEAR WA_CURRENCY_AMOUNT.
                    START-OF-SELECTION
    START-OF-SELECTION.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader          = HEADER
      CUSTOMERCPD             =
      CONTRACTHEADER          =
    IMPORTING
      OBJ_TYPE                =
      OBJ_KEY                 =
      OBJ_SYS                 =
      tables
       ACCOUNTGL               =   ACCOUNTGL
      ACCOUNTRECEIVABLE       =
      ACCOUNTPAYABLE          =
      ACCOUNTTAX              =
        currencyamount          = CURRENCY_AMOUNT
      CRITERIA                =
      VALUEFIELD              =
      EXTENSION1              =
        return                  = RETURN
      PAYMENTCARD             =
      CONTRACTITEM            =
      EXTENSION2              =
      REALESTATE              =
    IF return-type NA 'EA'.
    call function 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'.
    IMPORTING
      RETURN        = RETURN.
      write:/ return-message.
    else.
      write:/ return-message.
    ENDIF.
    Reward Points if it is helpful
    Thanks
    Seshu

  • Error while using the Bapi   BAPI_GOODSMVT_CREATE

    Hi all,
    I am using the BAPI     BAPI_GOODSMVT_CREATE to Upload the Data in MB01 and for creating the MATERIAL DOCUMENT  for Multiple Lineitems at a time.
    But i am getting the error as  * NO ITEMS WERE TRANSFERRED*
    I am using two separate intenal tables One for Header records and One for Line item records
    and passing the tables in the BAPI.
    Please Solve my issue and if possible please send me the sample code along with the flatfile or excel sheet.
    Thanks and Regards
    ajay

    Check the below link for a sample code.
    [http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm|http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm]
    Hope this helps.
    Thanks,
    Balaji

  • Creation of Vendor using a BAPI

    I need to create a vendor in SAP system from a non-SAP system. I thought to use a BAPI. But the BAPI available, BAPI_VENDOR_CREATE is not suitable as it is dialog oriented.
    Could anyone suggest me a better method of achieving this.
    Raja

    Refer the following links:
    Create Vendor Master Data
    Searching for a Bapi or Function to create Creditor / Vendor
    Regards,
    Ravi

  • Problem in creating and updating of  material by the use of bapi and bdc

    Hello All,
    I am using bapi (BAPI_MATERIAL_SAVEDATA ) and than bdc to create and update classification data of material.
    I am facing a problem.
    1) firstly I am creating material by the use of bapi and than after creation i want to update classification data for taht perticular material .
    2) To update classification data i am using bdc . while at the time of updating material through bdc system showing me error that material is currently locked by user (my login name ).
    Please suggest what to do.
    Tkank you
    With Regards
    Shantanu Modi

    When u update/create data it takes sometime to commit. So after using BAPI
    give 10 minutes wait in ur program before updating classification data.
    you can write like
    wait up to 20 seconds.
    and update the classification.

  • Uploading subcontracting PO using LSMW-BAPI method

    I am trying to upload the subcontracting Purchase order using LSMW-BAPI .
    Bapi name -Create from Data1
    Business Object  -    BUS2012                             Purchase Order
    Method               -    CREATEFROMDATA1          Create Enjoy Purchase Ord
    Message Type     -    PORDCR1                           Create Purchase Order
    Basic Type          -    PORDCR102                        Create Purchase Order
    In this BAPI - for subcontracting material (component), required quantity & plant values are provided in a input file .
    When I trying to upload this PO, PO gets created but component data not getting uploaded.
    In documentation of BAPI -under restriction section -there is a restriction for subcontracting.
    So can we create Subcontracting PO using this PO.
    any solution on same.
    Because most of the conversion part is done. Only for subcontracting PO this bapi is not working.
    Please anybody know about the solution guide me ASAP.
    Thanks

    Hi Vikram,
    I am also having same scenario , I m using BAPI - BAPI_GOODSMVT_CREATE To create GR  for Subcontracting PO
    Can u please tell me how can solve this problem.
    Normal GR its working but for Subcontracting PO its not working.
    Regards,
    Sanket

  • Using the bapi BAPI_INSPECTIONPLAN_CREATE

    Hi ,
      I am using the bapi BAPI_INSPECTIONPLAN_CREATE to create inspection plans.
      Here I am facing one issue, as a part of this creation in inspection characteristics, I am not able to
      handle all the control indicators.
      In this control indicators under Results confirmation block I dont see fields in the BAPI to handle   
      radiobuttons for 1. Required Char  2. Optional Char 3. After Accep. 4 After Rejection
    If anybody is familiar with this BAPI, please help me.
    Thanks,
    Ravi

    Hi Neha,
       Sorry to say this, It does not answers my question. I am having the program created by someone else. The issue is the program is not able to populate the control indicators as specified in the file. Because the programmer has not populated those values in the BAPI, even the program you had given is not having those fields. Also I am not able to find the correct fields to populate the values into the BAPI. If you know this specific thing please help me out.
    Thanks,
    Ravi.
    Edited by: ravi itekala on Dec 4, 2008 1:51 PM

  • How to delete an operation from order using the bapi

    Can somebody please tell me how to delete an operation from order using the bapi
    BAPI_ALM_ORDER_MAINTAIN.
    Following was the test data for the BAPI.
    000000 OPERATION DELETE 0000040052810070
    000000 SAVE 0000040052810070
    Even I tried entering the operation table. The BAPI control ends fine, but when I check the order using IW32, the operation still exists.
    So, can you please tell me where Iam going wrong.

    Hi Subash Mohanvel,
    Check bapireturn parameter of the bapi BAPI_ALM_ORDER_MAINTAIN after execution of the code , and if there is no error message in the return table then call bapi_Transaction_commit.
    Unless you call this database saving of the records/values will not get reflected in the system.
    Hope that helps.
    Regards
    Kapadia
    ***Assigning points is the way to say thanks in SDN.***

Maybe you are looking for