BAPI TO UPLOAD CONTRACT PO

Hi, Can anybody tell me the bapi name for uploading Sub contracting Po.
It would be appriciated if i get the pice of code regarding parameters passing.
Important is Components of a line item.
Thanks in advance
Apropricate points will be rewarded.
Arun

Hi,
*& Report ZBAPI_CREATE_PO *
*& Program demonstrates the BAPI call to create Purchase Order *
*& Minimum required parameters are used are as per the current *
*& system configuration *
REPORT ZBAPI_CREATE_PO .
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
*Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
data : w_header(40) value 'PO Header'.
data : ws_langu like sy-langu.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '2700' ,
doctyp like HEADER-DOC_TYPE default 'NB' ,
cdate like HEADER-CREAT_DATE default sy-datum ,
vendor like HEADER-VENDOR default '0010000023',
pur_org like HEADER-PURCH_ORG default '2700' ,
pur_grp like HEADER-PUR_GROUP default '001' .
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like ITEM-PO_ITEM default '00001',
material like ITEM-MATERIAL default 'CRANE' ,
plant like ITEM-PLANT default '2700' ,
quantity like ITEM-QUANTITY default 100.
selection-screen end of block b2.
START-OF-SELECTION.
*DATA POPULATION
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
HEADER-COMP_CODE = company .
HEADER-DOC_TYPE = doctyp .
HEADER-CREAT_DATE = cdate .
HEADER-VENDOR = vendor .
HEADER-LANGU = ws_langu .
HEADER-PURCH_ORG = pur_org .
HEADER-PUR_GROUP = pur_grp .
*POPULATE HEADER FLAG.
HEADERX-comp_code = c_x.
HEADERX-doc_type = c_x.
HEADERX-creat_date = c_x.
HEADERX-vendor = c_x.
HEADERX-langu = c_x.
HEADERX-purch_org = c_x.
HEADERX-pur_group = c_x.
HEADERX-doc_date = c_x.
*POPULATE ITEM DATA.
ITEM-PO_ITEM = item_num.
ITEM-MATERIAL = material.
ITEM-PLANT = plant.
ITEM-QUANTITY = quantity.
APPEND ITEM.
*POPULATE ITEM FLAG TABLE
ITEMX-PO_ITEM = item_num.
ITEMX-MATERIAL = C_X.
ITEMX-PLANT = C_X .
ITEMX-STGE_LOC = C_X .
ITEMX-QUANTITY = C_X .
ITEMX-TAX_CODE = C_X .
ITEMX-ITEM_CAT = C_X .
ITEMX-ACCTASSCAT = C_X .
APPEND ITEMX.
*BAPI CALL
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX.
*Confirm the document creation by calling database COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
end-of-selection.
*Output the messages returned from BAPI call
LOOP AT RETURN.
WRITE / RETURN-MESSAGE.
ENDLOOP.
Create a purchase order with configuration using the BAPI
This took some time to figure out how to setup. It may be useful.
call function 'BAPI_CFG_CREATE'
exporting
object_id = 'MYMATCODE'
root_type = 'MARA'
root_name = 'MYMATCODE'
plant = 'MYPLANT'
importing
cfg_handle = l_handle
root_instance = l_instance
exceptions
error = 1
others = 2.
l_characts_vals-atnam = 'WIDTH'.
l_characts_vals-atwtb = '500'.
append l_characts_vals to it_characts_vals.
call function 'BAPI_CFGINST_CHARCS_VALS_SET'
exporting
object_id = 'MYMATCODE'
instance = l_instance
tables
characts_vals = it_characts_vals
characts_vals_err = it_characts_vals_err.
call function 'CE_C_SET_CBASE'.
l_poitem-int_obj_no = l_handle.
call function 'BAPI_PO_CREATE1'
exporting
poheader = l_poheader
poheaderx = l_poheaderx
importing
expheader = l_expheader
exppurchaseorder = l_exppurchaseorder
tables
poitem = lt_poitem
poitemx = lt_poitemx
poschedule = lt_poschedule
poschedulex = lt_poschedulex
return = lt_return.
call function 'BAPI_TRANSACTION_COMMIT'.
Thanks
Naveen khan

Similar Messages

  • BAPI for Purchasing Contract

    Hi  All,
    Can anybody suggest some BAPI for uploading pricing conditions in a purchasing contract.
    Thanks,
    Arun

    Hi Arun,
      refer to the link for BAPI's:
    http://www.sapbapi.com/bapi-list/
      Also refer to the link:
    Re: VK11,
    With luck,
    Pritam.

  • Using BAPIs for sales contracts

    Hi,
    I'm having this situation that I have to upload sales contracts into SAP from flat files. We planned to use BAPIs for this purpose. Is it a good option. Can anyone suggest better ideas. If BAPI is a good option, has anyone used standard BAPIs for sales contracts updation in SAP System. If yes, can you guide me through the process.

    Hi,
      You can start off with a program with:
    Get the filename of the convert file
      IMPORT /SAPDMC/LSMEMORY FROM MEMORY ID '/SAPDMC/LSMW'.
      V_PROJECT = /SAPDMC/LSMEMORY-PROJECT. " Project
      V_SUBPROJ = /SAPDMC/LSMEMORY-SUBPROJ. " Subproject
      V_OBJECT  = /SAPDMC/LSMEMORY-OBJECT.  " Object
      IF V_PROJECT IS INITIAL.
        V_PROJECT = 'XXXX_LOC'.
      ENDIF.
      IF V_SUBPROJ IS INITIAL.
        V_SUBPROJ = 'SD'.
      ENDIF.
      IF V_OBJECT IS INITIAL.
        V_OBJECT = 'XXXX_VA41'.
      ENDIF.
    Function will return path of converted file by LSMW object
      CALL FUNCTION '/SAPDMC/LSM_FILE_INFO_GET'
        EXPORTING
          PROJECT           = V_PROJECT  " /sapdmc/lsmemory-project
          SUBPROJ           = V_SUBPROJ  " /sapdmc/lsmemory-subproj
          OBJECT            = V_OBJECT   " /sapdmc/lsmemory-object
          X_ONLY_USED_FILES = 'X'
        IMPORTING
          FILE_CONV         = V_DSNAME   " Path of converted file
        EXCEPTIONS
          NO_SUCH_OBJECT    = 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.
    I am not much of an LSMW expert so wont be able to comment much.
    regards
    Aveek

  • Right Tool to upload Contract data into SRM 5.0 system ?

    Hi,
        Could you tell me, the right tool to upload Contract data from SAP 4.5 into SRM 5.0 system using transaction code BBP_CTR_MAIN. ?
    What would be the problem, if i go with LSMW?
    Thanks in Advance,
    Bobby

    Hi Friends,
        Could any one suggest me which tool (BDC/ LSMW/ BAPI) is suited to upload Contract data from SAP 4.5 into SRM 5.0 using transaction code BBP_CTR_MAIN.I am confusing with Arshad's reply on this.
    Thanks in advance,
    Bobby

  • How to add conditions when uploading contracts

    Hi experts
    I'm trying to upload contracts from a text file using BAPI BBP_PD_CTR_CREATE.
    I'm not able to create conditions with the contracts. Can anyone tell me the mandatory parameters that have to be passed in the BAPI in its it_conditions table.
    This is what I'm doing:
      wa_condition-guid = c_dummy_cnd.       "Dummy guid
      wa_condition-cond_type = l_condtyp.
      wa_condition-COND_PRC_UNIT = '0'.
      wa_condition-COND_RATE = l_condval.
      wa_condition-COND_CURR = l_condcurncy.
      wa_condition-COND_TAB = l_condtab.
      wa_condition-date_from = l_valstart.
      wa_condition-date_to = '99991231'.
      APPEND wa_condition to tbl_condition_ex.
    Points will be rewarded...
    Thanks

    Hi Neelima
    I tried with the code that you had provided but I still couldn't create the discount conditions.
    Here is my code in more detail:
      IF l_condtyp = '01AG'.                                "Header discount
        l_condtab = 'SAP019'.                               "Table for header discount
        wa_condition-p_guid = c_dummy_hdr.                  "Dummy guid of header
      ELSE.
        IF l_condplant IS NOT INITIAL .                     "Location dependant item discount
          wa_condition-INVENT_LOC_ID = l_condplant.         "Adding location
          l_condtab = 'SAP068'.                             "Table for location dependant discount
          wa_condition-p_guid = c_dummy_itm.                "Dummy guid of item
          wa_condition-COND_UNIT = l_unit.                  "Unit of item
        ELSE.                                               "Location independant item discount
          l_condtab = 'SAP016'.                             "Location independant discount table
          wa_condition-p_guid = c_dummy_itm.                "Dummy guid of item
          wa_condition-COND_UNIT = l_unit.                  "Unit of item
        ENDIF.
      ENDIF.
      wa_condition-guid = c_dummy_cnd.                      "Dummy guid
      wa_condition-cond_type = l_condtyp.       "(01AG)
      wa_condition-COND_RATE = l_condval.    "(15-)
      wa_condition-COND_CURR = l_condcurncy.   "(%)
      wa_condition-COND_TAB = l_condtab.      "(SAP019)
      wa_condition-date_from = sy-datum.          "(also tried vper_start ie. start date of contract)
      wa_condition-date_to = '99991231'.
      wa_condition-time_from = '000000'.
      wa_condition-time_to = '235959'.
      wa_condition-UOM_DENOMINATOR = '1'.
      wa_condition-UOM_NUMERATOR = '1'.
      APPEND wa_condition to tbl_condition_ex.
      CLEAR wa_condition.
    The importing table is still empty after the FM has been executed. There are no messages in the messages table either.
    Please help me out here.
    This is very urgent.
    Thanks

  • Using BAPI to upload Equipment Master (IE01)

    Hi,
    Can any one help to do below object...that i need for resume.
    Pls provide me compelete details with code or else give me guidelines  in detail to carrayout.....
    i should be thankful to you....
    •Using BAPI to upload Equipment Master (IE01). Fields that are uploaded are Equipment category, valid to date, Equip. Description, object type, Acquisition value, Acquisition date, Maintenance Plan, plan section, catalog profile. Input file is accessed from application server. Error log file is created at application server.
    with regards
    bheem

    If this is a onetime load, you can use LSMW to do this.
    Object 0400.  Must easier than writing a report from scratch.
    Albert

  • Bapi FM upload program

    Hi All,
    I am doing bapi fm upload program, when i run the program it shows the short dump error,
    i debug this program, the cursor is not move after tansaction_commit,
    it shows the FM: ps_commit. it s not run successfully,
    any one help for this error,
    (  CALL FUNCTION 'BAPI_PS_PRECOMMIT'                                                                " CALL FUNCTION MODULE
                  TABLES
                       ET_RETURN       = lt_ret2.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'                                                          " CALL FUNCTION MODULE
                   EXPORTING
                      WAIT          = 'X'.)
    Thanks for advance help.
    Amudha

    Hi,
    You can delete a project definition using the BAPI "BAPI_BUS2001_DELETE". You must enter the name of the project definition that is to be deleted in "I_PROJECT_DEFINITION". Before the project definition is deleted, the following is checked:
    the project definition is deleted in the document tables. If the project has WBS elements, these are also deleted. If the project has other objects such as networks, activities and so on, the BAPI terminates and an error message is displayed. These must be deleted beforehand. The BAPI does not delete these automatically. The project definition is deleted as soon as a LUW (Logical Unit of Work) has been completed with the BAPI BAPI_PS_PRECOMMIT and COMMIT WORK. Only one project or one WBS element from a project can be processed at a time in one LUW. You cannot delete temporary objects. This means that if you create a project in an LUW, you cannot delete it immediately after creating it. You can delete it using this BAPI only after you physically create the project using the BAPIs "BAPI_PS_PRECOMMIT" and "COMMIT WORK".
    REgards,
    Nandha

  • Reg BAPI: "'BAPI_BASICPAY_CREATE" uploading to infotype P0008

    The following BAPI to upload the salary data to info type PA0008( BASIC PAY).
    This bapi is expects the table type amount with 4 decimals.
    Please let us know  any other bapi to upload the data to infotype 0008 or how to work with existing bapi. Sothat amount would be with 2 decimals raterthan 4 decimals.
    CALL FUNCTION 'BAPI_BASICPAY_CREATE'
          EXPORTING
            EMPLOYEENUMBER             = IT_PA0008-PERNR
            SUBTYPE                    = IT_PA0008-SUBTY
            VALIDITYBEGIN              = IT_PA0008-BEGDA
            VALIDITYEND                = IT_PA0008-ENDDA
            PAYSCALETYPE               = IT_PA0008-TRFAR
            PAYSCALEAREA               = IT_PA0008-TRFGB
            PAYSCALEGROUP              = IT_PA0008-TRFGR
            PAYSCALELEVEL              = IT_PA0008-TRFST
      NEXTINCREASE               =
      LOCALALLOWLEVEL            =
      PARTNERSHIP                =
      CURRENCY                   =
      COMPARISONPAYSCLTYPE       =
      COMPARISONPAYSCLAREA       =
      COMPARISONPAYSCLGRP        =
      COMPARISONPAYSCLLVL        =
      COMPNEXTINCREASE           =
            CAPACITYUTILLEVEL          = IT_PA0008-BSGRD
            HOURSWORKEDPERPERIOD       = IT_PA0008-DIVGV
      ANNUALSALARY               =
      CASEGROUPCATALOG           =
      CASEGROUP                  =
            CURRENCYANNUALSALARY       = IT_PA0008-ANCUR
      REASON                     =
      NOCOMMIT                   =
    IMPORTING
        RETURN                     = IT_BAPIRETURN1
       EMPLOYEENUMBER             = V_PERNR
      SUBTYPE                    =
      OBJECTID                   =
      LOCKINDICATOR              =
      VALIDITYBEGIN              =
      VALIDITYEND                =
      RECORDNUMBER               =
         TABLES
          <b> WAGETYPES                  = IT_WAGE</b>
    tHANKS
    Badari
    Help would be highly appreciable!

    PL note that HR_INFOTYPE_OPERATION is not RFC enabled.. you will have to wrap it around with a custom RFC in order to use it in palce of the above BAPI..
    ~Suresh

  • Upload Contracts in SRM

    Hi Guys,
    When trying to upload the contracts data in SRM using the following process.
    1. Contract Management -- > Upload contracts -- > Upload
    We are inputting the file from the existing contract using the download option. After doing this i am facing an error called,
    The file cannot be read.
    Please help me in this issue. And please proved any file templete for it. Or do i need to modify the download flat file as it already contains the Document number and the GUI id.
    Thanks in Advance,
    Mohit.

    Hi Mohit,
    If you want to upload R/3 contracts to SRM you can run the below mentioned report using SA38 and can upload the contracts in SRM.
    <b>BBP_CONTRACT_INITIAL_UPLOAD</b>
    However any changes made in the contracts in R/3 after the upload will not get updated in SRM.
    The otherway is to publish contracts as catalogs using XI.
    Hope this resolves your query. Clarifications are welcome.
    Assign points for suitable answers.
    Rgds,
    Teja

  • Bapi to upload data  for hrp1001

    Hi is there any standard Bapi to upload data in 1001.
    I know it can be done by lsmw or BDC ..but i wanted to aout any bapi

    Hi pratyush,
    Try using FM RH_INSERT_INFTY.
    Before RH_INSERT_INFTY, call function RH_PM_ENQUEUE, after RH_INSERT_INFTY, call function RH_PM_DEQUEUE.
    Regards,
    Dilek

  • Mass upload contract with "Distribute Contract to Catalog" flag

    I need to mass upload contract to update the flag "Distribute Contract to Catalog" (for srm mdm). What are the options. I don't see any option of that flag in the screen "Change Contracts: Mass Processing"

    Solved on own
    One needs to maintain System type as 'CATALOG' in SPRO >Define Backend Systems.
    This makes the Distribute Contract Catalog check box to be visible in the Header tab of contract.
    Regards
    Sarath

  • Uploading Contracts through XI into CCM

    Hi,
    We are using SRM 5.0, CCM 2.0, XI 3.0, EBP 5.5.
    Kindly let me know what is the process of uploading contracts using XI from SRM's EBP to CCM.
    Thanks,
    Swetha

    Hi,
    Check the below link:-
    Upload Contracts
    Regards.
    Praveen

  • BAPI for changing CONTRACTS.

    Hi All,
    I want to update the short text for CONTRACTS in table EKPO from filed CDPOS-VALUE_NEW
    for this i was using function module BAPI_PO_CHANGE
    This Bapi is is succesfully updating the PO it is not updating the contracts....
    Please help me with the BAPI to update text in contracts....
    Please its very urgent
    Thanx in advance,
    Amruta.

    Hi Ajay,
    I have done the same .....
    REPORT  ZTEST1234                            .
    data : wa_ekpo-ebelp type ekpo-ebelp value '00010'.
    parameters :ebeln type ekpo-ebeln.
    data : it_poitem type STANDARD TABLE OF BAPIMEPOITEM with HEADER LINE .
    data : it_poitem1 type STANDARD TABLE OF BAPIMEPOITEMX WITH HEADER LINE.
    data : it_return type STANDARD TABLE OF bapiret2.
    it_poitem-PO_ITEM = wa_ekpo-ebelp.
    it_poitem-SHORT_TEXT = 'mod'.
    APPEND it_poitem.
    it_poitem1-PO_ITEM = wa_ekpo-ebelp.
    it_poitem1-SHORT_TEXT = 'X'.
    APPEND it_poitem1.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder                = ebeln
      POHEADER                     =
      POHEADERX                    =
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
    IMPORTING
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
    TABLES
       RETURN                       = it_return
       POITEM                       = it_poitem
       POITEMX                      = it_poitem1
      POADDRDELIVERY               =
      POSCHEDULE                   =
      POSCHEDULEX                  =
      POACCOUNT                    =
      POACCOUNTPROFITSEGMENT       =
      POACCOUNTX                   =
      POCONDHEADER                 =
      POCONDHEADERX                =
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
      POSERVICES                   =
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT          = ' '
              IMPORTING
                RETURN        =..
    This is my code just for updating the text but now the problemis this works with
    When ebeln = 45000000017
    whose bstyp = F  ie PO
    but when i do the same for Ebeln = 45000000000
    whose bstyp = K ie contracts 
    it gives me error message that this BAPI  cannot be executed for Contracts...
    So please help me with the Bapi to change Contracts.
    Thanx,
    Amruta

  • Interface Using BAPI for Uploading shipment datas

    Can any1 send me the example code for Inbound Interface using BAPI for Uploading shipment datas.please kindly send me the programs which u using with BAPI

    Hi
    Except hiring (or new joinee) for all other actions you can use below Function Module.
    HR_INFOTYPE_OPERATION.
    ~~~Ganesh Kumar K.

  • Bapi to upload and download the leave details

    Hi all,
          Can  u please tell me a bapi to upload and download the leave details for the infotype 2001.
    Thanks.

    Hi
    Warning! The API methods "Delete," "Approve," "Create," and "Request," and "Change," as well as their corresponding RFCs:
    <b>bapi_absence_delete
    bapi_absence_create
    bapi_absence_approve
    bapi_absence_request
    bapi_absence_change</b>
    are <b>no longer valid</b>. Using these APIs can create inconsistencies in time data.
    Instead, use the corresponding API Methods "ManageDelete," "ManageCreation," and "ManageChange" for the Business Object BUS7007, as well as the following corresponding RFCs:
    <b>bapi_ptmgrattabs_mngdelete
    bapi_ptmgrattabs_mngcreation
    bapi_ptmgrattabs_mngchange</b>
    Regards
    Raj

Maybe you are looking for