IF P_ZY EQ 'X'."直营订单 调拨单 PERFORM FRM_INIT_PO_HEADER. PERFORM FRM_INIT_PO_ITEM. PERFORM FRM_INIT_PO_SCHLINE. PERFORM FRM_INIT_PO_TEXTS. PERFORM FRM_CREATE_PO USING P_COMMIT. ELSEIF P_JM EQ 'X'."加盟订单 销售订单 PERFORM FRM_INIT_SALESORDER_HEADER . PERFORM FRM_INIT_SALESORDER_ITEMS . PERFORM FRM_INIT_SALESORDER_PARTNER . PERFORM FRM_INIT_SALESORDER_TEXTS . PERFORM FRM_CREATE_SALESORDER USING P_COMMIT. ENDIF.
FORM FRM_INIT_PO_HEADER. DATA: LV_VENDOR TYPE LIFNR, LV_DATE TYPE DATUM. CLEAR: GS_POHEADER, GS_POHEADERX. LV_DATE = IT_HEADER-ZDATE. IF LV_DATE IS INITIAL. LV_DATE = P_DATE. ENDIF. PERFORM FRM_CONVERT_VENDOR USING '1001' CHANGING LV_VENDOR. GS_POHEADER-VENDOR = LV_VENDOR. GS_POHEADER-SUPPL_PLNT = '1001'. GS_POHEADER-DOC_TYPE = GS_ORG-AUART. GS_POHEADER-DOC_DATE = LV_DATE. "Document Date GS_POHEADER-CREAT_DATE = SY-DATUM. GS_POHEADER-CREATED_BY = SY-UNAME. GS_POHEADER-PURCH_ORG = GS_ORG-EKORG. GS_POHEADER-PUR_GROUP = GS_ORG-EKGRP. GS_POHEADER-COMP_CODE = GS_ORG-BUKRS. GS_POHEADER-SALES_PERS = IT_HEADER-ZPOSN."Salesperson GS_POHEADER-TELEPHONE = IT_HEADER-ZLXDH."Vendor's Telephone GS_POHEADERX-DOC_TYPE = 'X'. GS_POHEADERX-DOC_DATE = 'X'. GS_POHEADERX-CREAT_DATE = 'X'. GS_POHEADERX-CREATED_BY = 'X'. GS_POHEADERX-VENDOR = 'X'. GS_POHEADERX-PURCH_ORG = 'X'. GS_POHEADERX-PUR_GROUP = 'X'. GS_POHEADERX-COMP_CODE = 'X'. GS_POHEADERX-SALES_PERS = 'X'. GS_POHEADERX-TELEPHONE = 'X'. GS_POHEADERX-SUPPL_PLNT = 'X'. ENDFORM. " FRM_INIT_PO_HEADER
FORM FRM_INIT_PO_ITEM. DATA : LV_LGORT TYPE VBAP-LGORT, LV_WERKS TYPE VBAP-WERKS, LV_MATNR TYPE VBAP-MATNR, LV_BWTTY TYPE MBEW-BWTTY, LV_MEINS TYPE MARA-MEINS, LV_QTY TYPE EKPO-MENGE, LV_CHARG TYPE MCHA-CHARG. CLEAR: GS_POITEM, GT_POITEM, GS_POITEMX, GT_POITEMX. SHIFT IT_HEADER-ZKUBM LEFT DELETING LEADING '0'. LV_WERKS = IT_HEADER-ZKUBM. LOOP AT IT_ITEM WHERE ZPOSN EQ IT_HEADER-ZPOSN. * 转换物料号码 PERFORM FRM_CONVERT_ARTICLE USING IT_ITEM-ZSPKH CHANGING LV_MATNR. * 是否启用分割评估 SELECT SINGLE BWTTY INTO LV_BWTTY FROM MBEW WHERE MATNR = LV_MATNR AND BWKEY = LV_WERKS. * 基本单位 SELECT SINGLE MEINS INTO LV_MEINS FROM MARA WHERE MATNR = LV_MATNR. IF LV_MEINS = 'G'."基本单位为G, 下单数量取总金重 LV_QTY = IT_ITEM-ZZJZ. ELSE."否则取总件数 LV_QTY = IT_ITEM-ZSPJH. ENDIF. IF LV_QTY IS INITIAL. LV_QTY = 1. ENDIF. LV_CHARG = IT_ITEM-CHARG. * 物料启用了分割凭证但是没有评估类型(批次),则使用物料编码作为评估类型 IF LV_BWTTY = 'X' AND LV_CHARG IS INITIAL. PERFORM FRM_CONVERT_VALUE_TYPE USING LV_MATNR CHANGING LV_CHARG. ENDIF. * 检查物料 门店 批次是否存在 PERFORM FRM_CHECK_BATCH USING LV_WERKS LV_MATNR LV_CHARG. CLEAR GS_POITEM. GS_POITEM-PO_ITEM = IT_ITEM-ZITEM. GS_POITEM-MATERIAL = LV_MATNR. GS_POITEM-PLANT = LV_WERKS. GS_POITEM-BATCH = IT_ITEM-CHARG."批次 GS_POITEM-SUPPL_STLOC = '1001'. GS_POITEM-QUANTITY = LV_QTY. IF LV_BWTTY = 'X'." GS_POITEM-VAL_TYPE = LV_CHARG."评估类型 ENDIF. IF GS_ORG-AUART = 'ZSTJ'."Consigment GS_POITEM-ITEM_CAT = 'K'. ELSE. GS_POITEM-ITEM_CAT = 'U'. ENDIF. APPEND GS_POITEM TO GT_POITEM. CLEAR GS_POITEMX. GS_POITEMX-PO_ITEM = IT_ITEM-ZITEM. GS_POITEMX-MATERIAL = 'X'. GS_POITEMX-BATCH = 'X'. GS_POITEMX-VAL_TYPE = 'X'. GS_POITEMX-STGE_LOC = 'X'. GS_POITEMX-PLANT = 'X'. GS_POITEMX-QUANTITY = 'X'. GS_POITEMX-ITEM_CAT = 'X'. APPEND GS_POITEMX TO GT_POITEMX. ENDLOOP. ENDFORM. " FRM_INIT_PO_ITEM
FORM FRM_INIT_PO_SCHLINE . REFRESH: GT_POSCHEDULE, GT_POSCHEDULEX. * CLEAR gs_poschedule. * gs_poschedule-po_item = p_item_no. * gs_poschedule-sched_line = 1. * gs_poschedule-delivery_date = lv_del_date. * APPEND gs_poschedule TO gt_poschedule. * * CLEAR gs_poschedulex. * gs_poschedulex-po_item = p_item_no. * gs_poschedulex-sched_line = 1. * gs_poschedulex-delivery_date = 'X'. * APPEND gs_poschedulex TO gt_poschedulex. ENDFORM. " FRM_INIT_PO_SCHLINE
FORM FRM_INIT_PO_TEXTS. REFRESH: GT_POTEXTHEADER, GT_POTEXTITEM. CLEAR: GS_POTEXTITEM, GS_POTEXTITEM. * Header Text * 抬头文本 CLEAR GS_POTEXTHEADER. GS_POTEXTHEADER-TEXT_ID = 'F01'. GS_POTEXTHEADER-TEXT_LINE = IT_HEADER-ZHTEXT."订单抬头文本 APPEND GS_POTEXTHEADER TO GT_POTEXTHEADER. * Item Text * 行项目文本 LOOP AT IT_ITEM WHERE ZPOSN EQ IT_HEADER-ZPOSN. CLEAR GS_POTEXTITEM. GS_POTEXTITEM-PO_ITEM = IT_ITEM-ZITEM. GS_POTEXTITEM-TEXT_ID = 'F01'. GS_POTEXTITEM-TEXT_LINE = IT_ITEM-ZITEXT."订单行项目文本 APPEND GS_POTEXTITEM TO GT_POTEXTITEM. ENDLOOP. ENDFORM. " FRM_INIT_PO_TEXTS
FORM FRM_CREATE_PO USING P_COMMIT. DATA : LV_TESTRUN TYPE BAPIFLAG-BAPIFLAG, LV_ERROR. IF P_COMMIT IS INITIAL. LV_TESTRUN = 'X'. ENDIF. CALL FUNCTION 'BAPI_PO_CREATE1' EXPORTING POHEADER = GS_POHEADER POHEADERX = GS_POHEADERX TESTRUN = LV_TESTRUN IMPORTING EXPPURCHASEORDER = GV_EXPPURCHASEORDER TABLES RETURN = GT_RETURN POITEM = GT_POITEM POITEMX = GT_POITEMX POSCHEDULE = GT_POSCHEDULE POSCHEDULEX = GT_POSCHEDULEX POTEXTHEADER = GT_POTEXTHEADER POTEXTITEM = GT_POTEXTITEM. LOOP AT GT_RETURN INTO GS_RETURN. CLEAR IT_MSG. MOVE-CORRESPONDING GS_RETURN TO IT_MSG. IT_MSG-ZPOSN = IT_HEADER-ZPOSN. IT_MSG-ORDER = GV_EXPPURCHASEORDER. CASE GS_RETURN-TYPE. WHEN 'E' OR 'X' OR 'A'. IF GS_RETURN-ID = 'MEPO' AND GS_RETURN-NUMBER = '000'. CONTINUE. ELSE. IT_MSG-LIGHT = '1'."Red Light ENDIF. LV_ERROR = 'X'. WHEN 'S'. IT_MSG-LIGHT = '3'."Green Light WHEN OTHERS. CONTINUE. ENDCASE. COLLECT IT_MSG. ENDLOOP. IF LV_ERROR EQ 'X'. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ELSE. CHECK P_COMMIT EQ 'X'. PERFORM FRM_RECORD_LINES USING IT_HEADER-ZPOSN GV_EXPPURCHASEORDER. * CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' * EXPORTING * WAIT = 'X'. ENDIF. ENDFORM. " FRM_CREATE_PO
FORM FRM_INIT_SALESORDER_HEADER. DATA : LV_DATE TYPE DATUM. CLEAR GS_SALESORDER_HEADER. LV_DATE = IT_HEADER-ZDATE. IF LV_DATE IS INITIAL. LV_DATE = P_DATE. ENDIF. * Mandatory entries: GS_SALESORDER_HEADER-DOC_TYPE = GS_ORG-AUART. "Sales document type GS_SALESORDER_HEADER-SALES_ORG = GS_ORG-VKORG. "Sales organization GS_SALESORDER_HEADER-DISTR_CHAN = GS_ORG-VTWEG. "Distribution channel GS_SALESORDER_HEADER-DIVISION = GS_ORG-SPART. " Division * Optional entries: GS_SALESORDER_HEADER-DOC_DATE = LV_DATE. "Document date GS_SALESORDER_HEADER-PURCH_NO_C = IT_HEADER-ZPOSN. "Customer PO No. (POS订单号码) GS_SALESORDER_HEADER-ORD_REASON = IT_HEADER-ZPLX. "Order reason. GS_SALESORDER_HEADER-TELEPHONE = IT_HEADER-ZLXDH. "Telephone Number. (联系电话) GS_SALESORDER_HEADER-NAME = IT_HEADER-ZLSR. "Name of order. (联系人) * Change index GS_SALESORDER_HEADERX-UPDATEFLAG = 'I'. "Sales document type GS_SALESORDER_HEADERX-DOC_TYPE = 'X'. "Sales document type GS_SALESORDER_HEADERX-SALES_ORG = 'X'. "Sales organization GS_SALESORDER_HEADERX-DISTR_CHAN = 'X'. "Distribution channel GS_SALESORDER_HEADERX-DIVISION = 'X'. " Division GS_SALESORDER_HEADERX-DOC_DATE = 'X'. "Document date (订单日期) GS_SALESORDER_HEADERX-PURCH_NO_C = 'X'. "Customer PO No. (POS订单号码) GS_SALESORDER_HEADERX-ORD_REASON = 'X'. "Order reason. (订单类型) GS_SALESORDER_HEADERX-TELEPHONE = 'X'. "Telephone Number. (联系电话) GS_SALESORDER_HEADERX-NAME = 'X'. "Name of order. (联系人) * GS_SALESORDER_HEADERX-DOC_DATE = 'X'. "Name of order. (联系人) CLEAR GS_LOGIC_SWITCH. * GS_LOGIC_SWITCH-COND_HANDL = 'X'. GS_LOGIC_SWITCH-PRICING = 'G'. ENDFORM. " FRM_INIT_SALESORDER_HEADER
FORM FRM_INIT_SALESORDER_ITEMS. DATA : LV_MATNR TYPE MARA-MATNR, LV_BWTTY TYPE MBEW-BWTTY, LV_MEINS TYPE MARA-MEINS, LV_CHARG TYPE MCH1-CHARG, LV_WERKS TYPE MARC-WERKS, LV_MENGE TYPE EKPO-MENGE. DATA : LV_ZPR5 TYPE P DECIMALS 2. REFRESH: GT_SALESORDER_ITEMX, GT_SALESORDER_ITEM, GT_SALESORDER_CONDITIONS, GT_SALESORDER_CONDITIONX, GT_SALESORDER_SCHLINE, GT_SALESORDER_SCHLINEX, GT_SALESORDER_TEXT. LV_WERKS = IT_HEADER-WERKS. LOOP AT IT_ITEM WHERE ZPOSN EQ IT_HEADER-ZPOSN. *** 行项目 * Convert Article no. (商品款号) PERFORM FRM_CONVERT_ARTICLE USING IT_ITEM-ZSPKH CHANGING LV_MATNR. * 评估类别 SELECT SINGLE BWTTY INTO LV_BWTTY FROM MBEW WHERE MATNR = LV_MATNR AND BWKEY = LV_WERKS. * 基本单位 SELECT SINGLE MEINS INTO LV_MEINS FROM MARA WHERE MATNR = LV_MATNR. IF LV_MEINS = 'G'. LV_MENGE = IT_ITEM-ZZJZ. ELSE. LV_MENGE = IT_ITEM-ZSPJH."Target quantity in sales units ENDIF. * Batch LV_CHARG = IT_ITEM-CHARG. * 检查批次、物料是否存在 PERFORM FRM_CHECK_BATCH USING LV_WERKS LV_MATNR LV_CHARG. CLEAR GS_SALESORDER_ITEM. GS_SALESORDER_ITEM-ITM_NUMBER = IT_ITEM-ZITEM." GS_SALESORDER_ITEM-MATERIAL = LV_MATNR." GS_SALESORDER_ITEM-BATCH = IT_ITEM-CHARG." GS_SALESORDER_ITEM-PLANT = LV_WERKS. " GS_SALESORDER_ITEM-TARGET_QTY = LV_MENGE."Target quantity in sales units IF LV_BWTTY EQ 'X'. GS_SALESORDER_ITEM-VAL_TYPE = LV_CHARG." ”Valution Type ENDIF. APPEND GS_SALESORDER_ITEM TO GT_SALESORDER_ITEM. CLEAR GS_SALESORDER_ITEMX. GS_SALESORDER_ITEMX-UPDATEFLAG = 'I'. GS_SALESORDER_ITEMX-ITM_NUMBER = IT_ITEM-ZITEM. GS_SALESORDER_ITEMX-MATERIAL = 'X'. GS_SALESORDER_ITEMX-BATCH = 'X'. GS_SALESORDER_ITEMX-VAL_TYPE = 'X'. GS_SALESORDER_ITEMX-PLANT = 'X'. GS_SALESORDER_ITEMX-TARGET_QTY = 'X'. APPEND GS_SALESORDER_ITEMX TO GT_SALESORDER_ITEMX. *** 计划行 CLEAR GS_SALESORDER_SCHLINE. GS_SALESORDER_SCHLINE-ITM_NUMBER = IT_ITEM-ZITEM. GS_SALESORDER_SCHLINE-SCHED_LINE = '0001'. GS_SALESORDER_SCHLINE-REQ_QTY = LV_MENGE. APPEND GS_SALESORDER_SCHLINE TO GT_SALESORDER_SCHLINE. CLEAR GS_SALESORDER_SCHLINEX. GS_SALESORDER_SCHLINEX-ITM_NUMBER = IT_ITEM-ZITEM. GS_SALESORDER_SCHLINEX-SCHED_LINE = '0001'. GS_SALESORDER_SCHLINEX-UPDATEFLAG = 'I'. GS_SALESORDER_SCHLINEX-REQ_QTY = 'X'. APPEND GS_SALESORDER_SCHLINEX TO GT_SALESORDER_SCHLINEX. *** 条件 * 估算价(金单价) CLEAR GS_SALESORDER_CONDITIONS. GS_SALESORDER_CONDITIONS-ITM_NUMBER = IT_ITEM-ZITEM. GS_SALESORDER_CONDITIONS-COND_TYPE = 'ZPR4'. GS_SALESORDER_CONDITIONS-COND_VALUE = IT_ITEM-ZJDJ. GS_SALESORDER_CONDITIONS-CURRENCY = 'CNY'. APPEND GS_SALESORDER_CONDITIONS TO GT_SALESORDER_CONDITIONS. CLEAR GS_SALESORDER_CONDITIONX. GS_SALESORDER_CONDITIONX-ITM_NUMBER = IT_ITEM-ZITEM. GS_SALESORDER_CONDITIONX-COND_TYPE = 'ZPR4'. GS_SALESORDER_CONDITIONX-UPDATEFLAG = 'I'. GS_SALESORDER_CONDITIONX-COND_VALUE = 'X'. GS_SALESORDER_CONDITIONX-CURRENCY = 'X'. APPEND GS_SALESORDER_CONDITIONX TO GT_SALESORDER_CONDITIONX. *** 行项目文本 CLEAR GS_SALESORDER_TEXT. GS_SALESORDER_TEXT-ITM_NUMBER = IT_ITEM-ZITEM." GS_SALESORDER_TEXT-TEXT_ID = '0001'."Object VBBP GS_SALESORDER_TEXT-TEXT_LINE = IT_ITEM-ZITEXT."(订单抬头文本) GS_SALESORDER_TEXT-LANGU = SY-LANGU. APPEND GS_SALESORDER_TEXT TO GT_SALESORDER_TEXT. ENDLOOP. * 合计金额 CLEAR GS_SALESORDER_CONDITIONS. GS_SALESORDER_CONDITIONS-COND_TYPE = 'ZPR0'. GS_SALESORDER_CONDITIONS-COND_ST_NO = 001. GS_SALESORDER_CONDITIONS-COND_COUNT = 01. GS_SALESORDER_CONDITIONS-COND_VALUE = IT_HEADER-ZHJJE. GS_SALESORDER_CONDITIONS-CURRENCY = 'CNY'. APPEND GS_SALESORDER_CONDITIONS TO GT_SALESORDER_CONDITIONS. CLEAR GS_SALESORDER_CONDITIONX. GS_SALESORDER_CONDITIONX-COND_TYPE = 'ZPR0'. GS_SALESORDER_CONDITIONX-COND_ST_NO = 001. GS_SALESORDER_CONDITIONX-COND_COUNT = 01. GS_SALESORDER_CONDITIONX-UPDATEFLAG = 'I'. GS_SALESORDER_CONDITIONX-COND_VALUE = 'X'. GS_SALESORDER_CONDITIONX-CURRENCY = 'X'. APPEND GS_SALESORDER_CONDITIONX TO GT_SALESORDER_CONDITIONX. * 订单订金 IF IT_HEADER-ZDDLX IS NOT INITIAL. LV_ZPR5 = IT_HEADER-ZDDLX. CLEAR GS_SALESORDER_CONDITIONS. GS_SALESORDER_CONDITIONS-COND_TYPE = 'ZPR5'. GS_SALESORDER_CONDITIONS-COND_ST_NO = 002. GS_SALESORDER_CONDITIONS-COND_COUNT = 02. GS_SALESORDER_CONDITIONS-COND_VALUE = LV_ZPR5. GS_SALESORDER_CONDITIONS-CURRENCY = 'CNY'. APPEND GS_SALESORDER_CONDITIONS TO GT_SALESORDER_CONDITIONS. CLEAR GS_SALESORDER_CONDITIONX. GS_SALESORDER_CONDITIONX-COND_TYPE = 'ZPR5'. GS_SALESORDER_CONDITIONX-COND_ST_NO = 002. GS_SALESORDER_CONDITIONX-COND_COUNT = 02. GS_SALESORDER_CONDITIONX-UPDATEFLAG = 'I'. GS_SALESORDER_CONDITIONX-COND_VALUE = 'X'. GS_SALESORDER_CONDITIONX-CURRENCY = 'X'. APPEND GS_SALESORDER_CONDITIONX TO GT_SALESORDER_CONDITIONX. ENDIF. ENDFORM. " FRM_INIT_SALESORDER_ITEMS
FORM FRM_INIT_SALESORDER_PARTNER. DATA : LV_KUNNR TYPE VBPA-KUNNR."Customer CLEAR: GT_SALESORDER_PARTNER. * Convert customer no. to internal no.(客户编码) CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = IT_HEADER-ZKUBM IMPORTING OUTPUT = LV_KUNNR. * WE Ship to , AG Sold to CLEAR GS_SALESORDER_PARTNER. * gs_salesorder_partner-itm_number = '10'." GS_SALESORDER_PARTNER-PARTN_ROLE = 'WE'."SP GS_SALESORDER_PARTNER-PARTN_NUMB = LV_KUNNR. "(客户编码) * gs_salesorder_partner-name = u_header-zkhmc. "Name (客户名称) APPEND GS_SALESORDER_PARTNER TO GT_SALESORDER_PARTNER. * CLEAR gs_salesorder_partner. ** gs_salesorder_partner-itm_number = '10'." * gs_salesorder_partner-partn_role = 'AG'."SH * gs_salesorder_partner-partn_numb = '0000040001'."SHip to * APPEND gs_salesorder_partner TO gt_salesorder_partner. ENDFORM. " FRM_INIT_SALESORDER_PARTNER
FORM FRM_INIT_SALESORDER_TEXTS. * CLEAR : GS_SALESORDER_TEXT, * GT_SALESORDER_TEXT. * Header Texts CLEAR GS_SALESORDER_TEXT. GS_SALESORDER_TEXT-TEXT_ID = '0001'."Object VBBK GS_SALESORDER_TEXT-TEXT_LINE = IT_HEADER-ZHTEXT."(订单抬头文本) GS_SALESORDER_TEXT-LANGU = SY-LANGU." APPEND GS_SALESORDER_TEXT TO GT_SALESORDER_TEXT. ** Item Texts * LOOP AT T_ITEMS INTO IT_ITEM. * CLEAR GS_SALESORDER_TEXT. * GS_SALESORDER_TEXT-ITM_NUMBER = IT_ITEM-ZITEM." * GS_SALESORDER_TEXT-TEXT_ID = '0001'."Object VBBP * GS_SALESORDER_TEXT-TEXT_LINE = IT_ITEM-ZITEXT."(订单抬头文本) * GS_SALESORDER_TEXT-LANGU = SY-LANGU. * APPEND GS_SALESORDER_TEXT TO GT_SALESORDER_TEXT. * ENDLOOP. ENDFORM. " FRM_INIT_SALESORDER_TEXTS
FORM FRM_CREATE_SALESORDER USING P_COMMIT. DATA : LV_SALESORDER TYPE BAPIVBELN-VBELN, LV_TESTRUN TYPE BAPIFLAG-BAPIFLAG, LV_ERROR. IF P_COMMIT IS INITIAL. LV_TESTRUN = 'X'. ENDIF. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING ORDER_HEADER_IN = GS_SALESORDER_HEADER ORDER_HEADER_INX = GS_SALESORDER_HEADERX LOGIC_SWITCH = GS_LOGIC_SWITCH TESTRUN = LV_TESTRUN IMPORTING SALESDOCUMENT = LV_SALESORDER TABLES RETURN = GT_RETURN ORDER_ITEMS_IN = GT_SALESORDER_ITEM ORDER_ITEMS_INX = GT_SALESORDER_ITEMX ORDER_PARTNERS = GT_SALESORDER_PARTNER ORDER_SCHEDULES_IN = GT_SALESORDER_SCHLINE ORDER_SCHEDULES_INX = GT_SALESORDER_SCHLINEX ORDER_CONDITIONS_IN = GT_SALESORDER_CONDITIONS ORDER_CONDITIONS_INX = GT_SALESORDER_CONDITIONX ORDER_TEXT = GT_SALESORDER_TEXT. LOOP AT GT_RETURN INTO GS_RETURN. CLEAR IT_MSG. MOVE-CORRESPONDING GS_RETURN TO IT_MSG. IT_MSG-ZPOSN = IT_HEADER-ZPOSN. IT_MSG-ORDER = LV_SALESORDER. CASE GS_RETURN-TYPE. WHEN 'E' OR 'X' OR 'A'. IT_MSG-LIGHT = '1'."Red Light LV_ERROR = 'X'. WHEN 'S'. IF GS_RETURN-ID = 'V1' AND GS_RETURN-NUMBER = '311'. IT_MSG-LIGHT = '3'."Green Light ELSE. CONTINUE. ENDIF. WHEN OTHERS. CONTINUE. ENDCASE. COLLECT IT_MSG. * EXIT. ENDLOOP. IF LV_ERROR EQ 'X'. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ELSE. CHECK P_COMMIT EQ 'X'. PERFORM FRM_RECORD_LINES USING IT_HEADER-ZPOSN LV_SALESORDER. * CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' * EXPORTING * WAIT = 'X'. ENDIF. ENDFORM. " FRM_CREATE_SALESORDER
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18700.html