REPORT ZLYTEST001. "BAPI_BILLINGDOC_CREATEMULTIPLE 交货单开票 DATA:GT_VBRK TYPE TABLE OF BAPIVBRK, GW_VBRK LIKE LINE OF GT_VBRK, GT_RETURN TYPE TABLE OF BAPIRET1, GW_RETURN LIKE LINE OF GT_RETURN, GT_SUCCESS TYPE TABLE OF BAPIVBRKSUCCESS, GW_SUCCESS LIKE LINE OF GT_SUCCESS. GW_VBRK-SALESORG = '1000'."销售组织 GW_VBRK-DISTR_CHAN = '10'."分销渠道 GW_VBRK-DIVISION = '10'."产品组 GW_VBRK-DOC_TYPE = 'ZOR'."销售凭证类型 GW_VBRK-ORDBILLTYP = 'ZF2'."与订单有关的出具发票凭证的建议出具发票类型 GW_VBRK-BILL_DATE = '20161008'."出具发票索引和打印的出具发票日期 GW_VBRK-SOLD_TO = '0000100521'."售达方 GW_VBRK-ITEM_CATEG = 'ZTAN'."销售凭证项目类别 GW_VBRK-PRICE_DATE = '20161008'."定价日期和汇率 GW_VBRK-PLANT = '1020'."工厂 GW_VBRK-BILL_TO = '0000100521'."收取发票方 GW_VBRK-PAYER = '0000100521'."付款方 GW_VBRK-SHIP_TO = '0000100521'."送达方 GW_VBRK-REF_DOC = '0080009971'."参考单据的单据编号 GW_VBRK-REF_ITEM = '000010'."参考项目的项目号 GW_VBRK-DOC_NUMBER = '0080009971'."销售凭证 GW_VBRK-ITM_NUMBER = '000010'."销售凭证项目 GW_VBRK-MATERIAL = '000000000044007359'."物料号 GW_VBRK-SALES_UNIT = 'PC'."销售单位 GW_VBRK-REQ_QTY = 388800."以销售单位表示的累计订单数量 GW_VBRK-PAYMENT_TERMS = 'D000'."付款条1 GW_VBRK-INCOTERMS1 = 'ZZZ'."国际贸易条款 (部分1) GW_VBRK-INCOTERMS2 = '国内交货'."国际贸易条件(部分2) GW_VBRK-REF_DOC_CA = 'J'."销售凭证类型 APPEND GW_VBRK TO GT_VBRK. CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE' * EXPORTING * CREATORDATAIN = * TESTRUN = * POSTING = TABLES BILLINGDATAIN = GT_VBRK * CONDITIONDATAIN = * CCARDDATAIN = * TEXTDATAIN = * ERRORS = RETURN = GT_RETURN SUCCESS = GT_SUCCESS. IF GT_SUCCESS[] IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. LOOP AT GT_RETURN INTO GW_RETURN. WRITE : / GW_RETURN-TYPE,GW_RETURN-MESSAGE. ENDLOOP. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING WAIT = 'X'. LOOP AT GT_SUCCESS INTO GW_SUCCESS. WRITE : / GW_SUCCESS-BILL_DOC,GW_SUCCESS-BILL_DOC_ITEM. ENDLOOP. ENDIF.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/18699.html