Waihangahia he hinonga ma te whakamahi i te SAP OData

Horopaki

Ko te hanga hinonga ka taea te whakatinana i nga huarahi e rua:

1. Te whakamahi tikanga CREATE_ENTITY mo te hanga hinonga kotahi.
2. Te whakamahi tikanga CREATE_DEEP_ENTITY ki te hanga i tetahi hinonga kotahi me te hinonga maatua me te tamaiti.

hātepe

1. Whakatuwherahia *DPC_EXT toi o te karaehe o OData ka tautuhi ano i te tikanga *CREATE_ENTITY.

2. Whakahoutia te tikanga.

tikanga PARTNERS_CREATE_ENTITY. raraunga: lv_id momo snwd_partner_id, ls_id momo bapi_epm_bp_id, ls_header momo bapi_epm_bp_header, lt_return momo ripanga o bapiret2, error_msg momo aho, ls_message type scx_t100key, lt_keys/type_bp_patuhi_whw, lt_keys/wp_twp_pw_pw_pw_pw_pw_pw_pw_pw_pw_t_pw_pw_pw_pw_pw_pw_pw_pw_pw_pw_pw_pw io_data_provider->read_entry_data( kawemai es_data = ls_header ). KAUPAPA KAUPAPA 'BAPI_EPM_BP_CREATE' KAUPAPA KAUPAPA KAUPAPA = ls_header " EPM: Raraunga pane BP IMPORTING BUSINESSPARTNERID = ls_id TABLES RETURN = lt_return. ki te kore te lt_return i te tuatahi. loop at lt_return reference into data(lr_turnmessreturn. -msgid = 'SY'. ls_message-msgno = '002'. ls_message-attr1 = error_msg. whakaara ake te momo okotahi /iwbep/cx_mgw_busi_exception EXPORTING textid = ls_message. endif. WAWAI WAHI 'BAPI_EPM_BP_GET_DETAIL_BP_GET_DETAILDATA_Whakamutunga. 

Ko nga raraunga whakauru ka tukuna ki te hanganga es_data ka mau ki te ls_header. Ka whakamahia te hanganga ls_header hei tawhā whakauru o BAPI 'BAPI_EPM_BP_CREATE' ki te hanga raraunga i roto i te putunga raraunga. Na ka tikina e te BAPI 'BAPI_EPM_BP_GET_DETAIL' nga raraunga i hangaia ka hopu i roto i te er_entity ka tukuna ki te tinana whakautu.

3. Whakahohehia te karaehe.

4. Waihanga Hinonga Hohonu (Hei hanga Pane me te Tuemi): Tautuhia ano te tikanga /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY

5. Whakahoutia te tikanga.

tikanga /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY. momo: ty_t_soitem momo ripanga paerewa o zcl_z_epm_rkt_mpc => ts_salesorderitem me te kī taunoa. momo: timata o ty_s_so. whakauruhia te momo zcl_z_epm_rkt_mpc => ts_salesorder. momo: momo momo ty_t_soitem, mutunga o ty_s_so. raraunga: ls_sales_order type ty_s_so, lv_compare_result type /iwbep/if_mgw_odata_expand=>ty_e_compare_result. raraunga: momo lv_so_id BAPI_EPM_SO_ID, momo ls_so_hdr BAPI_EPM_SO_HEADER, momo ls_so_hdr2 BAPI_EPM_SO_HEADER, momo ls_so_item BAPI_EPM_SO_ITEM, patopato lt_so_item tepu paerewa o BAPI_EPM_SO_ITEM, lt_so_item2 pato tepu paerewa o BAPI_EPM_SO_ITEM, momo bapirettab lt_return, ls_return MOMO bapiret2, momo ls_message scx_t100key, momo error_msg string. taumau: lc_so_itm TYPE aho WARA 'Tuemi'. * Whakamana mehemea ka rite nga raraunga ki te lv_compare_result = io_expand->compare_to( lc_so_itm ). * Uru ki nga raraunga mai i IO_DATA_PROVIDER ki te lv_compare_result EQ /iwbep/if_mgw_odata_expand=>gcs_compare_result-match_equals. io_data_provider->read_entry_data( IMPORTING es_data = ls_sales_order ). * Nekehia nga raraunga ota hoko pane ki roto i te hanganga BAPI neke-rite ls_sales_order ki ls_so_hdr. * Nekehia nga taonga ota hoko ki roto i te hangahanga ripanga BAPI i te ls_sales_order-tuemi ki ls_so_item. tāpirihia te ls_so_item ki te lt_so_item. porowhita. KAUPAPA KAUPAPA 'BAPI_EPM_SO_CREATE' TE KAUPAPA KAUPAPA KAUPAPA = ls_so_hdr KAUPAPA KAUPAPA KAUPAPA = lv_so_id NGĀ TAPA ITEMDATA = lt_so_item RETURN = lt_return. mena ehara te lt_return i te tuatahi. koropiko ki te lt_return ki te ls_return. err_msg = ls_whakahoki-karere . porowhita. ls_message-msgid = 'SY'. ls_message-msgno = '002'. ls_message-attr1 = hapa_msg. whakaarahia te momo rereke /iwbep/cx_mgw_busi_exception kaweake textid = ls_message. atu. KAUPAPA KAUPAPA 'BAPI_EPM_SO_GET_DETAIL' TE KAUPAPA SO_ID = lv_so_id KAUPAPA KAUPAPA KAUPAPA = ls_so_hdr2 TABLES ITEMDATA = lt_so_item2. neke-rite ls_so_hdr2 ki ls_sales_order. ls_sales_order-taonga = lt_so_item2. copy_data_to_ref( TE KAUPAPA he_raraunga = ls_sales_order CHANGING cr_data = er_deep_entity ). mutunga. mutunga. tikanga mutunga. 

Ko te hanganga o nga raraunga taumai kei roto i nga maatua me nga tamariki te hanganga kohanga. Kua tautuhia tenei ki te momo ty_s_so.

6. Whakahohehia te karaehe

7. Whakahaerehia te tono Waihanga.

  • Tīpakohia te Huinga Hinonga
  • Tīpakohia te tikanga HTTP hei POST
  • Tāpirihia nga raraunga ki te tinana tono
  • Pāwhiritia Whakamahi

Waiho he tākupu

Whakamahia ai e tenei pae i te Akismet hei whakaiti i te mokowhiti. Akohia te tukatuka o to raraunga korero.