SAP BAPI调用常用资源

SAP 货物移动相关Bapi(MIGO/MB1A)
一、货物移动。bapi  BAPI_GOODSMVT_CREATE
其中 参数 : GOODSMVT_CODE 有
GMCODE Table T158G – 01 – MB01 – Goods Receipts for Purchase Order
*                      02 – MB31 – Goods Receipts for Prod Order
*                      03 – MB1A – Goods Issue
*                      04 – MB1B – Transfer Posting
*                      05 – MB1C – Enter Other Goods Receipt
*                      06 – MB11
*                      07 – MB04
二、凭证冲销。事物代码MBST BAPI  BAPI_GOODSMVT_CANCEL
三、获得凭证明细 BAPI  BAPI_GOODSMVT_GETDETAIL
四、查询凭证。根据物料 工厂 移动类型  记账日期 创建人 等 BAPI  BAPI_GOODSMVT_GETITEMS
SAP内部使用 BAPI  BAPI_GOODSMVT_SAPCREATE
转载在:http://blog.sina.com.cn/s/blog_89daaebb0101deyw.html

10 thoughts on “SAP BAPI调用常用资源

  1. mm模块的几个库存管理BAPI

    库存:
    1. BAPI_MATERIAL_AVAILABILITY 获得商品可用库存
    2. CO_ZA_AVAILABILITY_CHECK
    3.AVAILABILITY_CHECK_CONTROLLER
    4.AVAILABILITY_CHECK
    库存管理:
    BAPI_GOODSMVT_GETDETAIL 显示货物移动的明细
    BAPI_GOODSMVT_GETITEMS 显示物料凭证的详细清单
    BAPI_GOODSMVT_CREATE 货物移动过帐,入库,出库
    BAPI_GOODSMVT_CANCEL 冲销货物移动

    BAPI_MATERIAL_SAVEDATA 建立/更改物料主檔
    BAPI_OBJCL_CREATE 建立/更改物料主檔分類
    BAPI_OBJCL_CHANGE 建立/更改物料主檔分類
    CLMM_MAINTAIN_CLASSIFICATIONS 批量建立/更改物料主檔分類
    CLAF_CLASSIFICATION_OF_OBJECTS 顯示物料主檔分類特性值
    BAPI_MATERIAL_EXISTENCECHECK 檢查物料主檔是否存在
    BAPI_MATERIAL_GETLIST 顯示物料主檔明細

    BAPI_PO_CREATE1 建立采購單
    BAPI_PO_CHANGE 更改采購單
    BAPI_PO_GETDETAIL 顯示采購單明細
    BAPI_PO_RELEASE 核發采購單
    BAPI_REQUISITION_CREATE 建立請購單
    BAPI_REQUISITION_CHANGE 更改請購單
    BAPI_REQUISITION_GETDETAIL 顯示請購單明細
    BAPI_REQUISITION_RELEASE_GEN 核發請購單

    BAPI_CHARACT_CREATE 建立特性
    BAPI_CHARACT_CHANGE 更改特性
    BAPI_CHARACT_DELETE 刪除特性
    BAPI_CHARACT_RENAME 重新命名特性
    BAPI_CHARACT_GETDETAIL 讀取特性屬性
    BAPI_CHARACT_ADDLONGTEXT 設定特性或數值的長文
    BAPI_CHARACT_REMOVELONGTEXT 刪除特性或數值的長文
    BAPI_CHARACT_GETLONGTEXT 讀取數值的特性長文
    CARD_CHARACTERISTIC_READ 顯示特性值的值列表

    BAPI_CLASS_CREATE 建立類別
    BAPI_CLASS_CHANGE 變更類別
    BAPI_CLASS_DELETE 刪除類別
    BAPI_CLASS_GETDETAIL 讀取類別資訊(取分類下特性及特性值)
    BAPI_CLASS_EXISTENCECHECK 檢查物件存在性

    BAPI_VENDOR_GETDETAIL 顯示供應商明細
    BAPI_VENDOR_EXISTENCECHECK 檢查存在性

    BAPI_MATERIALGROUP_GET_LIST 讀取物料群組/物料群組說明

    BAPI_GOODSMVT_CREATE 過帳物料異動
    BAPI_GOODSMVT_CANCEL 沖帳(取消)物料異動
    BAPI_GOODSMVT_GETDETAIL 顯示物料異動明細
    BAPI_GOODSMVT_GETITEMS 顯示物料文件的明細清單

  2. 在SAP实际项目中用到的BAPI

    MM模块
    1、 BAPI_MATERIAL_SAVEDATA 创建物料主数据
    注意参数EXTENSIONIN的使用,可以创建自定义字段
    例如WA_BAPI_TE_MARA-MATERIAL = ITAB_UP-MATNR.
    T_EXTENSIONIN-STRUCTURE = ‘BAPI_TE_MARA’.
    T_EXTENSIONIN-VALUEPART1 = WA_BAPI_TE_MARA.
    APPEND T_EXTENSIONIN.
    WA_BAPI_TE_MARAX-MATERIAL = ITAB_UP-MATNR.
    T_EXTENSIONINX-STRUCTURE = ‘BAPI_TE_MARAX’.
    T_EXTENSIONINX-VALUEPART1 = WA_BAPI_TE_MARAX.
    APPEND T_EXTENSIONINX.
    2、 BAPI_OBJCL_CREATE 分类视图的创建
    3、 BAPI_OBJCL_GETCLASSES 分类视图得到详细信息
    4、 BAPI_MATERIAL_SAVEREPLICA 物料视图的扩充
    5、 BAPI_GOODSMVT_CREATE 创建物料凭证 注意表T158G可以决定goodsmvt_code
    6、 BAPI_GOODSMVT_CANCEL 冲销物料凭证
    7、 BAPI_PR_CREATE 创建PR
    8、 BAPI_PO_CREATE1 创建PO
    9、 BAPI_PO_CHANGE 修改PO和删除PO
    10、WS_REVERSE_GOODS_ISSUE 冲销交货单的过账发货
    11、BAPI_RESERVATION_CREATE1 创建预留
    12、BAPI_RESERVATION_CHANGE 修改和删除预留
    SD模块
    1、 BAPI_SALESORDER_CREATEFROMDAT2 创建销售订单
    2、 SD_SALESDOCUMENT_CREATE 创建销售订单
    3、 BAPI_OUTB_DELIVERY_CREATE_SLS 根据销售订单创建交货单
    4、 BAPI_BILLINGDOC_CREATEMULTIPLE 创建发票,注意参数ref_doc_ca
    5、 BAPI_SALESORDER_CHANGE 修改或者删除销售订单
    6、 MB_CANCEL_GOODS_MOVEMENT 冲销交货单的过账发货
    7、 BAPI_BILLINGDOC_CANCEL 发票的冲销
    PM模块
    1、BAPI_OBJCL_CREATE 、BAPI_OBJCL_CHANGE、BAPI_OBJCL_GETDETAIL
    计量点通用属性导入
    2、MEASUREM_DOCUM_RFC_SINGLE_001 计量凭证创建
    FI模块
    1、K_HIERARCHY_TABLES_READ 成本要素组明细
    2、BAPI_ACC_DOCUMENT_POST 创建会计凭证
    3、BAPI_ACC_DOCUMENT_REV_POST 反冲会计凭证
    PS模块
    1、BAPI_PS_INITIALIZATION、BAPI_BUS2001_CREATE、BAPI_PS_PRECOMMIT 创建项目定义
    2、BAPI_PS_INITIALIZATION、BAPI_BUS2054_CREATE_MULTI、BAPI_PS_PRECOMMIT 创建WBS
    创建WBS的时候,注意参数 wbs_left和 wbs_up,这个是创建有层级的WBS必须要填写的
    3、KBPP_EXTERN_UPDATE_CO 修改项目和WBS的预算

  3. SAP常用BAPI函数

    BAPI_ALE_MODEL_GET
    BAPI_BARCODE_SENDLIST
    BAPI_ANSWER_READMULTIPLE
    BAPI_APPCOMP_READMULTIPLE
    BAPI_PROCDIA_READMULTIPLE
    BAPI_PROCDIA_WRITEMULTIPLE
    BAPI_DIAVAR_READMULTIPLE
    BAPI_DIAVAR_WRITEMULTIPLE
    BAPI_PROCEVENT_READMULTIPLE
    BAPI_PROCEVENT_WRITEMULTIPLE
    BAPI_HIERFILT_READMULTIPLE
    BAPI_HIERFILT_WRITEMULTIPLE
    BAPI_PROCFUNCT_READMULTIPLE
    BAPI_PROCFUNCT_WRITEMULTIPLE
    BAPI_PROCGROUP_READMULTIPLE
    BAPI_PROCGROUP_WRITEMULTIPLE
    BAPI_PROCCOMP_READMULTIPLE
    BAPI_PROCVAR_READMULTIPLE
    BAPI_CUSPRO_WRITESCOPE
    BAPI_QUESTION_READMULTIPLE
    BAPI_HIERSTRUCT_READMULTIPLE
    BAPI_HIERSTRUCT_WRITEMULTIPLE
    BAPI_CLASS_CHANGE
    BAPI_CLASS_CREATE
    BAPI_CLASS_DELETE
    BAPI_CLASS_EXISTENCECHECK

    BAPI_CLASS_GET_CHARACTERISTICS
    BAPI_CLASS_GET_CLASSIFICATIONS
    BAPI_CLASS_GETDETAIL
    BAPI_CLASS_GETLIST
    BAPI_CLASS_GETSTATUS
    BAPI_CLASS_SELECT_OBJECTS
    BAPI_BUSINESS_PARTNER_CHANGE
    BAPI_BUSINESS_PARTNER_CREATE
    BAPI_BUSINESS_PARTN_GET_DETAIL
    BAPI_PAR_EMPLOYEE_CHANGEPASSWO
    BAPI_PAR_EMPLOYEE_CHECKEXISTEN
    BAPI_PAR_EMPLOYEE_CHECKPASSWOR
    BAPI_PARTNEREMPLOYEE_CREATE
    BAPI_PAR_EMPLOYEE_CREATE_PW_RE
    BAPI_PAR_EMPLOYEE_DELETE_PW_RE
    BAPI_PARTNEREMPLOYEE_DISPLAY
    BAPI_PARTNEREMPLOYEE_EDIT
    BAPI_PARTNEREMPLOYEE_GETINTNUM
    BAPI_BUSPARTNEREMPLOYE_GETLIST
    BAPI_PAR_EMPLOYEE_GET_PW_REG
    BAPI_PAR_EMPLOYEE_INITPASSWORD
    BAPI_CHARACT_CHANGE
    BAPI_CHARACT_CREATE
    BAPI_CHARACT_DELETE
    BAPI_CHARACT_EXISTENCECHECK
    BAPI_CHARACT_GETDETAIL
    BAPI_CHARACT_GETLIST
    BAPI_CURRENCY_GETDECIMALS
    BAPI_CURRENCY_GETLIST
    BAPI_EXCHANGERATE_CREATE
    BAPI_EXCHRATE_CREATEMULTIPLE
    BAPI_EXCHRATE_GETCURRENTRATES
    BAPI_EXCHANGERATE_GETDETAIL
    BAPI_EXCHANGERATE_GETFACTORS
    BAPI_EXCHRATE_GETLISTRATETYPES
    BAPI_EXCHANGERATE_SAVEREPLICA
    BAPI_OBJCL_CHANGE
    BAPI_OBJCL_CONCATENATEKEY
    BAPI_OBJCL_CREATE
    BAPI_OBJCL_DELETE
    BAPI_OBJCL_EXISTENCE_CHECK
    BAPI_OBJCL_GETCLASSES
    BAPI_OBJCL_GETDETAIL
    BAPI_OBJCL_GETOBJECTS
    BAPI_OBJCL_SPLITKEY
    BAPI_ADDRESSORG_CHANGE
    BAPI_ADDRESSORG_GETDETAIL
    BAPI_ADDRESSORG_SAVEREPLICA
    BAPI_ADDRESSPERS_CHANGE
    BAPI_ADDRESSPERS_GETDETAIL
    BAPI_ADDRESSPERS_SAVEREPLICA
    BAPI_ADDRESSCONTPART_CHANGE
    BAPI_ADDRESSCONTPART_GETDETAIL
    BAPI_ADDRCONTPART_SAVEREPLICA
    BAPI_CATIMESHEETMGR_CHANGE
    BAPI_CATIMESHEETMGR_DELETE
    BAPI_CATIMESHEETMGR_INSERT
    BAPI_EECATIMESHEET_GETWORKLIST
    BAPI_CTREQUEST_CREATE
    BAPI_CTREQUEST_CREATE_TASKS
    BAPI_CTREQUEST_RELEASE
    BAPI_DOCUMENT_CHANGE
    BAPI_DOCUMENT_CHANGE2
    BAPI_DOCUMENT_CHECKIN
    BAPI_DOCUMENT_CHECKIN2
    BAPI_DOCUMENT_CHECKIN_REPLACE2
    BAPI_DOCUMENT_CHECKOUTMODIFY
    BAPI_DOCUMENT_CHECKOUTMODIFY2
    BAPI_DOCUMENT_CHECKOUTSET2
    BAPI_DOCUMENT_CHECKOUTVIEW
    BAPI_DOCUMENT_CHECKOUTVIEW2
    BAPI_DOCUMENT_CHECKOUTVIEWX
    BAPI_DOCUMENT_CREATE2
    BAPI_DOCUMENT_CREATE
    BAPI_DOCUMENT_CREATE2
    BAPI_DOCUMENT_CREATEFROMSOURCE
    BAPI_DOCUMENT_CREATEFROMSRC2
    BAPI_DOCUMENT_CREATENEWVERSION
    BAPI_DOCUMENT_CREATENEWVRS2
    BAPI_DOCUMENT_DELETE
    BAPI_DOCUMENT_DEQUEUE
    BAPI_DOCUMENT_ENQUEUE
    BAPI_DOCUMENT_EXISTENCECHECK
    BAPI_DOCUMENT_GETACTVERSION
    BAPI_DOCUMENT_GETAPPLICATION
    BAPI_DOCUMENT_GETDCDETAIL
    BAPI_DOCUMENT_GETDCLIST
    BAPI_DOCUMENT_GETDCLIST2
    BAPI_DOCUMENT_GETDETAIL
    BAPI_DOCUMENT_GETDETAIL2
    BAPI_DOCUMENT_GETDOCTYPEDETAIL
    BAPI_DOCUMENT_GETFRONTENDTYPE
    BAPI_DOCUMENT_GETLIST
    BAPI_DOCUMENT_GETOBJECTDOCS
    BAPI_DOCUMENT_GETSTATUS
    BAPI_DOCUMENT_GETSTATUSLIST
    BAPI_DOCUMENT_GETSTRUCTURE
    BAPI_DOCUMENT_LOAD
    BAPI_DOCUMENT_SETFRONTENDTYPE
    BAPI_DOCUMENT_SETSTATUS
    BAPI_HELPVALUES_GET
    BAPI_HELPVALUES_GET_SEARCHHELP
    BAPI_OIW_GET_CATALOG
    BAPI_OIW_GET_DATA
    BAPI_ORGMASTER_REPLICATE
    BAPI_ORGMASTER_SAVE_ORIG_MULT
    BAPI_ORGMASTER_SAVE_REPL_MULT
    BAPI_PDOTYPES_GETDETAILEDLIST
    BAPI_SYSTEM_MS_GETDETAILS
    BAPI_SYSTEM_MS_GETLIST
    BAPI_SYSTEM_MT_CREATEBYTEMPL
    BAPI_SYSTEM_MT_GETALERTDATA
    BAPI_SYSTEM_MON_GETDETAILS
    BAPI_SYSTEM_MON_GETLIST
    BAPI_SYSTEM_MON_GETTEMPLATE
    BAPI_SYSTEM_MON_GETTREE
    BAPI_APPLICATIONLOG_GETDETAIL
    BAPI_CONVERSION_EXT2INT
    BAPI_CONVERSION_EXT2INT1
    BAPI_CONVERSION_INT2EXT
    BAPI_CONVERSION_INT2EXT1
    BAPI_FIELDHELP_GETDOCU
    BAPI_HYPERLINK_GETTEXT
    BAPI_INTERFACE_GETDOCU
    BAPI_MESSAGE_GETDETAIL
    BAPI_TRANSACTION_COMMIT
    BAPI_TRANSACTION_ROLLBACK
    BAPI_SYS_MNGMT_UTIL_GETCURSERV
    BAPI_XBP_GET_BP_RESRC_ON_DATE
    BAPI_XBP_GET_BP_SRVRES_ON_DATE
    BAPI_XBP_GET_CURR_BP_RESOURCES
    BAPI_CATIMESHEETRECORD_GETLIST
    BAPI_USER_ACTGROUPS_ASSIGN
    BAPI_USER_ACTGROUPS_DELETE
    BAPI_USER_CHANGE
    BAPI_USER_CLONE
    BAPI_USER_CREATE
    BAPI_USER_CREATE1
    BAPI_USER_DELETE
    BAPI_USER_DISPLAY
    BAPI_USER_GET_DETAIL
    BAPI_USER_LOCK
    BAPI_USER_PROFILES_ASSIGN
    BAPI_USER_PROFILES_DELETE
    BAPI_USER_UNLOCK
    BAPI_COMPANY_CLONE
    BAPI_SYSTEM_ALERT_ACKNOWLEDGE
    BAPI_SYSTEM_ALERT_GETDETAILS
    BAPI_SYSTEM_ALERT_SPLITTDATA
    BAPI_SYSTEM_MTE_DISABLEALGEN
    BAPI_SYSTEM_MTE_ENABLEALGEN
    BAPI_SYSTEM_MTE_GETALERTS
    BAPI_SYSTEM_MTE_GETGENPROP
    BAPI_SYSTEM_MTE_GETMLCURVAL
    BAPI_SYSTEM_MTE_GETMLHIS
    BAPI_SYSTEM_MTE_GETMLPROP
    BAPI_SYSTEM_MTE_GETPERFCURVAL
    BAPI_SYSTEM_MTE_GETPERFHIS
    BAPI_SYSTEM_MTE_GETPERFPROP
    BAPI_SYSTEM_MTE_GETSMPROP
    BAPI_SYSTEM_MTE_GETSMVALUE
    BAPI_SYSTEM_MTE_GETTIDBYNAME
    BAPI_SYSTEM_MTE_GETTREE
    BAPI_SYSTEM_MTE_RESET
    BAPI_SYSTEM_MTE_SETGENPROP
    BAPI_SYSTEM_MTE_SETMLPROP
    BAPI_SYSTEM_MTE_SETPERFPROP
    BAPI_SYSTEM_MTE_SETSMPROP
    BAPI_SYSTEM_MTE_SPLITTDATA
    BAPI_XBP_JOB_ABORT
    BAPI_XBP_JOB_ADD_ABAP_STEP
    BAPI_XBP_JOB_ADD_EXT_STEP
    BAPI_XBP_JOB_STATUS_CHECK
    BAPI_XBP_JOB_CLOSE
    BAPI_XBP_JOB_COUNT
    BAPI_XBP_JOB_DELETE
    BAPI_XBP_JOB_DEFINITION_GET
    BAPI_XBP_JOB_STATUS_GET
    BAPI_XBP_VARIANT_INFO_GET
    BAPI_XBP_JOB_ABAP_STEP_MODIFY
    BAPI_XBP_JOB_EXT_STEP_MODIFY
    BAPI_XBP_JOB_OPEN
    BAPI_XBP_JOB_JOBLOG_READ
    BAPI_XBP_JOB_SPOOLLIST_READ
    BAPI_XBP_JOB_SELECT
    BAPI_XBP_JOB_START_ASAP
    BAPI_XBP_JOB_START_IMMEDIATELY
    BAPI_XMI_CHECK_VERSION
    BAPI_XMI_DESCRIBE_INTERFACE
    BAPI_XMI_ENTER_LOGMSG
    BAPI_XMI_GET_VERSIONS
    BAPI_XMI_LOGOFF
    BAPI_XMI_LOGON
    BAPI_XMI_SELECT_LOG
    BAPI_XMI_SET_AUDITLEVEL
    BAPI_XMI_UPLOAD_MSG_FORMATS
    BAPI_ABSENCE_APPROVE
    BAPI_ABSENCE_CHANGE
    BAPI_ABSENCE_CREATE
    BAPI_ABSENCE_DELETE
    BAPI_ABSENCE_GETDETAIL
    BAPI_ABSENCE_GETDETAILEDLIST
    BAPI_ABSENCE_GETLIST
    BAPI_ABSENCE_REQUEST
    BAPI_ABSENCE_SIMULATECREATION
    BAPI_ADDRESSEMPCH_CHANGE
    BAPI_ADDRESSEMPCH_CREATE
    BAPI_ADDREMPCH_CREATESUCCESSOR
    BAPI_ADDRESSEMPCH_GETDETAIL
    BAPI_ADDREMPCH_GETDETAILEDLIST
    BAPI_ADDRESSEMPCH_REQUEST
    BAPIADDREMPCH_SIMULATECREATION
    BAPI_ADDRESSEMPDE_CHANGE
    BAPI_ADDRESSEMPDE_CREATE
    BAPI_ADDREMPDE_CREATESUCCESSOR
    BAPI_ADDRESSEMPDE_GETDETAIL
    BAPI_ADDREMPDE_GETDETAILEDLIST
    BAPI_ADDRESSEMPDE_REQUEST
    BAPIADDREMPDE_SIMULATECREATION
    BAPI_ADDRESSEMPES_CHANGE
    BAPI_ADDRESSEMPES_CREATE
    BAPI_ADDREMPES_CREATESUCCESSOR
    BAPI_ADDRESSEMPES_GETDETAIL
    BAPI_ADDREMPES_GETDETAILEDLIST
    BAPI_ADDRESSEMPES_REQUEST
    BAPIADDREMPES_SIMULATECREATION
    BAPI_ADDRESSEMPFR_CHANGE
    BAPI_ADDRESSEMPFR_CREATE
    BAPI_ADDREMPFR_CREATESUCCESSOR
    BAPI_ADDRESSEMPFR_GETDETAIL
    BAPI_ADDREMPFR_GETDETAILEDLIST
    BAPI_ADDRESSEMPFR_REQUEST
    BAPIADDREMPFR_SIMULATECREATION
    BAPI_ADDRESSEMPJP_CHANGE
    BAPI_ADDRESSEMPJP_CREATE
    BAPI_ADDRESSEMPJP_CRESUCCESSOR
    BAPI_ADDRESSEMPJP_GETDETAIL
    BAPI_ADDRESSEMPJP_DETAILEDLIST
    BAPI_ADDRESSEMPJP_REQUEST
    BAPI_ADDRESSEMPJP_SIMUCREATION
    BAPI_ADDRESSEMPNL_CHANGE
    BAPI_ADDRESSEMPNL_CREATE
    BAPI_ADDREMPNL_CREATESUCCESSOR
    BAPI_ADDRESSEMPNL_GETDETAIL
    BAPI_ADDREMPNL_GETDETAILEDLIST
    BAPI_ADDRESSEMPNL_REQUEST
    BAPIADDREMPNL_SIMULATECREATION
    BAPI_ADDRESSEMPUS_CHANGE
    BAPI_ADDRESSEMPUS_CREATE
    BAPI_ADDREMPUS_CREATESUCCESSOR
    BAPI_ADDRESSEMPUS_GETDETAIL
    BAPI_ADDREMPUS_GETDETAILEDLIST
    BAPI_ADDRESSEMPUS_REQUEST
    BAPIADDREMPUS_SIMULATECREATION
    BAPI_ADDRESSEMP_APPROVE
    BAPI_ADDRESSEMP_CHANGE
    BAPI_ADDRESSEMP_CREATE
    BAPI_ADDRESSEMPCREATESUCCESSOR
    BAPI_ADDRESSEMP_DELETE
    BAPI_ADDRESSEMP_DELIMIT
    BAPI_ADDRESSEMP_GETDETAIL
    BAPI_ADDRESSEMPGETDETAILEDLIST
    BAPI_ADDRESSEMP_GETLIST
    BAPI_ADDRESSEMP_REQUEST
    BAPIADDRESSEMPSIMULATECREATION
    BAPI_APPLICANT_CHANGEPASSWORD
    BAPI_APPLICANT_CHECKPASSWORD
    BAPI_APPLICANT_CREATE
    BAPI_APPLICANT_CREATE_PW_REG
    BAPI_APPLICANT_DELETE_PW_REG
    BAPI_APPLICANT_CHECKEXISTENCE
    BAPI_APPLICANT_GET_PW_REG
    BAPI_APPLICANT_GETSTATUS
    BAPI_APPLICANT_INITPASSWORD
    BAPI_BANKDETAIL_APPROVE
    BAPI_BANKDETAIL_CHANGE
    BAPI_BANKDETAIL_CREATE
    BAPI_BANKDETAILCREATESUCCESSOR
    BAPI_BANKDETAIL_DELETE
    BAPI_BANKDETAIL_DELIMIT
    BAPI_BANKDETAIL_GETDETAIL
    BAPI_BANKDETAILGETDETAILEDLIST
    BAPI_BANKDETAIL_GETLIST
    BAPI_BANKDETAIL_REQUEST
    BAPIBANKDETAILSIMULATECREATION
    BAPI_BANKDETAILJP_GETDETAIL
    BAPI_BANKDETAILJP_DETAILEDLIST
    BAPI_BASICPAY_APPROVE
    BAPI_BASICPAY_CHANGE
    BAPI_BASICPAY_CREATE
    BAPI_BASICPAY_CREATESUCCESSOR
    BAPI_BASICPAY_DELETE
    BAPI_BASICPAY_GETDETAIL
    BAPI_BASICPAY_GETLIST
    BAPI_BASICPAY_REQUEST
    BAPI_BASICPAY_SIMULATECREATION
    BAPI_BEN_BENADJREAS_CALC_ENDDA
    BAPI_BEN_BENADJREAS_DELIMIT
    BAPI_BEN_BENADJREAS_GET_LIST
    BAPI_EMPLOYEE_CHANGEPASSWORD
    BAPI_EMPLOYEE_CHECKPASSWORD
    BAPI_EMPLOYEE_CREATE_PW_REG
    BAPI_EMPLOYEE_DELETE_PW_REG
    BAPI_EMPLOYEE_DEQUEUE
    BAPI_EMPLOYEE_ENQUEUE
    BAPI_EMPLOYEE_CHECKEXISTENCE
    BAPI_EMPLOYEE_GETDATA
    BAPI_EMPLOYEE_GET_PW_REG
    BAPI_EMPLOYEE_INITPASSWORD
    BAPI_TIMEQUOTA_GETDETAILEDLIST
    BAPI_BEN_BUS3029_CHECK_SELECT
    BAPI_BEN_BUS3029_GET_OFFER
    BAPI_BEN_BUS3029_CREATE_PLANS
    BAPI_BEN_BUS3029_DELETE_PLANS
    BAPI_BEN_BUS3029_GET_COREQ
    BAPI_BEN_BUS3029_GET_EVT_LIST
    BAPI_BEN_BUS3029_GET_OFFER
    BAPI_BEN_BUS3029_GET_OPEN_PERI
    BAPI_BEN_BUS3029_GET_PARTICIP
    BAPI_BEN_BUS302901_GET_DEP
    BAPI_BEN_BUS302901_GET_POS_DEP
    BAPI_BEN_BUS302902_GET_BEN
    BAPI_BEN_BUS302902_GET_POS_BEN
    BAPI_BEN_BUS302903_GET_BEN
    BAPI_BEN_BUS302903_GET_INV
    BAPI_BEN_BUS302903_GET_POS_BEN
    BAPI_BEN_BUS302903_GET_POS_INV
    BAPI_BEN_BUS302906_GET_BEN
    BAPI_BEN_BUS302906_GET_DEP
    BAPI_BEN_BUS302906_GET_INV
    BAPI_BEN_BUS302906_GET_POS_BEN
    BAPI_BEN_BUS302906_GET_POS_DEP
    BAPI_BEN_BUS302906_GET_POS_INV
    BAPI_BEN_BUS302907_GET_BEN
    BAPI_BEN_BUS302907_GET_POS_BEN
    BAPI_PAYROLLTRAVELEXPNSESPOST
    BAPI_TIMEAVAILSCHEDULE_BUILD
    BAPI_CONFIRMATION_INPUT
    BAPI_GET_PAYSLIP
    BAPI_GET_PAYSLIP_HTML
    BAPI_GET_PAYROLL_RESULT_LIST
    BAPI_PTMGRATTABS_MNGCHANGE
    BAPI_PTMGRATTABS_MNGCREATION
    BAPI_PTMGRATTABS_MNGDELETE
    BAPI_PAYACCDOC_DISPLAY_AWKEY
    PTMGREXTTIMESPEC_DISPLAY
    BAPI_PTMGREXTTIMESPEC_GETSTATU
    BAPI_PTMGREXTATTABS_CHECK
    BAPI_PTMGREXTATTABS_CHECKCOLLI
    BAPI_PTMGREXTATTABS_CHECKQUOTA
    BAPI_PTMGREXTATTABS_CHECKWACT
    BAPI_PTMGREXTATTABS_CHECKWCOST
    BAPI_PTMGREXTATTABS_INSERT
    BAPI_PTMGREXTATTABS_INSERTWACT
    BAPI_PTMGREXTATTABS_INSWCOST
    BAPI_PTMGREXTREMSPEC_CHECK
    BAPI_PTMGREXTREMSPEC_CHECKWACT
    BAPI_PTMGREXTREMSPEC_CHECKWCOS
    BAPI_PTMGREXTREMSPEC_INSERT
    BAPI_PTMGREXTREMSPEC_INSWACT
    BAPI_PTMGREXTREMSPEC_INSWCOST
    BAPI_PTIMEOVERVIEW_DELREPLICA
    BAPI_PTIMEOVERVIEW_GET
    BAPI_PTIMEOVERVIEW_REPLICATE
    BAPI_PTIMEOVERVIEW_SAVEREPLICA
    BAPI_CC1_UPLOAD_TIMEEVENT
    BAPI_CC1_UPLOAD_EXTWAGETYPE
    BAPI_EETIMEVALSPEC_CHECK
    BAPI_EETIMEVALSPEC_CHECKBONUS
    BAPI_EETIMEVALSPEC_CHECKCURR
    BAPI_EETIMEVALSPEC_CHECKPOS
    BAPI_EETIMEVALSPEC_CHECKGRLEV
    BAPI_EETIMEVALSPEC_GETCURR
    BAPI_EETIMEVALSPEC_GETVALGRLEV
    BAPI_QUALIPROF_CHANGE
    BAPI_QUALIDIRECTORY_LIST
    BAPI_QUALIDIRECTORY_LIST_UP
    BAPI_EXTPAYROLL_INSERT_LEGACY
    BAPI_EXTPAYROLL_INSERT_OUT
    BAPI_APPRAISAL_CHANGE
    BAPI_APPRAISAL_CREATE
    BAPI_APPRAISAL_DELETE
    BAPI_APPRAISAL_GETDETAIL
    BAPI_APPRAISAL_GETLIST
    BAPI_APPRAISAL_STATUS_CHANGE
    BAPI_APPRAISEE_GETLIST
    BAPI_APPRAISER_GETLIST
    BAPI_APPRAISAL_MODEL_GETDETAIL
    BAPI_APPRAISAL_MODEL_GETLIST
    BAPI_APPRAISAL_SCALE_GETDETAIL
    BAPI_BASICPAY_APPROVE
    BAPI_BASICPAY_CHANGE
    BAPI_BASICPAY_CREATE
    BAPI_BASICPAY_CREATESUCCESSOR
    BAPI_BASICPAY_DELETE
    BAPI_BASICPAY_GETDETAIL
    BAPI_BASICPAY_GETLIST
    BAPI_BASICPAY_REQUEST
    BAPI_BASICPAY_SIMULATECREATION
    BAPI_DATESPECS_GETDETAILEDLIST
    BAPI_EMPATTABS_GETDETAIL
    BAPI_EMPATTABS_GETLIST
    BAPI_EMPLCOMM_CHANGE
    BAPI_EMPLCOMM_CREATE
    BAPI_EMPLCOMM_CREATESUCCESSOR
    BAPI_EMPLCOMM_DELETE
    BAPI_EMPLCOMM_DELIMIT
    BAPI_EMPLCOMM_GETDETAIL
    BAPI_EMPLCOMM_GETDETAILEDLIST
    BAPI_EMPLCOMM_GETLIST
    BAPI_EMPLOYEET_CHANGEPASSWORD
    BAPI_EMPLOYEET_CHECKPASSWORD
    BAPI_EMPLOYEET_CREATE_PW_REG
    BAPI_EMPLOYEET_DELETE_PW_REG
    BAPI_EMPLOYEET_DEQUEUE
    BAPI_EMPLOYEET_ENQUEUE
    BAPI_EMPLOYEET_GET_PW_REG
    BAPI_EMPLOYEET_INITPASSWORD
    BAPI_FAMILY_APPROVE
    BAPI_FAMILY_CHANGE
    BAPI_FAMILY_CREATE
    BAPI_FAMILY_CREATESUCCESSOR
    BAPI_FAMILY_DELETE
    BAPI_FAMILY_DELIMIT
    BAPI_FAMILY_GETDETAIL
    BAPI_FAMILY_GETDETAILEDLIST
    BAPI_FAMILY_GETLIST
    BAPI_FAMILY_REQUEST
    BAPI_FAMILY_SIMULATECREATION
    BAPI_FAMILY_APPROVE
    BAPI_FAMILYIT_CHANGE
    BAPI_FAMILYIT_CREATE
    BAPI_FAMILYIT_CREATESUCCESSOR
    BAPI_FAMILY_DELETE
    BAPI_FAMILYIT_GETDETAIL
    BAPI_FAMILYIT_GETDETAILEDLIST
    BAPI_FAMILY_GETLIST
    BAPI_FAMILYIT_REQUEST
    BAPI_FAMILYIT_SIMULATECREATION
    BAPI_FAMILY_APPROVE
    BAPI_FAMILYJP_CHANGE
    BAPI_FAMILYJP_CREATE
    BAPI_FAMILYJP_CREATESUCCESSOR
    BAPI_FAMILY_DELETE
    BAPI_FAMILY_DELIMIT
    BAPI_FAMILYJP_GETDETAIL
    BAPI_FAMILYJP_GETDETAILEDLIST
    BAPI_FAMILY_GETLIST
    BAPI_FAMILYJP_REQUEST
    BAPI_FAMILYJP_SIMULATECREATION
    BAPI_FAMILY_APPROVE
    BAPI_FAMILYNL_CHANGE
    BAPI_FAMILYNL_CREATE

  4. SAP BAPI的简单实现步骤

    ABAP中有关BAPI的介绍
    1.BAPI – business application programming interface
    2.它实际上是一种特殊的Remote Function Modules (RFC)是为了提供使用外部程序来进行交易活动
    3.它提供的基于企业目标(Business Object) 技术的接口应用界面
    4.SAP采用了Object-oriented技术,逻辑定义了SAP R/3系统的所有功能目标,并且将所有的目标(Objects) 和BAPIs存储于企业目标库BOR(Business Objects Repository).
    5.SAP R/3 企业目标的目标类型(Object Type) 相当于目标设计语言中类(Class) 的概念,其定义结构由以下几部分组成:基本数据,接口界面,键(Key Fields),方法(Methods),特征(Attributes),事件(Events)

    –如何创建BAPI程序
    1.定义BAPI Structure (Structure不能在BAPI中重复使用,因为一旦BAPI被释放,其Structure被冻结)
    2.创建FUNCTION MODULE
    每个BAPI必须有自己的Function Group,Function Group属性必须为RFC
    3.创建Business Object
    4.使用BAPI WIZARD创建API Method
    这样BAPI可以被外部程序调用
    5.Function Module符合BOR Method
    4.释放BAPI Function Module,
    释放Business Object Type,
    释放BAPI作为BOR的一种Method

    BAPI的简单实现步骤(转)
    一,创建Function Module
    1,在SE11,创建需要的structure
    2,在SE80,建Function group
    3,在SE37,创建Function Module
    Note:一个Function Group只能包含一个BAPI;参数传值;必须有有一个BAPIRETURN类型的EXPORT参数
    二,封装
    1,在SWO1,建Object Type
    2,把Function Module作为一个Method加入,utilities->API Methods->Add Method
    3,release Object和Module。使在BAPI Browser 中可以看到。也就是外部能够调用。
    三,调用
    1,如在另一系统中用ABAP调用,先在SM59中建RFC联到有BAPI的R/3,(ZGOGO)
    在SE38的程序中调用,Call Function “ZBAPIXXXXX” DESTINATION ZGOGO EXPORTING …
    2,如用JAVA调用
    引入包;(不一定要用IBM的)
    import com.sap.rfc.*;
    import com.sap.rfc.exception.*;
    import com.ibm.sap.bapi.*;
    import com.ibm.sap.bapi.generated.*;
    建立连接;调用。。。(See CALL_BAPI.java)

  5. BAPI物料移动 BAPI_GOODSMVT_CREATE

    goodsmvt_header-pstng_date = sy-datum.”凭证中的过帐日期
    goodsmvt_header-doc_date = sy-datum.”凭证中的凭证日期
    goodsmvt_header-pr_uname = sy-uname.”用户名
    code-gm_code = ‘04′.”04:MB1B;
    item-material = w_resb-matnr.
    item-plant = w_resb-werks.
    item-stge_loc = kw_ekpo-lgort.
    item-move_type = ‘541′.
    item-stck_type = ‘ ‘.
    item-entry_qnt = w_resb-menge.
    item-entry_uom = kw_ekpo-meins.
    item-po_number = kw_ekpo-ebeln.
    item-po_item = kw_ekpo-ebelp.
    item-move_plant = kw_ekpo-werks.
    item-vendor = ekko_info-lifnr.
    concatenate kw_ekpo-ebeln kw_ekpo-ebelp
    into item-item_text.”MSEG-SGTXT
    append item.
    call function ‘BAPI_GOODSMVT_CREATE’
    exporting
    goodsmvt_header = goodsmvt_header
    goodsmvt_code = code
    * TESTRUN = ‘ ‘
    * GOODSMVT_REF_EWM =
    importing
    goodsmvt_headret = return_mseg
    tables
    goodsmvt_item = item[]
    * goodsmvt_serialnumber = bapi2017_gm_serialnumber[]
    return = return[]
    * goodsmvt_serv_part_data = aa[]
    * extensionin = bb[]
    * goodsmvt_item_cwm = cc[]

  6. BAPI物料主数据 Material

    ①调用MM02
    CALL FUNCTION ‘BAPI_MATERIAL_EDIT’
    EXPORTING
    MATERIAL = W_MATNR-MATERIAL”物料
    SKIP_1ST_SCREEN = ‘X’ “SKIP FIRST SCREEN?
    IMPORTING
    RETURN = W_MESS.” 消息
    ②REPORT YTEST002 MESSAGE-ID Z01.
    TABLES: MARA,
    MARC,
    MBEW.
    DATA: BEGIN OF RETURNX.
    INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURNX.
    DATA RETURN LIKE RETURNX OCCURS 0 WITH HEADER LINE.
    DATA W_HEAD TYPE BAPIMATHEAD .
    DATA T_MAKT TYPE TABLE OF BAPI_MAKT.
    DATA W_MAKT TYPE BAPI_MAKT.
    DATA W_MARC TYPE BAPI_MARC.
    DATA W_MARCX TYPE BAPI_MARCX.
    DATA W_MARA TYPE BAPI_MARA.
    DATA W_MARAX TYPE BAPI_MARAX.
    CLEAR W_HEAD.
    W_HEAD-MATERIAL = ‘000000000010345190′.”物料号
    W_HEAD-IND_SECTOR = ‘M’.”行业领域
    W_HEAD-MATL_TYPE = ‘Z01′.”物料类型
    W_HEAD-BASIC_VIEW = ‘X’.”基本数据视图
    W_HEAD-SALES_VIEW = ‘X’.”销售试图
    W_HEAD-MRP_VIEW = ‘X’.”mrp视图
    CLEAR W_MAKT.
    W_MAKT-LANGU = ‘1′.”语言代码
    W_MAKT-MATL_DESC = ‘BAPI测试’.”物料描述(短文本)
    APPEND W_MAKT TO T_MAKT.
    CLEAR W_MARA.
    W_MARA-OLD_MAT_NO = ‘000000000010131517′.”旧物料号
    W_MARA-BASE_UOM = ‘EA’.”基本计量单位
    W_MARA-PROD_MEMO = ‘1234′.”生产/检验备忘录
    W_MARA-DSN_OFFICE = ‘Y’.”实验室/办公室
    *W_MARA-STD_DESCR = ‘BAPI_TEST’.”行业标准描述
    W_MARA-DIVISION = ‘20′.”产品组
    CLEAR W_MARAX.
    W_MARAX-OLD_MAT_NO = ‘X’.
    W_MARAX-BASE_UOM = ‘X’.
    *W_MARAX-PROD_MEMO = ‘X’.
    W_MARAX-DSN_OFFICE = ‘X’.
    W_MARAX-DIVISION = ‘X’.
    CLEAR W_MARC.
    W_MARC-PLANT = ‘1101′. “工厂
    W_MARC-AVAILCHECK = ‘02′.”可用性检查的检查组
    W_MARC-MRP_TYPE = ‘PD’.”MRP类型
    W_MARC-MRP_CTRLER = ‘104′.”MRP控制者
    W_MARC-SM_KEY = ‘000′.”计划边际码
    W_MARC-LOTSIZEKEY = ‘Z2′.”MRP批量大小
    W_MARC-DEP_REQ_ID = ‘2′.
    CLEAR W_MARCX.
    W_MARCX-PLANT = ‘1101′.
    W_MARCX-AVAILCHECK = ‘X’.
    W_MARCX-MRP_TYPE = ‘X’.
    W_MARCX-MRP_CTRLER = ‘X’.
    W_MARCX-SM_KEY = ‘X’.
    W_MARCX-LOTSIZEKEY = ‘X’.
    W_MARCX-DEP_REQ_ID = ‘X’.
    CALL FUNCTION ‘BAPI_MATERIAL_SAVEDATA’
    EXPORTING
    HEADDATA = W_HEAD
    CLIENTDATA = W_MARA
    CLIENTDATAX = W_MARAX
    PLANTDATA = W_MARC
    PLANTDATAX = W_MARCX
    IMPORTING
    RETURN = RETURN
    TABLES
    MATERIALDESCRIPTION = T_MAKT
    EXCEPTIONS
    OTHERS = 1.
    CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’.
    WRITE:/
    RETURN-MESSAGE.
    WRITE:/ ‘ok….’.

  7. BAPI创建销售订单 sales order

    ①SD_SALESDOCUMENT_CREATE
    举例:创建销售订单
    business_object = ‘BUS2032′
    report roderick.
    data l_vbeln type vbak-vbeln.
    data t_bapiret2 type table of bapiret2 with header line.
    data w_head type bapisdhd1.
    data w_headx type bapisdhd1x.
    data w_sender type bdi_logsys .
    data t_item type table of bapisditm with header line .
    data t_itemx type table of bapisditmx with header line .
    data t_parnr type table of bapiparnr with header line .
    data t_schdl type table of bapischdl with header line.
    data t_schdlx type table of bapischdlx with header line.
    data ls_posnr type vbap-posnr value ‘10′.
    *w_sender-logsys = ‘DEVCLNT300′.
    w_head-doc_type = ‘ZOR1′.
    w_head-sales_org = ‘C100′.
    w_head-distr_chan = ‘20′.
    w_head-division = ‘10′.
    w_headx-doc_type = ‘X’.
    w_headx-sales_org = ‘X’.
    w_headx-distr_chan = ‘X’.
    w_headx-division = ‘X’.
    w_headx-updateflag = ‘I’.
    t_item-itm_number = ls_posnr.
    t_item-material = ‘000000000000000002′.
    t_item-target_qty = 4.
    append t_item.
    t_itemx-itm_number = ls_posnr.
    t_itemx-material = ‘X’.
    t_itemx-target_qty = ‘X’.
    append t_itemx.
    t_parnr-partn_role = ‘AG’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_parnr-partn_role = ‘RE’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_parnr-partn_role = ‘RG’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_parnr-partn_role = ‘WE’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_schdl-itm_number = ls_posnr.
    t_schdl-sched_line = ‘1′.
    t_schdl-req_date = ‘20110902′.
    t_schdl-req_qty = 1.
    append t_schdl.
    t_schdl-itm_number = ls_posnr.
    t_schdl-sched_line = ‘2′.
    t_schdl-req_date = ‘20110907′.
    t_schdl-req_qty = 3.
    append t_schdl.
    t_schdlx-itm_number = ls_posnr.
    t_schdlx-sched_line = ‘1′.
    t_schdlx-req_date = ‘X’.
    t_schdlx-req_qty = ‘X’.
    t_schdlx-updateflag = ‘I’.
    append t_schdlx.
    t_schdlx-itm_number = ls_posnr.
    t_schdlx-sched_line = ‘2′.
    t_schdlx-req_date = ‘X’.
    t_schdlx-req_qty = ‘X’.
    t_schdlx-updateflag = ‘I’.
    append t_schdlx.
    break-point.
    call function ‘SD_SALESDOCUMENT_CREATE’
    exporting
    sales_header_in = w_head
    sales_header_inx = w_headx
    sender = w_sender
    business_object = ‘BUS2032′
    tables
    return = t_bapiret2
    sales_items_in = t_item
    sales_items_inx = t_itemx
    sales_partners = t_parnr
    sales_schedules_in = t_schdl
    sales_schedules_inx = t_schdlx.
    break-point.
    *
    commit work and wait
    ②’BAPI_SALESORDER_CREATEFROMDAT2′
    report roderick.
    data l_vbeln type vbak-vbeln.
    data t_bapiret2 type table of bapiret2 with header line.
    data w_head type bapisdhd1.
    data w_headx type bapisdhd1x.
    data w_sender type bdi_logsys .
    data t_item type table of bapisditm with header line .
    data t_itemx type table of bapisditmx with header line .
    data t_parnr type table of bapiparnr with header line .
    data t_schdl type table of bapischdl with header line.
    data t_schdlx type table of bapischdlx with header line.
    data ls_posnr type vbap-posnr value ‘10′.
    *w_sender-logsys = ‘DEVCLNT300′.
    w_head-doc_type = ‘ZOR1′.
    w_head-sales_org = ‘C100′.
    w_head-distr_chan = ‘20′.
    w_head-division = ‘10′.
    w_headx-doc_type = ‘X’.
    w_headx-sales_org = ‘X’.
    w_headx-distr_chan = ‘X’.
    w_headx-division = ‘X’.
    w_headx-updateflag = ‘I’.
    t_item-itm_number = ls_posnr.
    t_item-material = ‘000000000000000002′.
    t_item-target_qty = 4.
    append t_item.
    t_itemx-itm_number = ls_posnr.
    t_itemx-material = ‘X’.
    t_itemx-target_qty = ‘X’.
    append t_itemx.
    t_parnr-partn_role = ‘AG’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_parnr-partn_role = ‘RE’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_parnr-partn_role = ‘RG’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_parnr-partn_role = ‘WE’.
    t_parnr-partn_numb = ‘0000100001′.
    append t_parnr.
    t_schdl-itm_number = ls_posnr.
    t_schdl-sched_line = ‘1′.
    t_schdl-req_date = ‘20110902′.
    t_schdl-req_qty = 1.
    append t_schdl.
    t_schdl-itm_number = ls_posnr.
    t_schdl-sched_line = ‘2′.
    t_schdl-req_date = ‘20110907′.
    t_schdl-req_qty = 3.
    append t_schdl.
    t_schdlx-itm_number = ls_posnr.
    t_schdlx-sched_line = ‘1′.
    t_schdlx-req_date = ‘X’.
    t_schdlx-req_qty = ‘X’.
    t_schdlx-updateflag = ‘I’.
    append t_schdlx.
    t_schdlx-itm_number = ls_posnr.
    t_schdlx-sched_line = ‘2′.
    t_schdlx-req_date = ‘X’.
    t_schdlx-req_qty = ‘X’.
    t_schdlx-updateflag = ‘I’.
    append t_schdlx.
    break-point.
    call function ‘BAPI_SALESORDER_CREATEFROMDAT2′
    exporting
    * salesdocumentin = wa_vbeln-vbeln
    order_header_in = w_head
    order_header_inx = w_headx
    importing
    salesdocument = l_vbeln
    tables
    return = t_bapiret2
    order_partners = t_parnr
    order_schedules_in = t_schdl
    order_schedules_inx = t_schdlx
    order_items_in = t_item
    order_items_inx = t_itemx .
    break-point.
    commit work and wait.

  8. BAPI外向交货单相关 DN

    ①”BAPI_OUTB_DELIVERY_CHANGE
    “修改外向交货单的 行数量
    report roderick.
    data ls_lips type lips.
    data ls_marm type marm.
    select single * from lips into ls_lips where vbeln = ‘0080000014′ and posnr = ‘900002′.
    select single * from marm into ls_marm where matnr = ls_lips-matnr.
    data l_bapiobdlvhdrchg type bapiobdlvhdrchg.
    data l_bapiobdlvhdrctrlchg type bapiobdlvhdrctrlchg.
    data lt_bapiret2 type table of bapiret2 with header line.
    data:lt_bapiobdlvitemchg type table of bapiobdlvitemchg with header line.
    data lt_bapiobdlvitemctrlchg type table of bapiobdlvitemctrlchg with header line .
    l_bapiobdlvhdrctrlchg-deliv_numb = ls_lips-vbeln.
    l_bapiobdlvhdrchg-deliv_numb = ls_lips-vbeln.
    lt_bapiobdlvitemchg-deliv_numb = ls_lips-vbeln.
    lt_bapiobdlvitemchg-deliv_item = ls_lips-posnr.
    lt_bapiobdlvitemchg-material = ls_lips-matnr.
    lt_bapiobdlvitemchg-dlv_qty = 2.
    lt_bapiobdlvitemchg-hieraritem = ls_lips-uecha.”父项行号。可修改“批次”的行数量。
    *lt_bapiobdlvitemchg-dlv_qty_imunit = 6.
    lt_bapiobdlvitemchg-fact_unit_nom = ls_marm-umrez.
    lt_bapiobdlvitemchg-fact_unit_denom = ls_marm-umren.
    append lt_bapiobdlvitemchg.
    lt_bapiobdlvitemctrlchg-deliv_numb = ls_lips-vbeln.
    lt_bapiobdlvitemctrlchg-deliv_item = ls_lips-posnr.
    lt_bapiobdlvitemctrlchg-chg_delqty = ‘X’.
    append lt_bapiobdlvitemctrlchg.
    break-point.
    call function ‘BAPI_OUTB_DELIVERY_CHANGE’
    exporting
    header_data = l_bapiobdlvhdrchg
    header_control = l_bapiobdlvhdrctrlchg
    delivery = ls_lips-vbeln
    tables
    item_data = lt_bapiobdlvitemchg
    item_control = lt_bapiobdlvitemctrlchg
    return = lt_bapiret2[].
    if lt_bapiret2[] is initial.
    commit work and wait.
    endif.
    ②”vl09
    report roderick.
    data w_head type likp.
    select single * into w_head from likp where vbeln = ‘0080000022′.
    data: t_mesg like table of mesg.
    break-point.
    call function ‘WS_REVERSE_GOODS_ISSUE’
    exporting
    i_vbeln = w_head-vbeln
    i_budat = w_head-wadat_ist
    i_tcode = ‘VL09′
    i_vbtyp = w_head-vbtyp
    tables
    t_mesg = t_mesg
    exceptions
    error_reverse_goods_issue = 1
    others = 2.
    if sy-subrc = 0.
    commit work and wait.
    endif
    ③”VL02N-good issue
    report roderick.
    data: i_vbkok like vbkok,
    i_vbpok_tab like vbpok occurs 0 with header line,
    i_prott like prott occurs 0 with header line.
    data: begin of wa_error,
    anyerr type xfeld,
    itmdel type xfeld,
    podupd type xfeld,
    interf type xfeld,
    goodsi type xfeld,
    finalc type xfeld,
    end of wa_error.
    i_vbkok-vbeln_vl = ‘0080000022′. “Delivery number
    i_vbkok-wabuc = ‘X’. “Automatic PGI
    i_vbkok-wadat_ist = sy-datum.
    * i_vbkok-komue = ‘X’.
    break-point.
    call function ‘WS_DELIVERY_UPDATE’
    exporting
    vbkok_wa = i_vbkok
    commit = ‘X’
    delivery = ‘0080000022′
    update_picking = ‘X’
    if_database_update = ‘1′
    if_error_messages_send_0 = ‘X’
    importing
    ef_error_any_0 = wa_error-anyerr
    ef_error_in_item_deletion_0 = wa_error-itmdel
    ef_error_in_pod_update_0 = wa_error-podupd
    ef_error_in_interface_0 = wa_error-interf
    ef_error_in_goods_issue_0 = wa_error-goodsi
    ef_error_in_final_check_0 = wa_error-finalc
    tables
    vbpok_tab = i_vbpok_tab
    prot = i_prott
    exceptions
    error_message = 1
    others = 2.
    if wa_error is initial.
    call function ‘BAPI_TRANSACTION_COMMIT’.
    endif

  9. BAPI财务凭证相关 FI Document

    ①BAPI_ACC_DOCUMENT_CHECK财务凭证过账前检查
    CALL FUNCTION ‘BAPI_ACC_DOCUMENT_CHECK’
    EXPORTING
    DOCUMENTHEADER = HEADER_KJ
    * CUSTOMERCPD =
    * CONTRACTHEADER =
    TABLES
    ACCOUNTGL = ITEM_KJ
    ACCOUNTRECEIVABLE = CUS_KJ
    ACCOUNTPAYABLE = REC_KJ
    * ACCOUNTTAX =
    CURRENCYAMOUNT = CUR_KJ
    * CRITERIA = RKEG_KJ
    * VALUEFIELD =
    * EXTENSION1 =
    RETURN = RESULT_KJ
    * PAYMENTCARD =
    * CONTRACTITEM =
    EXTENSION2 = EXTENSION2
    * REALESTATE =
    * ACCOUNTWT =
    .
    ②BAPI_ACC_DOCUMENT_POST财务过账
    CALL FUNCTION ‘BAPI_ACC_DOCUMENT_POST’
    EXPORTING
    DOCUMENTHEADER = HEADER_KJ
    IMPORTING
    OBJ_KEY = LC_KEY
    TABLES
    ACCOUNTGL = ITEM_KJ
    ACCOUNTRECEIVABLE = CUS_KJ
    ACCOUNTPAYABLE = REC_KJ
    CURRENCYAMOUNT = CUR_KJ
    * CRITERIA = RKEG_KJ
    EXTENSION2 = EXTENSION2
    RETURN = RESULT_KJ.
    ③BAPI_ACC_DOCUMENT_REV_CHECK会计凭证冲销前检查
    REPORT RODERICK.
    TABLES: BKPF.
    DATA P_BUKRS TYPE BUKRS VALUE ‘9900′.
    DATA P_BELNR TYPE BSEG-BELNR VALUE ‘0100000335′.
    DATA P_GJAHR TYPE BSEG-GJAHR VALUE ‘2011′.
    DATA P_BUDAT TYPE BKPF-BUDAT VALUE ‘20110126′.
    DATA:P_AWKEY TYPE AWKEY.
    DATA P_SUBRC TYPE SY-SUBRC.
    DATA: W_BELNR TYPE BELNR_D,
    W_REVERSAL TYPE BAPIACREV,
    WT_RETURN TYPE STANDARD TABLE OF BAPIRET2,
    WA_RETURN TYPE BAPIRET2.
    CLEAR P_SUBRC.
    SELECT SINGLE * FROM BKPF
    WHERE BUKRS EQ P_BUKRS AND BELNR EQ P_BELNR
    AND GJAHR EQ P_GJAHR.
    *
    CHECK BKPF-BLART = ‘SA’.
    SY-UNAME = BKPF-USNAM.
    * CONCATENATE W_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY.
    W_REVERSAL-OBJ_TYPE = BKPF-AWTYP.
    CONCATENATE P_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY_R.
    W_REVERSAL-OBJ_KEY = W_REVERSAL-OBJ_KEY_R.
    W_REVERSAL-OBJ_KEY = ‘$’.
    CALL FUNCTION ‘OWN_LOGICAL_SYSTEM_GET’
    IMPORTING
    OWN_LOGICAL_SYSTEM = W_REVERSAL-OBJ_SYS
    EXCEPTIONS
    OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1
    OTHERS = 2.
    W_REVERSAL-REASON_REV = ‘01′.
    W_REVERSAL-PSTNG_DATE = P_BUDAT.
    CALL FUNCTION ‘BAPI_ACC_DOCUMENT_REV_CHECK’
    EXPORTING
    REVERSAL = W_REVERSAL
    BUS_ACT = ‘RFBU’
    TABLES
    RETURN = WT_RETURN.
    .
    BREAK-POINT.
    LOOP AT WT_RETURN INTO WA_RETURN WHERE TYPE CA ‘EA’.
    P_SUBRC = 4.
    EXIT.
    ENDLOOP.
    ④BAPI_ACC_DOCUMENT_REV_POST会计凭证冲销
    REPORT RODERICK.
    TABLES: BKPF.
    DATA P_BUKRS TYPE BUKRS VALUE ‘9900′.
    DATA P_BELNR TYPE BSEG-BELNR VALUE ‘0100000335′.
    DATA P_GJAHR TYPE BSEG-GJAHR VALUE ‘2011′.
    DATA P_BUDAT TYPE BKPF-BUDAT VALUE ‘20110126′.
    DATA:P_AWKEY TYPE AWKEY.
    DATA P_SUBRC TYPE SY-SUBRC.
    DATA: W_BELNR TYPE BELNR_D,
    W_REVERSAL TYPE BAPIACREV,
    WT_RETURN TYPE STANDARD TABLE OF BAPIRET2,
    WA_RETURN TYPE BAPIRET2.
    CLEAR P_SUBRC.
    SELECT SINGLE * FROM BKPF
    WHERE BUKRS EQ P_BUKRS AND BELNR EQ P_BELNR
    AND GJAHR EQ P_GJAHR.
    *
    CHECK BKPF-BLART = ‘SA’.
    SY-UNAME = BKPF-USNAM.
    * CONCATENATE W_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY.
    W_REVERSAL-OBJ_TYPE = BKPF-AWTYP.
    CONCATENATE P_BELNR P_BUKRS P_GJAHR INTO W_REVERSAL-OBJ_KEY_R.
    W_REVERSAL-OBJ_KEY = W_REVERSAL-OBJ_KEY_R.
    W_REVERSAL-OBJ_KEY = ‘$’.
    CALL FUNCTION ‘OWN_LOGICAL_SYSTEM_GET’
    IMPORTING
    OWN_LOGICAL_SYSTEM = W_REVERSAL-OBJ_SYS
    EXCEPTIONS
    OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1
    OTHERS = 2.
    W_REVERSAL-REASON_REV = ‘01′.
    W_REVERSAL-PSTNG_DATE = P_BUDAT.
    CALL FUNCTION ‘BAPI_ACC_DOCUMENT_REV_POST’
    EXPORTING
    REVERSAL = W_REVERSAL
    BUS_ACT = ‘RFBU’
    IMPORTING
    * OBJ_TYPE =
    OBJ_KEY = P_AWKEY
    * OBJ_SYS =
    TABLES
    RETURN = WT_RETURN.
    LOOP AT WT_RETURN INTO WA_RETURN WHERE TYPE CA ‘EA’.
    P_SUBRC = 4.
    EXIT.
    ENDLOOP.
    ⑤BAPI_ACC_GL_POSTING_POST财务过账
    REPORT RODERICK.
    DATA: DOCUMENTHEADER LIKE BAPIACHE08,
    ACCOUNTGL LIKE BAPIACGL08 OCCURS 0 WITH HEADER LINE,
    CURRENCYAMOUNT LIKE BAPIACCR08 OCCURS 0 WITH HEADER LINE,
    RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
    RETURN_ALL TYPE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: W_DMBTR TYPE BAPIWRBTR.
    DATA: OBJ_TYPE LIKE BAPIACHE02-OBJ_TYPE,
    OBJ_KEY LIKE BAPIACHE02-OBJ_KEY,
    OBJ_SYS LIKE BAPIACHE02-OBJ_SYS.
    DATA P_SUBRC TYPE SY-SUBRC.
    DOCUMENTHEADER-USERNAME = SY-UNAME.
    DOCUMENTHEADER-HEADER_TXT = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’.
    DOCUMENTHEADER-COMP_CODE = ‘9900′.
    DOCUMENTHEADER-DOC_DATE = ‘20110126′.
    DOCUMENTHEADER-PSTNG_DATE = ‘20110126′.
    DOCUMENTHEADER-DOC_TYPE = ‘SA’.
    ACCOUNTGL-ITEMNO_ACC = 1.
    ACCOUNTGL-GL_ACCOUNT = ‘1516139900′.
    ACCOUNTGL-NETWORK = SPACE.”科目分配的网络号
    ACCOUNTGL-ITEM_TEXT = ‘01行’.
    ACCOUNTGL-ALLOC_NMBR = SPACE.”WBS 要素
    ACCOUNTGL-PROFIT_CTR = ‘L990003001′.
    *ACCOUNTGL-RSTGR = ‘B05′.
    APPEND ACCOUNTGL.
    CURRENCYAMOUNT-ITEMNO_ACC = 1.
    CURRENCYAMOUNT-CURRENCY = ‘RMB’.
    CURRENCYAMOUNT-AMT_DOCCUR = 10.
    APPEND CURRENCYAMOUNT.
    ACCOUNTGL-ITEMNO_ACC = 2.
    *ACCOUNTGL-GL_ACCOUNT = ‘1511010100′.
    ACCOUNTGL-NETWORK = SPACE.”科目分配的网络号
    ACCOUNTGL-VENDOR_NO = ‘1200000010′.
    ACCOUNTGL-ITEM_TEXT = ‘01行’.
    ACCOUNTGL-ALLOC_NMBR = SPACE.”WBS 要素
    ACCOUNTGL-PROFIT_CTR = ‘L990003001′.
    *ACCOUNTGL-RSTGR = ‘B05′.
    APPEND ACCOUNTGL.
    CURRENCYAMOUNT-ITEMNO_ACC = 2.
    CURRENCYAMOUNT-CURRENCY = ‘RMB’.
    CURRENCYAMOUNT-AMT_DOCCUR = 0 – 10.
    APPEND CURRENCYAMOUNT.
    CHECK ACCOUNTGL[] IS NOT INITIAL.
    CHECK CURRENCYAMOUNT[] IS NOT INITIAL.
    CALL FUNCTION ‘BAPI_ACC_GL_POSTING_POST’
    EXPORTING
    DOCUMENTHEADER = DOCUMENTHEADER
    IMPORTING
    OBJ_TYPE = OBJ_TYPE
    OBJ_KEY = OBJ_KEY
    OBJ_SYS = OBJ_SYS
    TABLES
    ACCOUNTGL = ACCOUNTGL
    CURRENCYAMOUNT = CURRENCYAMOUNT
    RETURN = RETURN.
    LOOP AT RETURN WHERE TYPE CA ‘EA’.
    EXIT.
    ENDLOOP.

  10. BAPI 和 RFC 的区别

    RFC:是se37写出来的其中可以远程调用的叫rfc,remote-enabled function,abap语法和输入输出参数就会有一些限制。
    BAPI:是sap做好的实现待定业务操作的rfc。
    RFC:是面向过程的,调用简单直接;
    BAPI:是面向对象的,有属性,方法,有事件。更加的复杂和丰富,更能反映sap业务的应用,bapi方法的构造是基于rfc的,所以可以说bapi集成了rfc。
    RFC:一种函数,用于外部程序调用
    BAPI:一种函数,用于主要业务流程处理
    一个BAPI函数往往能是一个RFC函数(我不知道是不是所有BAPI都可以有基于RFC技术来调用,
    但是至少也可以说大部分吧,java里面用BAPI,就是因为这个BAPI函数具有RFC的特性)

发表评论

电子邮件地址不会被公开。