采购合同新增接口
FUNCTION?ZMM_CONTRACT_CREATE
.
*"----------------------------------------------------------------------
*"*"本地接口:
*"??IMPORTING
*"?????VALUE(I_HEAD)?TYPE??ZVS_EKKO
*"?????VALUE(BAPIFUN)?TYPE??CHAR1
*"?????VALUE(TESTRUN)?TYPE??CHAR1?OPTIONAL
*"?????VALUE(NOAPPLLOG)?TYPE??CHAR1?OPTIONAL
*"??EXPORTING
*"?????VALUE(E_SUCC)?TYPE??CHAR1
*"?????VALUE(E_EBELN)?TYPE??EBELN
*"?????VALUE(E_MESSAGE)?TYPE??GTER_TEXT
*"??TABLES
*"??????I_ITEM?STRUCTURE??ZVS_EKPO
*"??????ET_RETURN?STRUCTURE??BAPIE1RET2?OPTIONAL
*"----------------------------------------------------------------------
?? REFRESH?ET_RETURN .
?? CLEAR? :GS_CTRD_LOG .
?? MOVE-CORRESPONDING?I_HEAD? TO?GS_CTRD_LOG .
??GS_CTRD_LOG -TESTRUN? =?TESTRUN .
??GS_CTRD_LOG -BAPIFUN? =?BAPIFUN .
?? DATA : HEADER????????????? LIKE??BAPIMEOUTHEADER ,
???????HEADERX???????????? LIKE??BAPIMEOUTHEADERX ,
???????TECHNICAL_DATA????? LIKE?BAPIMEOUTTECH ,
???????LV_EBELN??????????? TYPE?BAPIMEOUTHEADER - NUMBER ,
???????LT_RETURN?????????? LIKE? TABLE? OF?BAPIRET2? WITH? HEADER? LINE ,
???????LT_ITEM???????????? LIKE? TABLE? OF??BAPIMEOUTITEM? WITH? HEADER? LINE ,
???????LT_ITEMX??????????? LIKE? TABLE? OF?BAPIMEOUTITEMX? WITH? HEADER? LINE ,
???????LT_ITEM_CONDITION?? LIKE? TABLE? OF?BAPIMEOUTCONDITION? WITH? HEADER? LINE ,
???????LT_ITEM_CONDITIONX?? LIKE? TABLE? OF??BAPIMEOUTCONDITIONX? WITH? HEADER? LINE ,
???????LT_VALID??????????? LIKE? TABLE? OF?BAPIMEOUTVALIDITY? WITH? HEADER? LINE ,
???????LT_VALIDX?????????? LIKE? TABLE? OF?BAPIMEOUTVALIDITYX? WITH? HEADER? LINE ,
???????LT_EXTENSIONIN?????? LIKE? TABLE? OF?BAPIPAREX? WITH? HEADER? LINE ,
???????LT_EXTENSIONOUT???? LIKE? TABLE? OF?BAPIPAREX? WITH? HEADER? LINE ,
???????LT_PARTNER????????? LIKE?? TABLE? OF?BAPIMEOUTPARTNER? WITH? HEADER? LINE ,
???????LT_PARTNERX???????? LIKE?? TABLE? OF?BAPIMEOUTPARTNERX? WITH? HEADER? LINE ,
???????LT_ITEM_TEXT???????? LIKE? TABLE? OF?BAPIMEOUTITEMTEXT? WITH? HEADER? LINE ,
???????LT_HEADER_TEXT?????? LIKE? TABLE? OF?BAPIMEOUTTEXT? WITH? HEADER? LINE ,
???????LS_HEADEXIN???????? TYPE?BAPI_TE_MEOUTHEADER .
?? DATA :LT_WYT3? LIKE? TABLE? OF?WYT3? WITH? HEADER? LINE .
?? DATA? :?LW_GCJZNQ? TYPE?ZMM_GCJZNQ .
?? IF?I_HEAD -WAERS? =? '' .
???? SELECT? SINGLE?WAERS? FROM?LFM1? INTO?I_HEAD -WAERS? WHERE?LIFNR? =?I_HEAD -LIFNR? AND?EKORG? =?I_HEAD -EKORG .
?? ENDIF .
?? CALL? FUNCTION? 'CONVERSION_EXIT_ALPHA_INPUT'
???? EXPORTING
?????? INPUT?? =?I_HEAD -LIFNR
???? IMPORTING
?????? OUTPUT? =?I_HEAD -LIFNR .
?? IF?I_HEAD -ZZEVRT? IS? NOT? INITIAL .
???? CALL? FUNCTION? 'CONVERSION_EXIT_ALPHA_INPUT'
?????? EXPORTING
???????? INPUT?? =?I_HEAD -ZZEVRT
?????? IMPORTING
???????? OUTPUT? =?I_HEAD -ZZEVRT .
?? ENDIF .
?? HEADER - NUMBER? =?I_HEAD -EBELN .
?? HEADER -COMP_CODE? =?I_HEAD -BUKRS .
??HEADERX -COMP_CODE? =? 'X' .
?? HEADER -DOC_TYPE? =?I_HEAD -EVART .
??HEADERX -DOC_TYPE? =? 'X' .
?? HEADER -CREAT_DATE? =?SY -DATUM .
??HEADERX -CREAT_DATE? =? 'X' .
?? HEADER -CREATED_BY? =?SY -UNAME .
??HEADERX -CREATED_BY? =? 'X' .
?? HEADER -VENDOR? =?I_HEAD -LIFNR .
??HEADERX -VENDOR? =? 'X' .
?? HEADER -ITEM_INTVL? =? 1 .
??HEADERX -ITEM_INTVL? =? 'X' .
?? HEADER -SUBITEMINT? =? '1' .
??HEADERX -SUBITEMINT? =? 'X' .
?? HEADER -PURCH_ORG? =?I_HEAD -EKORG .
??HEADERX -PURCH_ORG? =? 'X' .
?? HEADER -PUR_GROUP? =?I_HEAD -EKGRP .
??HEADERX -PUR_GROUP? =? 'X' .
?? HEADER - CURRENCY? =?I_HEAD -WAERS .
??HEADERX - CURRENCY? =? 'X' .
?? HEADER -DOC_DATE? =?I_HEAD -VEDAT .
??HEADERX -DOC_DATE? =? 'X' .
?? HEADER -VPER_START? =?I_HEAD -KDATB .
??HEADERX -VPER_START? =? 'X' .
?? HEADER -VPER_END? =?I_HEAD -KDATE .
??HEADERX -VPER_END? =? 'X' .
?? IF?I_HEAD -TXT_K01?<>? '' .
????LT_HEADER_TEXT -TEXT_FORM? =? '*' .
????LT_HEADER_TEXT -TEXT_ID? =??? 'K01' .
????LT_HEADER_TEXT -TEXT_LINE? =?I_HEAD -TXT_K01 .
???? APPEND?LT_HEADER_TEXT .
???? CLEAR?LT_HEADER_TEXT .
?? ENDIF .
*采購客服?ZZCGKH
?? REFRESH?LT_WYT3[] .
?? SELECT?*? FROM?WYT3
???? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C1'
???????? AND?PERNR? =?I_HEAD -ZZCGKH .
?? IF?LT_WYT3[]? IS? INITIAL .
*????CONCATENATE?E_MESSAGE?'該采購客服不存在于采購組織中,請聯系IT修改!'?INTO?E_MESSAGE.
?? ENDIF .
?? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??LT_PARTNER -PARTN_ROLE? =? 'C1' .
??LT_PARTNERX -PARTN_ROLE? =? 'C1' .
??LT_PARTNER -LANGU? =? '1' .
??LT_PARTNERX -LANGU? =? 'X' .
??LT_PARTNER -PARTNR? =?I_HEAD -ZZCGKH .
??LT_PARTNERX -PARTNR? =? 'X' .
?? APPEND?LT_PARTNER .
?? APPEND?LT_PARTNERX .
?? REFRESH?LT_WYT3[] .
?? SELECT?*? FROM?WYT3
???? INTO? TABLE?LT_WYT3
???? WHERE?LIFNR? =?I_HEAD -LIFNR
?????? AND?EKORG? =?I_HEAD -EKORG
?????? AND?PARVW? =? 'C1' .
?? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZCGKH .
???? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????LT_PARTNER -PARTN_ROLE? =? 'C1' .
????LT_PARTNERX -PARTN_ROLE? =? 'C1' .
????LT_PARTNER -LANGU? =? '1' .
????LT_PARTNERX -LANGU? =? 'X' .
????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
????LT_PARTNERX -PARTNR? =? 'X' .
????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
????LT_PARTNERX -DELETE_IND? =? 'X' .
???? APPEND?LT_PARTNER .
???? APPEND?LT_PARTNERX .
?? ENDLOOP .
*采購協助?ZZCGXZ
?? IF?I_HEAD -ZZCGXZ? IS? NOT? INITIAL .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
???????? WHERE?LIFNR? =?I_HEAD -LIFNR
?????????? AND?EKORG? =?I_HEAD -EKORG
?????????? AND?PARVW? =? 'C2'
?????????? AND?PERNR? =?I_HEAD -ZZCGXZ .
???? IF?LT_WYT3[]? IS? INITIAL .
*??????CONCATENATE?E_MESSAGE?'該采購協助不存在于采購組織中,請聯系IT修改!'?INTO?E_MESSAGE.
???? ENDIF .
???? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????LT_PARTNER -PARTN_ROLE? =? 'C2' .
????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
????LT_PARTNER -LANGU? =? '1' .
????LT_PARTNERX -LANGU? =? 'X' .
????LT_PARTNER -PARTNR? =?I_HEAD -ZZCGXZ .
????LT_PARTNERX -PARTNR? =? 'X' .
???? APPEND?LT_PARTNER .
???? APPEND?LT_PARTNERX .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C2' .
???? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZCGXZ .
?????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??????LT_PARTNER -PARTN_ROLE? =? 'C2' .
??????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
??????LT_PARTNER -LANGU? =? '1' .
??????LT_PARTNERX -LANGU? =? 'X' .
??????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
??????LT_PARTNERX -PARTNR? =? 'X' .
??????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
??????LT_PARTNERX -DELETE_IND? =? 'X' .
?????? APPEND?LT_PARTNER .
?????? APPEND?LT_PARTNERX .
???? ENDLOOP .
?? ELSE .
???? "如果采購協助為空,就去取主數據,校驗一個與采購客服相同的人員,刪除其他
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C2'
???????? AND?PERNR? =?I_HEAD -ZZCGKH .
???? IF?SY -SUBRC? =? 0? .
?????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??????LT_PARTNER -PARTN_ROLE? =? 'C2' .
??????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
??????LT_PARTNER -LANGU? =? '1' .
??????LT_PARTNERX -LANGU? =? 'X' .
??????LT_PARTNER -PARTNR? =?I_HEAD -ZZCGKH .
??????LT_PARTNERX -PARTNR? =? 'X' .
?????? APPEND?LT_PARTNER .
?????? APPEND?LT_PARTNERX .
?????? REFRESH?LT_WYT3[] .
?????? SELECT?*? FROM?WYT3
???????? INTO? TABLE?LT_WYT3
???????? WHERE?LIFNR? =?I_HEAD -LIFNR
?????????? AND?EKORG? =?I_HEAD -EKORG
?????????? AND?PARVW? =? 'C2' .
?????? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZCGKH .
???????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????????LT_PARTNER -PARTN_ROLE? =? 'C2' .
????????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
????????LT_PARTNER -LANGU? =? '1' .
????????LT_PARTNERX -LANGU? =? 'X' .
????????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
????????LT_PARTNERX -PARTNR? =? 'X' .
????????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
????????LT_PARTNERX -DELETE_IND? =? 'X' .
???????? APPEND?LT_PARTNER .
???????? APPEND?LT_PARTNERX .
?????? ENDLOOP .
???? ELSE .
?????? "要是沒有和采購客服相同的人員的話,不取
???? ENDIF .
?? ENDIF .
*采購駐廠?ZZZCRY
?? IF?I_HEAD -ZZZCRY? IS? NOT? INITIAL .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
???????? WHERE?LIFNR? =?I_HEAD -LIFNR
?????????? AND?EKORG? =?I_HEAD -EKORG
?????????? AND?PARVW? =? 'C3'
?????????? AND?PERNR? =?I_HEAD -ZZZCRY .
???? IF?LT_WYT3[]? IS? INITIAL .
*??????CONCATENATE?E_MESSAGE?'該駐廠人員不存在于采購組織中,請聯系IT修改!'?INTO?E_MESSAGE.
???? ENDIF .
???? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????LT_PARTNER -PARTN_ROLE? =? 'C3' .
????LT_PARTNERX -PARTN_ROLE? =? 'C3' .
????LT_PARTNER -LANGU? =? '1' .
????LT_PARTNERX -LANGU? =? 'X' .
????LT_PARTNER -PARTNR? =?I_HEAD -ZZZCRY .
????LT_PARTNERX -PARTNR? =? 'X' .
???? APPEND?LT_PARTNER .
???? APPEND?LT_PARTNERX .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C3' .
???? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZZCRY .
?????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??????LT_PARTNER -PARTN_ROLE? =? 'C3' .
??????LT_PARTNERX -PARTN_ROLE? =? 'C3' .
??????LT_PARTNER -LANGU? =? '1' .
??????LT_PARTNERX -LANGU? =? 'X' .
??????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
??????LT_PARTNERX -PARTNR? =? 'X' .
??????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
??????LT_PARTNERX -DELETE_IND? =? 'X' .
?????? APPEND?LT_PARTNER .
?????? APPEND?LT_PARTNERX .
???? ENDLOOP .
?? ELSE .
???? "因為駐廠只會有一個人,要是為空的話,那就不用考慮別的了,直接抓取主數據中的
?? ENDIF .
?? DATA :LV_SERIAL_ID? TYPE?N?LENGTH? 10 ,
???????LV_KOPOS????? TYPE?KOPOS .
?? DATA :L_ITNO? TYPE?EBELP .
?? LOOP? AT?I_ITEM .
???? IF?I_ITEM -MATNR? IS? NOT? INITIAL .
?????? CALL? FUNCTION? 'CONVERSION_EXIT_MATN1_INPUT'
???????? EXPORTING
?????????? INPUT???????? =?I_ITEM -MATNR
???????? IMPORTING
?????????? OUTPUT??????? =?I_ITEM -MATNR
???????? EXCEPTIONS
??????????LENGTH_ERROR? =? 1
?????????? OTHERS??????? =? 2 .
???? ENDIF .
????LT_ITEM -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEMX -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEMX -ITEM_NOX? =? 'X' .
????LT_ITEM -SHORT_TEXT? =?I_ITEM -TXZ01 .
????LT_ITEMX -SHORT_TEXT? =? 'X' .
????LT_ITEM -MATERIAL? =?I_ITEM -MATNR .
????LT_ITEMX -MATERIAL? =? 'X' .
????LT_ITEM -PLANT? =?I_ITEM -WERKS .
????LT_ITEMX -PLANT? =? 'X' .
????LT_ITEM -STGE_LOC? =?I_ITEM -LGORT .
????LT_ITEMX -STGE_LOC? =? 'X' .
????LT_ITEM -MATL_GROUP? =?I_ITEM -MATKL .
????LT_ITEMX -MATL_GROUP? =? 'X' .
????LT_ITEM -ITEM_CAT? =?I_ITEM -EPSTP .
????LT_ITEMX -ITEM_CAT? =? 'X' .
????LT_ITEM -TARGET_QTY? =?I_ITEM -KTMNG .
????LT_ITEMX -TARGET_QTY? =? 'X' .
????LT_ITEM -PO_UNIT? =?I_ITEM -MEINS .
????LT_ITEMX -PO_UNIT? =? 'X' .
????LT_ITEM -NET_PRICE? =?I_ITEM -NETPR .
????LT_ITEMX -NET_PRICE? =? 'X' .
????LT_ITEM -PRICE_UNIT? =? 1 .
????LT_ITEMX -PRICE_UNIT? =? 'X' .
????LT_ITEM -INFO_UPD? =? '' .
????LT_ITEMX -INFO_UPD? =? 'X' .
???? APPEND?LT_ITEM .
???? CLEAR?LT_ITEM .
???? APPEND?LT_ITEMX .
???? CLEAR?LT_ITEMX .
???? IF?I_ITEM -TXT_K01?<>? '' .
??????LT_ITEM_TEXT -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_TEXT -TEXT_FORM? =? '*' .
??????LT_ITEM_TEXT -TEXT_ID? =??? 'K01' .
??????LT_ITEM_TEXT -TEXT_LINE? =?I_ITEM -TXT_K01 .
?????? APPEND?LT_ITEM_TEXT .
?????? CLEAR?LT_ITEM_TEXT .
???? ENDIF .
????LV_SERIAL_ID? =?LV_SERIAL_ID?+? 1 .
????LV_KOPOS? =? 1 .
????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
????LT_ITEM_CONDITION -COND_TYPE? =? 'PB00' .
????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -NETPR .
????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
???? APPEND?LT_ITEM_CONDITION .
???? APPEND?LT_ITEM_CONDITIONX .
???? CLEAR?LT_ITEM_CONDITIONX .
???? CLEAR?LT_ITEM_CONDITION .
????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
????LT_VALID -VALID_FROM? =?SY -DATUM . "I_HEAD-KDATB.
????LT_VALID -VALID_TO? =? '99991231' .
???? APPEND?LT_VALID .
????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
????LT_VALIDX -SERIAL_IDX? =? 'X' .
????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
????LT_VALIDX -VALID_FROM? =? 'X' .
????LT_VALIDX -VALID_TO? =? 'X' .
???? APPEND?LT_VALIDX .
???? IF?I_ITEM -ZYF?<>? 0 . "ZMB1??運費??ZYFDD
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZMB1' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZYFDD?/? '1.17' .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM?? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZYF?<>? 0 . "ZRB1??運費(代墊)??ZYF
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZRB1' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZYF .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM?? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZSLDD?<>? 0 . "ZRB2??上力費(代墊)??ZSLDD
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZRB2' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZSLDD .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZSL?<>? 0 . "ZMB2??上力費(一票)??ZSL
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZMB2' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZSL?/? '1.17' .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZQTDD?<>? 0 . "ZRB3??其他(代墊)??ZQTDD
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZRB3' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZQTDD .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZQT?<>? 0 . "ZMB3??其他(一票)??ZQT
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZMB3' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZQT?/? '1.17' .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
?? ENDLOOP .
?? "若月獎勵勾選,則季獎勵和年獎勵同時勾選傳輸
?? IF?I_HEAD -ZZFANL_Y? =? 'X' .
????I_HEAD -ZZFANL_J? =? 'X' .
????I_HEAD -ZZFANL_N? =? 'X' .
?? ENDIF .
*??自定義字段
?? CLEAR?LT_EXTENSIONIN .
??LT_EXTENSIONIN - STRUCTURE? =? 'BAPI_TE_MEOUTHEADER' .
??LT_EXTENSIONIN -VALUEPART1+0 ( 10 )? =?I_HEAD -EBELN .
??LT_EXTENSIONIN -VALUEPART1+10 ( 10 )? =?I_HEAD -ZZEVRT .
??LT_EXTENSIONIN -VALUEPART1+20 ( 5 )? =?I_HEAD -ZZEVRTP .
??LT_EXTENSIONIN -VALUEPART1+25 ( 16 )? =?I_HEAD -ZZMQTY .
??LT_EXTENSIONIN -VALUEPART1+41 ( 3 )? =?I_HEAD -ZZMEINS .
??LT_EXTENSIONIN -VALUEPART1+44 ( 1 )? =?I_HEAD -ZZZHANL .
??LT_EXTENSIONIN -VALUEPART1+45 ( 1 )? =?I_HEAD -ZZBUC .
??LT_EXTENSIONIN -VALUEPART1+46 ( 1 )? =?I_HEAD -ZZFANL .
*??LT_EXTENSIONIN-VALUEPART1+47(8)?=?I_HEAD-ZZCGKH
*??LT_EXTENSIONIN-VALUEPART1+55(8)?=?I_HEAD-ZZCGXZ
*??LT_EXTENSIONIN-VALUEPART1+63(8)?=?I_HEAD-ZZZCRY
*??LT_EXTENSIONIN-VALUEPART1+71(4)?=?I_HEAD-ZZYYBM
*??LT_EXTENSIONIN-VALUEPART1+75(10)?=?I_HEAD-ZZVBELN
??LT_EXTENSIONIN -VALUEPART1+85 ( 1 )? =?I_HEAD -ZZFANL_Y .
??LT_EXTENSIONIN -VALUEPART1+86 ( 1 )? =?I_HEAD -ZZFANL_J .
??LT_EXTENSIONIN -VALUEPART1+87 ( 1 )? =?I_HEAD -ZZFANL_N .
??LT_EXTENSIONIN -VALUEPART1+88 ( 3 )? =?I_HEAD -ZZFKFS .
??LT_EXTENSIONIN -VALUEPART1+91 ( 1 )? =?I_HEAD -ZZJHTQ .
?? APPEND???LT_EXTENSIONIN .
?? CLEAR?LT_EXTENSIONIN .
??LT_EXTENSIONIN - STRUCTURE? =? 'BAPI_TE_MEOUTHEADERX' .
??LT_EXTENSIONIN -VALUEPART1+0 ( 10 )? =?I_HEAD -EBELN .
??LT_EXTENSIONIN -VALUEPART1+10 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+11 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+12 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+13 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+14 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+15 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+16 ( 1 )? =? 'X' .
*??LT_EXTENSIONIN-VALUEPART1+17(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+18(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+19(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+20(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+21(1)?=?'X'.
??LT_EXTENSIONIN -VALUEPART1+22 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+23 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+24 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+25 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+26 ( 1 )? =? 'X' .
?? APPEND???LT_EXTENSIONIN .
*??DATA:?LS_BAPI_TE_MEOUTHEADERX?LIKE?BAPI_TE_MEOUTHEADERX,
*????????LS_BAPI_TE_MEOUTHEADER??LIKE?BAPI_TE_MEOUTHEADER.
*??CLEAR?LT_EXTENSIONIN.
*??LT_EXTENSIONIN-STRUCTURE?=?'BAPI_TE_MEOUTHEADER'.
*??LS_BAPI_TE_MEOUTHEADER-NUMBER?=?I_HEAD-EBELN.
*??LS_BAPI_TE_MEOUTHEADER-ZZEVRT?=?I_HEAD-ZZEVRT.
*??LS_BAPI_TE_MEOUTHEADER-ZZEVRTP?=?I_HEAD-ZZEVRTP.
*??LS_BAPI_TE_MEOUTHEADER-ZZMQTY?=?I_HEAD-ZZMQTY.
*??LS_BAPI_TE_MEOUTHEADER-ZZMEINS?=?I_HEAD-ZZMEINS.
*??LS_BAPI_TE_MEOUTHEADER-ZZZHANL?=?I_HEAD-ZZZHANL.
*??LS_BAPI_TE_MEOUTHEADER-ZZBUC?=?I_HEAD-ZZBUC.
*
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZCGKH?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZCGXZ?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZZCRY?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZYYBM?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZVBELN?=?''.
*
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL_Y?=?I_HEAD-ZZFANL_Y.
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL_J?=?I_HEAD-ZZFANL_J.
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL_N?=?I_HEAD-ZZFANL_N.
*??LS_BAPI_TE_MEOUTHEADER-ZZFKFS?=?I_HEAD-ZZFKFS.
*??LS_BAPI_TE_MEOUTHEADER-ZZJHTQ?=?I_HEAD-ZZJHTQ.
*??LT_EXTENSIONIN+30(960)?=?LS_BAPI_TE_MEOUTHEADER.
**??CALL?METHOD?CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
**????EXPORTING
**??????IM_VALUE???????????????=?LS_BAPI_TE_MEOUTHEADER
**????IMPORTING
**??????EX_CONTAINER???????????=?LT_EXTENSIONIN-VALUEPART1
**????EXCEPTIONS
**??????ILLEGAL_PARAMETER_TYPE?=?1
**??????OTHERS?????????????????=?2.
*??APPEND?LT_EXTENSIONIN.
*
*??CLEAR?LT_EXTENSIONIN.
*??LT_EXTENSIONIN-STRUCTURE?=?'BAPI_TE_MEOUTHEADERX'.
*??LT_EXTENSIONIN+30(960)???=?LS_BAPI_TE_MEOUTHEADERX.
**??LS_BAPI_TE_MEOUTHEADERX-NUMBER?=?I_HEAD-EBELN.
**??LS_BAPI_TE_MEOUTHEADERX-ZZEVRT?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZEVRTP?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZMQTY?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZMEINS?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZZHANL?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZBUC?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFANL_Y?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFANL_J?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFANL_N?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFKFS?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZJHTQ?=?'X'.
**??CALL?METHOD?CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
**????EXPORTING
**??????IM_VALUE???????????????=?LS_BAPI_TE_MEOUTHEADERX
**????IMPORTING
**??????EX_CONTAINER???????????=?LT_EXTENSIONIN-VALUEPART1
**????EXCEPTIONS
**??????ILLEGAL_PARAMETER_TYPE?=?1
**??????OTHERS?????????????????=?2.
*??APPEND?LT_EXTENSIONIN.
?? IF?BAPIFUN? =? 'I' .
????TECHNICAL_DATA -NO_MESSAGING? =? 'X' .
????TECHNICAL_DATA -NO_AUTHORITY_CHECK? =? 'X' .
???? CALL? FUNCTION? 'BAPI_CONTRACT_CREATE'
?????? EXPORTING
???????? HEADER?????????????? =? HEADER
????????HEADERX????????????? =?HEADERX
*???????VENDOR_ADDRESS??????=
????????TESTRUN????????????? =?TESTRUN
????????TECHNICAL_DATA?????? =?TECHNICAL_DATA
?????? IMPORTING
????????PURCHASINGDOCUMENT?? =?E_EBELN
*???????EXP_HEADER??????????=
?????? TABLES
???????? RETURN?????????????? =?LT_RETURN
????????ITEM???????????????? =?LT_ITEM
????????ITEMX??????????????? =?LT_ITEMX
*???????ACCOUNT?????????????=
*???????ACCOUNTPROFITSEGMENT????????=
*???????ACCOUNTX????????????=
*???????DELIVERY_ADDRESS????=
????????ITEM_COND_VALIDITY?? =?LT_VALID
????????ITEM_COND_VALIDITYX? =?LT_VALIDX
????????ITEM_CONDITION?????? =?LT_ITEM_CONDITION
????????ITEM_CONDITIONX????? =?LT_ITEM_CONDITIONX
*???????ITEM_COND_SCALE_VALUE???????=
*???????ITEM_COND_SCALE_QUAN????????=
????????ITEM_TEXT??????????? =?LT_ITEM_TEXT
????????HEADER_TEXT????????? =?LT_HEADER_TEXT
*???????HEAD_COND_VALIDITY??=
*???????HEAD_COND_VALIDITYX?=
*???????HEAD_CONDITION??????=
*???????HEAD_CONDITIONX?????=
*???????HEAD_COND_SCALE_VAL?=
*???????HEAD_COND_SCALE_QUAN????????=
????????PARTNER????????????? =?LT_PARTNER
????????PARTNERX???????????? =?LT_PARTNERX
????????EXTENSIONIN????????? =?LT_EXTENSIONIN
*???????EXTENSIONOUT????????=
?????? .
?? ELSEIF?BAPIFUN? =? 'U' .
????E_EBELN? =?I_HEAD -EBELN .
???? CALL? FUNCTION? 'BAPI_CONTRACT_CHANGE'
?????? EXPORTING
????????PURCHASINGDOCUMENT? =?I_HEAD -EBELN
???????? HEADER????????????? =? HEADER
????????HEADERX???????????? =?HEADERX
*???????VENDOR_ADDRESS?????=
????????TESTRUN???????????? =?TESTRUN
????????TECHNICAL_DATA????? =?TECHNICAL_DATA
*?IMPORTING
*???????EXP_HEADER?????????=
?????? TABLES
????????ITEM??????????????? =?LT_ITEM
????????ITEMX?????????????? =?LT_ITEMX
*???????ACCOUNT????????????=
*???????ACCOUNTPROFITSEGMENT????????=
*???????ACCOUNTX???????????=
*???????DELIVERY_ADDRESS???=
*???????ITEM_COND_VALIDITY?=
*???????ITEM_COND_VALIDITYX?????????=
????????ITEM_CONDITION????? =?LT_ITEM_CONDITION
????????ITEM_CONDITIONX???? =?LT_ITEM_CONDITIONX
*???????ITEM_COND_SCALE_VALUE???????=
*???????ITEM_COND_SCALE_QUAN????????=
*???????ITEM_TEXT??????????=
*???????HEADER_TEXT????????=
*???????HEAD_COND_VALIDITY?=
*???????HEAD_COND_VALIDITYX?????????=
*???????HEAD_CONDITION?????=
*???????HEAD_CONDITIONX????=
*???????HEAD_COND_SCALE_VAL?????????=
*???????HEAD_COND_SCALE_QUAN????????=
*???????PARTNER????????????=
*???????PARTNERX???????????=
*???????RELEASE_DOCU???????=
*???????EXTENSIONIN????????=
*???????EXTENSIONOUT???????=
???????? RETURN????????????? =?LT_RETURN .
?? ENDIF .
?? APPEND? LINES? OF?LT_RETURN? TO?ET_RETURN .
?? LOOP? AT?LT_RETURN? WHERE? TYPE? =? 'E'? OR? TYPE? =? 'A' .
????E_SUCC? =? 'E' .
???? IF?LT_RETURN - ID? =? 'BAPI'? AND?LT_RETURN - NUMBER? =? '001'? AND?LT_RETURN - TYPE? =? 'E' .
?????? "排除此消息
???? ELSE .
?????? CONCATENATE?E_MESSAGE?LT_RETURN - MESSAGE? ';'? INTO?E_MESSAGE .
???? ENDIF .
?? ENDLOOP .
?? IF?SY -SUBRC?<>? 0 .
???? CALL? FUNCTION? 'BAPI_TRANSACTION_COMMIT'
?????? EXPORTING
???????? WAIT? =? 'X' .
????E_SUCC? =? 'S' .
???? IF?TESTRUN? =? '' .
??????GS_CTRD_LOG -EBELN? =?E_EBELN .
?????? CONCATENATE?E_MESSAGE? '采購合同'?E_EBELN? '創建成功!'? INTO?E_MESSAGE .
?????? CLEAR?LW_GCJZNQ .
??????LW_GCJZNQ -EBELN? =?E_EBELN .
??????LW_GCJZNQ -GCJZNQ? =?I_HEAD -GCJZNQ .
??????LW_GCJZNQ -BEIZ? =? '采購合同' .
??????LW_GCJZNQ -ERDAT? =?SY -DATUM .
??????LW_GCJZNQ -ERZET? =?SY -UZEIT .
?????? MODIFY?ZMM_GCJZNQ? FROM?LW_GCJZNQ .
?????? IF?SY -SUBRC? =? 0? .
???????? COMMIT? WORK .
?????? ENDIF .
???? ELSE .
?????? CONCATENATE?E_MESSAGE? '采購合同檢查成功!'? INTO?E_MESSAGE .
???? ENDIF .
?? ELSE .
???? CALL? FUNCTION? 'BAPI_TRANSACTION_ROLLBACK' .
?? ENDIF .
?? CLEAR : HEADER ,HEADERX ,TECHNICAL_DATA ,LT_RETURN ,LT_ITEM ,LT_ITEMX ,LT_VALID ,LT_VALIDX ,LT_ITEM_CONDITION ,LT_ITEM_CONDITIONX ,LT_EXTENSIONIN ,LT_HEADER_TEXT ,LT_ITEM_TEXT .
?? REFRESH :LT_RETURN ,LT_ITEM ,LT_ITEMX ,LT_VALID ,LT_VALIDX ,LT_ITEM_CONDITION ,LT_ITEM_CONDITIONX ,LT_EXTENSIONIN ,LT_HEADER_TEXT ,LT_ITEM_TEXT ,LT_PARTNER ,LT_PARTNERX .
*??寫日志
?? IF?NOAPPLLOG? =? '' .
????GS_CTRD_LOG -E_MESSAGE? =?E_MESSAGE .
????GS_CTRD_LOG -E_SUCC? =?E_SUCC .
???? PERFORM?SAVE_CTRD_LOG? TABLES?I_ITEM .
?? ENDIF .
ENDFUNCTION .
*"----------------------------------------------------------------------
*"*"本地接口:
*"??IMPORTING
*"?????VALUE(I_HEAD)?TYPE??ZVS_EKKO
*"?????VALUE(BAPIFUN)?TYPE??CHAR1
*"?????VALUE(TESTRUN)?TYPE??CHAR1?OPTIONAL
*"?????VALUE(NOAPPLLOG)?TYPE??CHAR1?OPTIONAL
*"??EXPORTING
*"?????VALUE(E_SUCC)?TYPE??CHAR1
*"?????VALUE(E_EBELN)?TYPE??EBELN
*"?????VALUE(E_MESSAGE)?TYPE??GTER_TEXT
*"??TABLES
*"??????I_ITEM?STRUCTURE??ZVS_EKPO
*"??????ET_RETURN?STRUCTURE??BAPIE1RET2?OPTIONAL
*"----------------------------------------------------------------------
?? REFRESH?ET_RETURN .
?? CLEAR? :GS_CTRD_LOG .
?? MOVE-CORRESPONDING?I_HEAD? TO?GS_CTRD_LOG .
??GS_CTRD_LOG -TESTRUN? =?TESTRUN .
??GS_CTRD_LOG -BAPIFUN? =?BAPIFUN .
?? DATA : HEADER????????????? LIKE??BAPIMEOUTHEADER ,
???????HEADERX???????????? LIKE??BAPIMEOUTHEADERX ,
???????TECHNICAL_DATA????? LIKE?BAPIMEOUTTECH ,
???????LV_EBELN??????????? TYPE?BAPIMEOUTHEADER - NUMBER ,
???????LT_RETURN?????????? LIKE? TABLE? OF?BAPIRET2? WITH? HEADER? LINE ,
???????LT_ITEM???????????? LIKE? TABLE? OF??BAPIMEOUTITEM? WITH? HEADER? LINE ,
???????LT_ITEMX??????????? LIKE? TABLE? OF?BAPIMEOUTITEMX? WITH? HEADER? LINE ,
???????LT_ITEM_CONDITION?? LIKE? TABLE? OF?BAPIMEOUTCONDITION? WITH? HEADER? LINE ,
???????LT_ITEM_CONDITIONX?? LIKE? TABLE? OF??BAPIMEOUTCONDITIONX? WITH? HEADER? LINE ,
???????LT_VALID??????????? LIKE? TABLE? OF?BAPIMEOUTVALIDITY? WITH? HEADER? LINE ,
???????LT_VALIDX?????????? LIKE? TABLE? OF?BAPIMEOUTVALIDITYX? WITH? HEADER? LINE ,
???????LT_EXTENSIONIN?????? LIKE? TABLE? OF?BAPIPAREX? WITH? HEADER? LINE ,
???????LT_EXTENSIONOUT???? LIKE? TABLE? OF?BAPIPAREX? WITH? HEADER? LINE ,
???????LT_PARTNER????????? LIKE?? TABLE? OF?BAPIMEOUTPARTNER? WITH? HEADER? LINE ,
???????LT_PARTNERX???????? LIKE?? TABLE? OF?BAPIMEOUTPARTNERX? WITH? HEADER? LINE ,
???????LT_ITEM_TEXT???????? LIKE? TABLE? OF?BAPIMEOUTITEMTEXT? WITH? HEADER? LINE ,
???????LT_HEADER_TEXT?????? LIKE? TABLE? OF?BAPIMEOUTTEXT? WITH? HEADER? LINE ,
???????LS_HEADEXIN???????? TYPE?BAPI_TE_MEOUTHEADER .
?? DATA :LT_WYT3? LIKE? TABLE? OF?WYT3? WITH? HEADER? LINE .
?? DATA? :?LW_GCJZNQ? TYPE?ZMM_GCJZNQ .
?? IF?I_HEAD -WAERS? =? '' .
???? SELECT? SINGLE?WAERS? FROM?LFM1? INTO?I_HEAD -WAERS? WHERE?LIFNR? =?I_HEAD -LIFNR? AND?EKORG? =?I_HEAD -EKORG .
?? ENDIF .
?? CALL? FUNCTION? 'CONVERSION_EXIT_ALPHA_INPUT'
???? EXPORTING
?????? INPUT?? =?I_HEAD -LIFNR
???? IMPORTING
?????? OUTPUT? =?I_HEAD -LIFNR .
?? IF?I_HEAD -ZZEVRT? IS? NOT? INITIAL .
???? CALL? FUNCTION? 'CONVERSION_EXIT_ALPHA_INPUT'
?????? EXPORTING
???????? INPUT?? =?I_HEAD -ZZEVRT
?????? IMPORTING
???????? OUTPUT? =?I_HEAD -ZZEVRT .
?? ENDIF .
?? HEADER - NUMBER? =?I_HEAD -EBELN .
?? HEADER -COMP_CODE? =?I_HEAD -BUKRS .
??HEADERX -COMP_CODE? =? 'X' .
?? HEADER -DOC_TYPE? =?I_HEAD -EVART .
??HEADERX -DOC_TYPE? =? 'X' .
?? HEADER -CREAT_DATE? =?SY -DATUM .
??HEADERX -CREAT_DATE? =? 'X' .
?? HEADER -CREATED_BY? =?SY -UNAME .
??HEADERX -CREATED_BY? =? 'X' .
?? HEADER -VENDOR? =?I_HEAD -LIFNR .
??HEADERX -VENDOR? =? 'X' .
?? HEADER -ITEM_INTVL? =? 1 .
??HEADERX -ITEM_INTVL? =? 'X' .
?? HEADER -SUBITEMINT? =? '1' .
??HEADERX -SUBITEMINT? =? 'X' .
?? HEADER -PURCH_ORG? =?I_HEAD -EKORG .
??HEADERX -PURCH_ORG? =? 'X' .
?? HEADER -PUR_GROUP? =?I_HEAD -EKGRP .
??HEADERX -PUR_GROUP? =? 'X' .
?? HEADER - CURRENCY? =?I_HEAD -WAERS .
??HEADERX - CURRENCY? =? 'X' .
?? HEADER -DOC_DATE? =?I_HEAD -VEDAT .
??HEADERX -DOC_DATE? =? 'X' .
?? HEADER -VPER_START? =?I_HEAD -KDATB .
??HEADERX -VPER_START? =? 'X' .
?? HEADER -VPER_END? =?I_HEAD -KDATE .
??HEADERX -VPER_END? =? 'X' .
?? IF?I_HEAD -TXT_K01?<>? '' .
????LT_HEADER_TEXT -TEXT_FORM? =? '*' .
????LT_HEADER_TEXT -TEXT_ID? =??? 'K01' .
????LT_HEADER_TEXT -TEXT_LINE? =?I_HEAD -TXT_K01 .
???? APPEND?LT_HEADER_TEXT .
???? CLEAR?LT_HEADER_TEXT .
?? ENDIF .
*采購客服?ZZCGKH
?? REFRESH?LT_WYT3[] .
?? SELECT?*? FROM?WYT3
???? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C1'
???????? AND?PERNR? =?I_HEAD -ZZCGKH .
?? IF?LT_WYT3[]? IS? INITIAL .
*????CONCATENATE?E_MESSAGE?'該采購客服不存在于采購組織中,請聯系IT修改!'?INTO?E_MESSAGE.
?? ENDIF .
?? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??LT_PARTNER -PARTN_ROLE? =? 'C1' .
??LT_PARTNERX -PARTN_ROLE? =? 'C1' .
??LT_PARTNER -LANGU? =? '1' .
??LT_PARTNERX -LANGU? =? 'X' .
??LT_PARTNER -PARTNR? =?I_HEAD -ZZCGKH .
??LT_PARTNERX -PARTNR? =? 'X' .
?? APPEND?LT_PARTNER .
?? APPEND?LT_PARTNERX .
?? REFRESH?LT_WYT3[] .
?? SELECT?*? FROM?WYT3
???? INTO? TABLE?LT_WYT3
???? WHERE?LIFNR? =?I_HEAD -LIFNR
?????? AND?EKORG? =?I_HEAD -EKORG
?????? AND?PARVW? =? 'C1' .
?? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZCGKH .
???? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????LT_PARTNER -PARTN_ROLE? =? 'C1' .
????LT_PARTNERX -PARTN_ROLE? =? 'C1' .
????LT_PARTNER -LANGU? =? '1' .
????LT_PARTNERX -LANGU? =? 'X' .
????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
????LT_PARTNERX -PARTNR? =? 'X' .
????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
????LT_PARTNERX -DELETE_IND? =? 'X' .
???? APPEND?LT_PARTNER .
???? APPEND?LT_PARTNERX .
?? ENDLOOP .
*采購協助?ZZCGXZ
?? IF?I_HEAD -ZZCGXZ? IS? NOT? INITIAL .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
???????? WHERE?LIFNR? =?I_HEAD -LIFNR
?????????? AND?EKORG? =?I_HEAD -EKORG
?????????? AND?PARVW? =? 'C2'
?????????? AND?PERNR? =?I_HEAD -ZZCGXZ .
???? IF?LT_WYT3[]? IS? INITIAL .
*??????CONCATENATE?E_MESSAGE?'該采購協助不存在于采購組織中,請聯系IT修改!'?INTO?E_MESSAGE.
???? ENDIF .
???? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????LT_PARTNER -PARTN_ROLE? =? 'C2' .
????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
????LT_PARTNER -LANGU? =? '1' .
????LT_PARTNERX -LANGU? =? 'X' .
????LT_PARTNER -PARTNR? =?I_HEAD -ZZCGXZ .
????LT_PARTNERX -PARTNR? =? 'X' .
???? APPEND?LT_PARTNER .
???? APPEND?LT_PARTNERX .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C2' .
???? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZCGXZ .
?????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??????LT_PARTNER -PARTN_ROLE? =? 'C2' .
??????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
??????LT_PARTNER -LANGU? =? '1' .
??????LT_PARTNERX -LANGU? =? 'X' .
??????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
??????LT_PARTNERX -PARTNR? =? 'X' .
??????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
??????LT_PARTNERX -DELETE_IND? =? 'X' .
?????? APPEND?LT_PARTNER .
?????? APPEND?LT_PARTNERX .
???? ENDLOOP .
?? ELSE .
???? "如果采購協助為空,就去取主數據,校驗一個與采購客服相同的人員,刪除其他
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C2'
???????? AND?PERNR? =?I_HEAD -ZZCGKH .
???? IF?SY -SUBRC? =? 0? .
?????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??????LT_PARTNER -PARTN_ROLE? =? 'C2' .
??????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
??????LT_PARTNER -LANGU? =? '1' .
??????LT_PARTNERX -LANGU? =? 'X' .
??????LT_PARTNER -PARTNR? =?I_HEAD -ZZCGKH .
??????LT_PARTNERX -PARTNR? =? 'X' .
?????? APPEND?LT_PARTNER .
?????? APPEND?LT_PARTNERX .
?????? REFRESH?LT_WYT3[] .
?????? SELECT?*? FROM?WYT3
???????? INTO? TABLE?LT_WYT3
???????? WHERE?LIFNR? =?I_HEAD -LIFNR
?????????? AND?EKORG? =?I_HEAD -EKORG
?????????? AND?PARVW? =? 'C2' .
?????? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZCGKH .
???????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????????LT_PARTNER -PARTN_ROLE? =? 'C2' .
????????LT_PARTNERX -PARTN_ROLE? =? 'C2' .
????????LT_PARTNER -LANGU? =? '1' .
????????LT_PARTNERX -LANGU? =? 'X' .
????????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
????????LT_PARTNERX -PARTNR? =? 'X' .
????????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
????????LT_PARTNERX -DELETE_IND? =? 'X' .
???????? APPEND?LT_PARTNER .
???????? APPEND?LT_PARTNERX .
?????? ENDLOOP .
???? ELSE .
?????? "要是沒有和采購客服相同的人員的話,不取
???? ENDIF .
?? ENDIF .
*采購駐廠?ZZZCRY
?? IF?I_HEAD -ZZZCRY? IS? NOT? INITIAL .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
???????? WHERE?LIFNR? =?I_HEAD -LIFNR
?????????? AND?EKORG? =?I_HEAD -EKORG
?????????? AND?PARVW? =? 'C3'
?????????? AND?PERNR? =?I_HEAD -ZZZCRY .
???? IF?LT_WYT3[]? IS? INITIAL .
*??????CONCATENATE?E_MESSAGE?'該駐廠人員不存在于采購組織中,請聯系IT修改!'?INTO?E_MESSAGE.
???? ENDIF .
???? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
????LT_PARTNER -PARTN_ROLE? =? 'C3' .
????LT_PARTNERX -PARTN_ROLE? =? 'C3' .
????LT_PARTNER -LANGU? =? '1' .
????LT_PARTNERX -LANGU? =? 'X' .
????LT_PARTNER -PARTNR? =?I_HEAD -ZZZCRY .
????LT_PARTNERX -PARTNR? =? 'X' .
???? APPEND?LT_PARTNER .
???? APPEND?LT_PARTNERX .
???? REFRESH?LT_WYT3[] .
???? SELECT?*? FROM?WYT3
?????? INTO? TABLE?LT_WYT3
?????? WHERE?LIFNR? =?I_HEAD -LIFNR
???????? AND?EKORG? =?I_HEAD -EKORG
???????? AND?PARVW? =? 'C3' .
???? LOOP? AT?LT_WYT3? WHERE?PERNR?<>?I_HEAD -ZZZCRY .
?????? CLEAR? :?LT_PARTNER ,LT_PARTNERX .
??????LT_PARTNER -PARTN_ROLE? =? 'C3' .
??????LT_PARTNERX -PARTN_ROLE? =? 'C3' .
??????LT_PARTNER -LANGU? =? '1' .
??????LT_PARTNERX -LANGU? =? 'X' .
??????LT_PARTNER -PARTNR? =?LT_WYT3 -PERNR .
??????LT_PARTNERX -PARTNR? =? 'X' .
??????LT_PARTNER -DELETE_IND? =? 'X' . "采購憑證中的刪除標識
??????LT_PARTNERX -DELETE_IND? =? 'X' .
?????? APPEND?LT_PARTNER .
?????? APPEND?LT_PARTNERX .
???? ENDLOOP .
?? ELSE .
???? "因為駐廠只會有一個人,要是為空的話,那就不用考慮別的了,直接抓取主數據中的
?? ENDIF .
?? DATA :LV_SERIAL_ID? TYPE?N?LENGTH? 10 ,
???????LV_KOPOS????? TYPE?KOPOS .
?? DATA :L_ITNO? TYPE?EBELP .
?? LOOP? AT?I_ITEM .
???? IF?I_ITEM -MATNR? IS? NOT? INITIAL .
?????? CALL? FUNCTION? 'CONVERSION_EXIT_MATN1_INPUT'
???????? EXPORTING
?????????? INPUT???????? =?I_ITEM -MATNR
???????? IMPORTING
?????????? OUTPUT??????? =?I_ITEM -MATNR
???????? EXCEPTIONS
??????????LENGTH_ERROR? =? 1
?????????? OTHERS??????? =? 2 .
???? ENDIF .
????LT_ITEM -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEMX -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEMX -ITEM_NOX? =? 'X' .
????LT_ITEM -SHORT_TEXT? =?I_ITEM -TXZ01 .
????LT_ITEMX -SHORT_TEXT? =? 'X' .
????LT_ITEM -MATERIAL? =?I_ITEM -MATNR .
????LT_ITEMX -MATERIAL? =? 'X' .
????LT_ITEM -PLANT? =?I_ITEM -WERKS .
????LT_ITEMX -PLANT? =? 'X' .
????LT_ITEM -STGE_LOC? =?I_ITEM -LGORT .
????LT_ITEMX -STGE_LOC? =? 'X' .
????LT_ITEM -MATL_GROUP? =?I_ITEM -MATKL .
????LT_ITEMX -MATL_GROUP? =? 'X' .
????LT_ITEM -ITEM_CAT? =?I_ITEM -EPSTP .
????LT_ITEMX -ITEM_CAT? =? 'X' .
????LT_ITEM -TARGET_QTY? =?I_ITEM -KTMNG .
????LT_ITEMX -TARGET_QTY? =? 'X' .
????LT_ITEM -PO_UNIT? =?I_ITEM -MEINS .
????LT_ITEMX -PO_UNIT? =? 'X' .
????LT_ITEM -NET_PRICE? =?I_ITEM -NETPR .
????LT_ITEMX -NET_PRICE? =? 'X' .
????LT_ITEM -PRICE_UNIT? =? 1 .
????LT_ITEMX -PRICE_UNIT? =? 'X' .
????LT_ITEM -INFO_UPD? =? '' .
????LT_ITEMX -INFO_UPD? =? 'X' .
???? APPEND?LT_ITEM .
???? CLEAR?LT_ITEM .
???? APPEND?LT_ITEMX .
???? CLEAR?LT_ITEMX .
???? IF?I_ITEM -TXT_K01?<>? '' .
??????LT_ITEM_TEXT -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_TEXT -TEXT_FORM? =? '*' .
??????LT_ITEM_TEXT -TEXT_ID? =??? 'K01' .
??????LT_ITEM_TEXT -TEXT_LINE? =?I_ITEM -TXT_K01 .
?????? APPEND?LT_ITEM_TEXT .
?????? CLEAR?LT_ITEM_TEXT .
???? ENDIF .
????LV_SERIAL_ID? =?LV_SERIAL_ID?+? 1 .
????LV_KOPOS? =? 1 .
????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
????LT_ITEM_CONDITION -COND_TYPE? =? 'PB00' .
????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -NETPR .
????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
???? APPEND?LT_ITEM_CONDITION .
???? APPEND?LT_ITEM_CONDITIONX .
???? CLEAR?LT_ITEM_CONDITIONX .
???? CLEAR?LT_ITEM_CONDITION .
????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
????LT_VALID -VALID_FROM? =?SY -DATUM . "I_HEAD-KDATB.
????LT_VALID -VALID_TO? =? '99991231' .
???? APPEND?LT_VALID .
????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
????LT_VALIDX -SERIAL_IDX? =? 'X' .
????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
????LT_VALIDX -VALID_FROM? =? 'X' .
????LT_VALIDX -VALID_TO? =? 'X' .
???? APPEND?LT_VALIDX .
???? IF?I_ITEM -ZYF?<>? 0 . "ZMB1??運費??ZYFDD
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZMB1' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZYFDD?/? '1.17' .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM?? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZYF?<>? 0 . "ZRB1??運費(代墊)??ZYF
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZRB1' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZYF .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM?? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZSLDD?<>? 0 . "ZRB2??上力費(代墊)??ZSLDD
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZRB2' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZSLDD .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZSL?<>? 0 . "ZMB2??上力費(一票)??ZSL
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZMB2' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZSL?/? '1.17' .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZQTDD?<>? 0 . "ZRB3??其他(代墊)??ZQTDD
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZRB3' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZQTDD .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
???? IF?I_ITEM -ZQT?<>? 0 . "ZMB3??其他(一票)??ZQT
?????? ADD? 1? TO?LV_SERIAL_ID .
?????? ADD? 1? TO?LV_KOPOS .
??????LT_ITEM_CONDITION -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_ITEM_CONDITIONX -ITEM_NOX? =? 'X' .
??????LT_ITEM_CONDITION -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_ITEM_CONDITIONX -SERIAL_IDX? =? 'X' .
??????LT_ITEM_CONDITION -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNT? =?LV_KOPOS .
??????LT_ITEM_CONDITIONX -COND_COUNTX? =? 'X' .
??????LT_ITEM_CONDITION -COND_TYPE? =? 'ZMB3' .
??????LT_ITEM_CONDITIONX -COND_TYPE? =? 'X' .
??????LT_ITEM_CONDITION -COND_VALUE? =?I_ITEM -ZQT?/? '1.17' .
??????LT_ITEM_CONDITIONX -COND_VALUE? =? 'X' .
??????LT_ITEM_CONDITION - CURRENCY? =?I_HEAD -WAERS .
??????LT_ITEM_CONDITIONX - CURRENCY? =? 'X' .
??????LT_ITEM_CONDITION -COND_P_UNT? =? 1 .
??????LT_ITEM_CONDITIONX -COND_P_UNT? =? 'X' .
??????LT_ITEM_CONDITION -COND_UNIT? =?I_ITEM -MEINS .
??????LT_ITEM_CONDITIONX -COND_UNIT? =? 'X' .
??????LT_ITEM_CONDITION -CHANGE_ID? =? 'I' .
?????? APPEND?LT_ITEM_CONDITION .
?????? APPEND?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITIONX .
?????? CLEAR?LT_ITEM_CONDITION .
??????LT_VALID -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALID -SERIAL_ID? =?LV_SERIAL_ID .
*????LT_VALID-PLANT?=?I_ITEM-WERKS.
??????LT_VALID -VALID_FROM? =?SY -DATUM .
??????LT_VALID -VALID_TO? =? '99991231' .
?????? APPEND?LT_VALID .
??????LT_VALIDX -ITEM_NO? =?I_ITEM -EBELP .
??????LT_VALIDX -SERIAL_ID? =?LV_SERIAL_ID .
??????LT_VALIDX -SERIAL_IDX? =? 'X' .
??????LT_VALIDX -ITEM_NOX? =? 'X' .
*????LT_VALIDX-PLANT?=?'X'.
??????LT_VALIDX -VALID_FROM? =? 'X' .
??????LT_VALIDX -VALID_TO? =? 'X' .
?????? APPEND?LT_VALIDX .
???? ENDIF .
?? ENDLOOP .
?? "若月獎勵勾選,則季獎勵和年獎勵同時勾選傳輸
?? IF?I_HEAD -ZZFANL_Y? =? 'X' .
????I_HEAD -ZZFANL_J? =? 'X' .
????I_HEAD -ZZFANL_N? =? 'X' .
?? ENDIF .
*??自定義字段
?? CLEAR?LT_EXTENSIONIN .
??LT_EXTENSIONIN - STRUCTURE? =? 'BAPI_TE_MEOUTHEADER' .
??LT_EXTENSIONIN -VALUEPART1+0 ( 10 )? =?I_HEAD -EBELN .
??LT_EXTENSIONIN -VALUEPART1+10 ( 10 )? =?I_HEAD -ZZEVRT .
??LT_EXTENSIONIN -VALUEPART1+20 ( 5 )? =?I_HEAD -ZZEVRTP .
??LT_EXTENSIONIN -VALUEPART1+25 ( 16 )? =?I_HEAD -ZZMQTY .
??LT_EXTENSIONIN -VALUEPART1+41 ( 3 )? =?I_HEAD -ZZMEINS .
??LT_EXTENSIONIN -VALUEPART1+44 ( 1 )? =?I_HEAD -ZZZHANL .
??LT_EXTENSIONIN -VALUEPART1+45 ( 1 )? =?I_HEAD -ZZBUC .
??LT_EXTENSIONIN -VALUEPART1+46 ( 1 )? =?I_HEAD -ZZFANL .
*??LT_EXTENSIONIN-VALUEPART1+47(8)?=?I_HEAD-ZZCGKH
*??LT_EXTENSIONIN-VALUEPART1+55(8)?=?I_HEAD-ZZCGXZ
*??LT_EXTENSIONIN-VALUEPART1+63(8)?=?I_HEAD-ZZZCRY
*??LT_EXTENSIONIN-VALUEPART1+71(4)?=?I_HEAD-ZZYYBM
*??LT_EXTENSIONIN-VALUEPART1+75(10)?=?I_HEAD-ZZVBELN
??LT_EXTENSIONIN -VALUEPART1+85 ( 1 )? =?I_HEAD -ZZFANL_Y .
??LT_EXTENSIONIN -VALUEPART1+86 ( 1 )? =?I_HEAD -ZZFANL_J .
??LT_EXTENSIONIN -VALUEPART1+87 ( 1 )? =?I_HEAD -ZZFANL_N .
??LT_EXTENSIONIN -VALUEPART1+88 ( 3 )? =?I_HEAD -ZZFKFS .
??LT_EXTENSIONIN -VALUEPART1+91 ( 1 )? =?I_HEAD -ZZJHTQ .
?? APPEND???LT_EXTENSIONIN .
?? CLEAR?LT_EXTENSIONIN .
??LT_EXTENSIONIN - STRUCTURE? =? 'BAPI_TE_MEOUTHEADERX' .
??LT_EXTENSIONIN -VALUEPART1+0 ( 10 )? =?I_HEAD -EBELN .
??LT_EXTENSIONIN -VALUEPART1+10 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+11 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+12 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+13 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+14 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+15 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+16 ( 1 )? =? 'X' .
*??LT_EXTENSIONIN-VALUEPART1+17(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+18(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+19(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+20(1)?=?'X'.
*??LT_EXTENSIONIN-VALUEPART1+21(1)?=?'X'.
??LT_EXTENSIONIN -VALUEPART1+22 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+23 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+24 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+25 ( 1 )? =? 'X' .
??LT_EXTENSIONIN -VALUEPART1+26 ( 1 )? =? 'X' .
?? APPEND???LT_EXTENSIONIN .
*??DATA:?LS_BAPI_TE_MEOUTHEADERX?LIKE?BAPI_TE_MEOUTHEADERX,
*????????LS_BAPI_TE_MEOUTHEADER??LIKE?BAPI_TE_MEOUTHEADER.
*??CLEAR?LT_EXTENSIONIN.
*??LT_EXTENSIONIN-STRUCTURE?=?'BAPI_TE_MEOUTHEADER'.
*??LS_BAPI_TE_MEOUTHEADER-NUMBER?=?I_HEAD-EBELN.
*??LS_BAPI_TE_MEOUTHEADER-ZZEVRT?=?I_HEAD-ZZEVRT.
*??LS_BAPI_TE_MEOUTHEADER-ZZEVRTP?=?I_HEAD-ZZEVRTP.
*??LS_BAPI_TE_MEOUTHEADER-ZZMQTY?=?I_HEAD-ZZMQTY.
*??LS_BAPI_TE_MEOUTHEADER-ZZMEINS?=?I_HEAD-ZZMEINS.
*??LS_BAPI_TE_MEOUTHEADER-ZZZHANL?=?I_HEAD-ZZZHANL.
*??LS_BAPI_TE_MEOUTHEADER-ZZBUC?=?I_HEAD-ZZBUC.
*
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZCGKH?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZCGXZ?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZZCRY?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZYYBM?=?''.
*??LS_BAPI_TE_MEOUTHEADER-ZZVBELN?=?''.
*
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL_Y?=?I_HEAD-ZZFANL_Y.
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL_J?=?I_HEAD-ZZFANL_J.
*??LS_BAPI_TE_MEOUTHEADER-ZZFANL_N?=?I_HEAD-ZZFANL_N.
*??LS_BAPI_TE_MEOUTHEADER-ZZFKFS?=?I_HEAD-ZZFKFS.
*??LS_BAPI_TE_MEOUTHEADER-ZZJHTQ?=?I_HEAD-ZZJHTQ.
*??LT_EXTENSIONIN+30(960)?=?LS_BAPI_TE_MEOUTHEADER.
**??CALL?METHOD?CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
**????EXPORTING
**??????IM_VALUE???????????????=?LS_BAPI_TE_MEOUTHEADER
**????IMPORTING
**??????EX_CONTAINER???????????=?LT_EXTENSIONIN-VALUEPART1
**????EXCEPTIONS
**??????ILLEGAL_PARAMETER_TYPE?=?1
**??????OTHERS?????????????????=?2.
*??APPEND?LT_EXTENSIONIN.
*
*??CLEAR?LT_EXTENSIONIN.
*??LT_EXTENSIONIN-STRUCTURE?=?'BAPI_TE_MEOUTHEADERX'.
*??LT_EXTENSIONIN+30(960)???=?LS_BAPI_TE_MEOUTHEADERX.
**??LS_BAPI_TE_MEOUTHEADERX-NUMBER?=?I_HEAD-EBELN.
**??LS_BAPI_TE_MEOUTHEADERX-ZZEVRT?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZEVRTP?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZMQTY?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZMEINS?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZZHANL?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZBUC?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFANL_Y?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFANL_J?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFANL_N?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZFKFS?=?'X'.
**??LS_BAPI_TE_MEOUTHEADERX-ZZJHTQ?=?'X'.
**??CALL?METHOD?CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
**????EXPORTING
**??????IM_VALUE???????????????=?LS_BAPI_TE_MEOUTHEADERX
**????IMPORTING
**??????EX_CONTAINER???????????=?LT_EXTENSIONIN-VALUEPART1
**????EXCEPTIONS
**??????ILLEGAL_PARAMETER_TYPE?=?1
**??????OTHERS?????????????????=?2.
*??APPEND?LT_EXTENSIONIN.
?? IF?BAPIFUN? =? 'I' .
????TECHNICAL_DATA -NO_MESSAGING? =? 'X' .
????TECHNICAL_DATA -NO_AUTHORITY_CHECK? =? 'X' .
???? CALL? FUNCTION? 'BAPI_CONTRACT_CREATE'
?????? EXPORTING
???????? HEADER?????????????? =? HEADER
????????HEADERX????????????? =?HEADERX
*???????VENDOR_ADDRESS??????=
????????TESTRUN????????????? =?TESTRUN
????????TECHNICAL_DATA?????? =?TECHNICAL_DATA
?????? IMPORTING
????????PURCHASINGDOCUMENT?? =?E_EBELN
*???????EXP_HEADER??????????=
?????? TABLES
???????? RETURN?????????????? =?LT_RETURN
????????ITEM???????????????? =?LT_ITEM
????????ITEMX??????????????? =?LT_ITEMX
*???????ACCOUNT?????????????=
*???????ACCOUNTPROFITSEGMENT????????=
*???????ACCOUNTX????????????=
*???????DELIVERY_ADDRESS????=
????????ITEM_COND_VALIDITY?? =?LT_VALID
????????ITEM_COND_VALIDITYX? =?LT_VALIDX
????????ITEM_CONDITION?????? =?LT_ITEM_CONDITION
????????ITEM_CONDITIONX????? =?LT_ITEM_CONDITIONX
*???????ITEM_COND_SCALE_VALUE???????=
*???????ITEM_COND_SCALE_QUAN????????=
????????ITEM_TEXT??????????? =?LT_ITEM_TEXT
????????HEADER_TEXT????????? =?LT_HEADER_TEXT
*???????HEAD_COND_VALIDITY??=
*???????HEAD_COND_VALIDITYX?=
*???????HEAD_CONDITION??????=
*???????HEAD_CONDITIONX?????=
*???????HEAD_COND_SCALE_VAL?=
*???????HEAD_COND_SCALE_QUAN????????=
????????PARTNER????????????? =?LT_PARTNER
????????PARTNERX???????????? =?LT_PARTNERX
????????EXTENSIONIN????????? =?LT_EXTENSIONIN
*???????EXTENSIONOUT????????=
?????? .
?? ELSEIF?BAPIFUN? =? 'U' .
????E_EBELN? =?I_HEAD -EBELN .
???? CALL? FUNCTION? 'BAPI_CONTRACT_CHANGE'
?????? EXPORTING
????????PURCHASINGDOCUMENT? =?I_HEAD -EBELN
???????? HEADER????????????? =? HEADER
????????HEADERX???????????? =?HEADERX
*???????VENDOR_ADDRESS?????=
????????TESTRUN???????????? =?TESTRUN
????????TECHNICAL_DATA????? =?TECHNICAL_DATA
*?IMPORTING
*???????EXP_HEADER?????????=
?????? TABLES
????????ITEM??????????????? =?LT_ITEM
????????ITEMX?????????????? =?LT_ITEMX
*???????ACCOUNT????????????=
*???????ACCOUNTPROFITSEGMENT????????=
*???????ACCOUNTX???????????=
*???????DELIVERY_ADDRESS???=
*???????ITEM_COND_VALIDITY?=
*???????ITEM_COND_VALIDITYX?????????=
????????ITEM_CONDITION????? =?LT_ITEM_CONDITION
????????ITEM_CONDITIONX???? =?LT_ITEM_CONDITIONX
*???????ITEM_COND_SCALE_VALUE???????=
*???????ITEM_COND_SCALE_QUAN????????=
*???????ITEM_TEXT??????????=
*???????HEADER_TEXT????????=
*???????HEAD_COND_VALIDITY?=
*???????HEAD_COND_VALIDITYX?????????=
*???????HEAD_CONDITION?????=
*???????HEAD_CONDITIONX????=
*???????HEAD_COND_SCALE_VAL?????????=
*???????HEAD_COND_SCALE_QUAN????????=
*???????PARTNER????????????=
*???????PARTNERX???????????=
*???????RELEASE_DOCU???????=
*???????EXTENSIONIN????????=
*???????EXTENSIONOUT???????=
???????? RETURN????????????? =?LT_RETURN .
?? ENDIF .
?? APPEND? LINES? OF?LT_RETURN? TO?ET_RETURN .
?? LOOP? AT?LT_RETURN? WHERE? TYPE? =? 'E'? OR? TYPE? =? 'A' .
????E_SUCC? =? 'E' .
???? IF?LT_RETURN - ID? =? 'BAPI'? AND?LT_RETURN - NUMBER? =? '001'? AND?LT_RETURN - TYPE? =? 'E' .
?????? "排除此消息
???? ELSE .
?????? CONCATENATE?E_MESSAGE?LT_RETURN - MESSAGE? ';'? INTO?E_MESSAGE .
???? ENDIF .
?? ENDLOOP .
?? IF?SY -SUBRC?<>? 0 .
???? CALL? FUNCTION? 'BAPI_TRANSACTION_COMMIT'
?????? EXPORTING
???????? WAIT? =? 'X' .
????E_SUCC? =? 'S' .
???? IF?TESTRUN? =? '' .
??????GS_CTRD_LOG -EBELN? =?E_EBELN .
?????? CONCATENATE?E_MESSAGE? '采購合同'?E_EBELN? '創建成功!'? INTO?E_MESSAGE .
?????? CLEAR?LW_GCJZNQ .
??????LW_GCJZNQ -EBELN? =?E_EBELN .
??????LW_GCJZNQ -GCJZNQ? =?I_HEAD -GCJZNQ .
??????LW_GCJZNQ -BEIZ? =? '采購合同' .
??????LW_GCJZNQ -ERDAT? =?SY -DATUM .
??????LW_GCJZNQ -ERZET? =?SY -UZEIT .
?????? MODIFY?ZMM_GCJZNQ? FROM?LW_GCJZNQ .
?????? IF?SY -SUBRC? =? 0? .
???????? COMMIT? WORK .
?????? ENDIF .
???? ELSE .
?????? CONCATENATE?E_MESSAGE? '采購合同檢查成功!'? INTO?E_MESSAGE .
???? ENDIF .
?? ELSE .
???? CALL? FUNCTION? 'BAPI_TRANSACTION_ROLLBACK' .
?? ENDIF .
?? CLEAR : HEADER ,HEADERX ,TECHNICAL_DATA ,LT_RETURN ,LT_ITEM ,LT_ITEMX ,LT_VALID ,LT_VALIDX ,LT_ITEM_CONDITION ,LT_ITEM_CONDITIONX ,LT_EXTENSIONIN ,LT_HEADER_TEXT ,LT_ITEM_TEXT .
?? REFRESH :LT_RETURN ,LT_ITEM ,LT_ITEMX ,LT_VALID ,LT_VALIDX ,LT_ITEM_CONDITION ,LT_ITEM_CONDITIONX ,LT_EXTENSIONIN ,LT_HEADER_TEXT ,LT_ITEM_TEXT ,LT_PARTNER ,LT_PARTNERX .
*??寫日志
?? IF?NOAPPLLOG? =? '' .
????GS_CTRD_LOG -E_MESSAGE? =?E_MESSAGE .
????GS_CTRD_LOG -E_SUCC? =?E_SUCC .
???? PERFORM?SAVE_CTRD_LOG? TABLES?I_ITEM .
?? ENDIF .
ENDFUNCTION .
總結
- 上一篇: PP生产订单的BADI增强 WORKOR
- 下一篇: MRP元素的缩写