经典网站首页设计,网站 设计 语言,微信管理系统软件,标识设计公司网站调用BAPI:BAPI_SHIPMENT_CREATE创建装运单本身很简单#xff0c;但是如果是第一次使用的话#xff0c;可能会对抬头的一些日期感到困惑
BAPI_SHIPMENT_CREATE抬头日期字段处理代码#xff1a;Include程序#xff1a;LV56I_BAPIHEA#xff0c;子程序#xff1a;set_heade…调用BAPI:BAPI_SHIPMENT_CREATE创建装运单本身很简单但是如果是第一次使用的话可能会对抬头的一些日期感到困惑
BAPI_SHIPMENT_CREATE抬头日期字段处理代码Include程序LV56I_BAPIHEA子程序set_header_data
常量定义Include程序LV56I_BAPITOP
*- Global constants: deadline types
CONSTANTS: BEGIN OF gc_time_type,stpldt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTPLDT,Status plannedstcipdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTCIPDT,Status checkin planstpladt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTCIADT,Status checkin actstlspdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTLSPDT,Status load start planstlsadt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTLSADT,Status load start actstlepdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTLEPDT,Status load end planstleadt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTLEADT,Status load end actstcpdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTCPDT,Status complete planstcadt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTCADT,Status copmlete actstsspdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTSSPDT,Status shipmnt start planstssadt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTSSADT,Status shipmnt start actstsepdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTSEPDT,Status shipmnt end planstseadt LIKE bapishipmentheaderdeadline-time_type VALUE HDRSTSEADT,Status shipmnt end acttndepdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRTNDEPDT,Tendering earliest picktndlpdt LIKE bapishipmentheaderdeadline-time_type VALUE HDRTNDLPDT,Tendering latest picktndeddt LIKE bapishipmentheaderdeadline-time_type VALUE HDRTNDEDDT,Tendering earliest deliverytndlddt LIKE bapishipmentheaderdeadline-time_type VALUE HDRTNDLDDT,Tendering latest deliverylstpdt LIKE bapishipmentstagedeadline-time_type VALUE STLSTPDT,Stage start planlstadt LIKE bapishipmentstagedeadline-time_type VALUE STLSTADT,Stage start actlenpdt LIKE bapishipmentstagedeadline-time_type VALUE STLENDPT,Stage end planlenadt LIKE bapishipmentstagedeadline-time_type VALUE STLENADT,Stage end act
END OF gc_time_type. 常量的使用
在Incldue程序LV56I_BAPIHEA的set_header_data子程序中可以找到日期对应具体的vttk的日期 LOOP AT it_deadline_ext.CASE it_deadline_ext-time_type.WHEN gc_time_type-stpldt. Status plannedCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dtdis TIME cs_data_int-uzdis.WHEN gc_time_type-stcipdt. Status checkin planCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dpreg TIME cs_data_int-upreg.WHEN gc_time_type-stpladt. Status checkin actCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dareg TIME cs_data_int-uareg.WHEN gc_time_type-stlspdt. Status load start planCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dplbg TIME cs_data_int-uplbg.WHEN gc_time_type-stlsadt. Status load start actCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dalbg TIME cs_data_int-ualbg.WHEN gc_time_type-stlepdt. Status load end planCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dplen TIME cs_data_int-uplen.WHEN gc_time_type-stleadt. Status load end actCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dalen TIME cs_data_int-ualen.WHEN gc_time_type-stcpdt . Status complete planCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dpabf TIME cs_data_int-upabf.WHEN gc_time_type-stcadt . Status copmlete actCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dtabf TIME cs_data_int-uzabf.WHEN gc_time_type-stsspdt. Status shipmnt start planCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dptbg TIME cs_data_int-uptbg.WHEN gc_time_type-stssadt. Status shipmnt start actCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-datbg TIME cs_data_int-uatbg.WHEN gc_time_type-stsepdt. Status shipmnt end planCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-dpten TIME cs_data_int-upten.WHEN gc_time_type-stseadt. Status shipmnt end actCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-daten TIME cs_data_int-uaten.WHEN gc_time_type-tndepdt. Tendering earliest pickCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-tndr_erpdTIME cs_data_int-tndr_erpt.WHEN gc_time_type-tndlpdt. Tendering latest pickCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-tndr_ltpdTIME cs_data_int-tndr_ltpt.WHEN gc_time_type-tndeddt. Tendering earliest deliveryCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-tndr_erddTIME cs_data_int-tndr_erdt.WHEN gc_time_type-tndlddt. Tendering latest deliveryCONVERT TIME STAMP it_deadline_ext-time_stamp_utcTIME ZONE it_deadline_ext-time_zoneINTO DATE cs_data_int-tndr_ltddTIME cs_data_int-tndr_ltdt.WHEN OTHERS.gf_flag_rollback gc_true.IF it_deadline_ext-time_type IS INITIAL. v_546602sy-msgid VTBAPI .sy-msgty E .sy-msgno 013 .ELSE.sy-msgid VTBAPI .sy-msgty E .sy-msgno 014 .sy-msgv1 it_deadline_ext-time_type.ENDIF. ^_546602PERFORM append_protocol USINGsy-msgid sy-msgty sy-msgnosy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.clear: sy-msgid, sy-msgty, sy-msgno, sy-msgv1.ENDCASE.ENDLOOP.
传入日期的使用方法代码片段如下
IF pa_syori_h-etd IS NOT INITIAL. ETDls_headline-time_type HDRSTCPDT. Planned date for shipment completionCALL FUNCTION IB_CONVERT_INTO_TIMESTAMPEXPORTINGi_datlo pa_syori_h-etdi_timlo sy-timlo
* I_TZONE SY-ZONLOIMPORTINGe_timestamp ls_headline-time_stamp_utc.ls_headline-time_zone UTC.APPEND ls_headline TO lt_headline.CLEAR:ls_headline.ENDIF.IF pa_syori_h-eta IS NOT INITIAL. ETAls_headline-time_type HDRSTSSPDT. Planned date for end of shipmentCALL FUNCTION IB_CONVERT_INTO_TIMESTAMPEXPORTINGi_datlo pa_syori_h-etai_timlo sy-timlo
* I_TZONE SY-ZONLOIMPORTINGe_timestamp ls_headline-time_stamp_utc.ls_headline-time_zone UTC.APPEND ls_headline TO lt_headline.CLEAR:ls_headline.ENDIF.IF pa_syori_h-dpreg IS NOT INITIAL. チェックイン予定日付ls_headline-time_type HDRSTCIPDT. Planned date of check-inCALL FUNCTION IB_CONVERT_INTO_TIMESTAMPEXPORTINGi_datlo pa_syori_h-dpregi_timlo sy-timlo
* I_TZONE SY-ZONLOIMPORTINGe_timestamp ls_headline-time_stamp_utc.ls_headline-time_zone UTC.APPEND ls_headline TO lt_headline.CLEAR:ls_headline.ENDIF.IF pa_syori_h-tdlnr IS NOT INITIAL.
* 仕入先マスタを見て、マスタに存在する場合のみセットCLEAR: lwk_mcode,lwk_lifnr.PERFORM alpha_input USING pa_syori_h-tdlnrCHANGING lwk_mcode. 海貨業者SELECT SINGLE lifnr FROM lfa1 INTO lwk_lifnr WHERE lifnr lwk_mcode.IF sy-subrc 0.ls_header-service_agent_id pa_syori_h-tdlnr. 海貸業者ENDIF.ENDIF.CALL FUNCTION BAPI_SHIPMENT_CREATEEXPORTINGheaderdata ls_headerIMPORTINGtransport lv_transport
* SHIPMENTGUID TABLESheaderdeadline lt_headlineitemdata lt_items
* STAGEDATA
* STAGEDEADLINE
* ITEMONSTAGE
* ADDRESS
* hdunheader lt_hdunheader
* hdunitem lt_hdunitemreturn lt_return.