We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-abap] Sample Code for CMD_EI_API for Creating Customer and Vendor Master Data

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Posted by Mathews
on Oct 17 at 12:13 AM
data : wa_VAT_NUMBER type CVIS_EI_VAT_NUMBERS,
wa_vat_t type CVIS_EI_VAT_T,
wa_vat type CVIS_EI_VAT,
wa_PHONE type CVIS_EI_CVI_PHONE,
wa_ph_t type CVIS_EI_PHONE_T,
wa_ph_ph type CVIS_EI_PHONE_STR,
wa_FAX type CVIS_EI_CVI_FAX,
wa_fx_t type CVIS_EI_FAX_T,
wa_fx_fx type CVIS_EI_FAX_STR,
wa_sm_smtp type CVIS_EI_SMTP_STR,
wa_smtp_t type CVIS_EI_SMTP_T,
wa_SMTP type CVIS_EI_CVI_SMTP.

data: wa_header type cmds_ei_header,
wa_address type bapiad1vl,
wa_addressx type bapiad1vlx,
wa_comm type CVIS_EI_CVI_COMMUNICATION,
wa_bankdetail_st type cvis_ei_cvi_bankdetail,
wa_bankdetail type cvis_ei_bankdetail,
wa_bank_t type CVIS_EI_BANKDETAIL_T,
wa_bank type CVIS_EI_BANKDETAIL_KEY,
wa_company_code_st type cmds_ei_company,
wa_company_code type cmds_ei_cmd_company,
wa_functions_st type cmds_ei_functions,
wa_functions_t type CMDS_EI_FUNCTIONS_T,
wa_functions type cmds_ei_cmd_functions,
wa_central type CMDS_EI_CMD_CENTRAL,
wa_central_dt type CMDS_EI_CENTRAL_DATA,
wa_sales_data_st type cmds_ei_sales,
wa_sales_data type cmds_ei_cmd_sales,
wa_customer type cmds_ei_extern,
wa_customers type cmds_ei_main,
wa_correct type cmds_ei_main,
wa_defective type cmds_ei_main,
wa_mes_correct type cvis_message,
wa_mes_error type cvis_message,
return_t type bapiret2_t.

constants: c_update type c value 'M', c_insert type c value 'I'.

start-of-selection.

wa_address-name = 'Name_class'.
wa_address-city = 'berlin'.
wa_address-DISTRICT = 'HERMSDORF' .
wa_address-POSTL_COD2 = '12346'.
wa_address-PO_BOX = '23426'.
wa_address-postl_cod1 = '99999'.
wa_address-TRANSPZONE = 'D000010000' .
wa_address-street = '1400 9TH ST W'.
wa_address-STR_SUPPL1 = 'berlin2'.
wa_address-ROOM_NO = '34'.
wa_address-country = 'DE'.
wa_address-langu = 'DE'.
wa_address-region = '11'.
wa_address-sort1 = 'Cust_by_class'.

wa_comm-PHONE = '123-456-891'.
wa_comm-FAX = '1234567891'.
wa_comm-SMTP = email@removed '.

wa_ph_DATA-COUNTRY = 'DE'.
wa_ph_DATA-TELEPHONE = '123-456-891'.
wa_ph_ph-contact-task = c_insert.

wa_ph_ph-contact-data-country = 'DE'.
wa_ph_ph-contact-data-TELEPHONE = '123-456-891'.
append wa_ph_ph to wa_ph_t.
wa_PHONE-phone = wa_ph_t.
wa_comm-PHONE = wa_phone.

*wa_fx_DATA-COUNTRY = 'DE'.
*wa_fx_DATA-FAX = '1234567891'.
wa_fx_fx-contact-task = c_insert.
wa_fx_fx-contact-data-country = 'DE'.
wa_fx_fx-contact-data-FAX = '123-456-891'.
append wa_fx_fx to wa_fx_t.
wa_FAX-FAX = wa_fx_t.
wa_comm-FAX = wa_FAX.

wa_sm_smtp-contact-task = c_insert.
wa_sm_smtp-contact-data-E_MAIL = email@removed '.
append wa_sm_smtp to wa_smtp_t.
wa_SMTP-smtp = wa_smtp_t.
wa_comm-SMTP = wa_SMTP.
* VAT Reg. No = 'DE126523143' .

* Assign address data directly
wa_customer-central_data-address-TASK = c_insert.
wa_customer-central_data-address-postal-data = wa_address.
* wa_customer-central_data-address-postal-datax = wa_addressx.
wa_customer-central_data-address-COMMUNICATION = wa_comm.

** Assign account group directly
wa_customer-central_data-central-data-ktokd = '0001'.
wa_customer-central_data-central-datax-ktokd = 'X'.

wa_company_code_st-task = c_insert.
wa_company_code_st-data_key-bukrs = '1000'.
* wa_company_code_st-data-zuawa = '009'.
wa_company_code_st-data-akont = '0000140000'.
* wa_company_code_st-data-zwels = 'ACDETY'.
wa_company_code_st-data-zterm = 'ZB01'.
* wa_company_code_st-data-zgrup = '02'.
* wa_company_code_st-data-xausz = '2'.
* wa_company_code_st-data-xzver = 'X'.

append wa_company_code_st to wa_company_code-company.

wa_sales_data_st-task = c_insert.

wa_sales_data_st-data_key-vkorg = '1000'.
wa_sales_data_st-data_key-vtweg = '10'.
wa_sales_data_st-data_key-spart = '10'.

wa_sales_data_st-data-kalks = '1'.
* wa_sales_data_st-data-PODKZ = '1'.
wa_sales_data_st-data-inco1 = 'CIF'.
wa_sales_data_st-data-inco2 = 'BERLIN'.
* wa_sales_data_st-data-antlf = '9'.
wa_sales_data_st-data-kzazu = 'X'.
wa_sales_data_st-data-vsbed = '02'.
wa_sales_data_st-data-LPRIO = '02'.
wa_sales_data_st-data-VWERK = '1000' .
wa_sales_data_st-data-waers = 'EUR'.
* wa_sales_data_st-data-ktgrd = '01'.
wa_sales_data_st-data-zterm = 'ZB01'.

* wa_sales_data_st-functions-functions-data_key-parvw = 'SP'.
wa_functions_st-data_key-parvw = 'SP'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.

wa_functions_st-data_key-parvw = 'BP'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.

wa_functions_st-data_key-parvw = 'PY'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.

wa_functions_st-data_key-parvw = 'SH'.
wa_functions_st-data_key-parza = '000'.

* append wa_functions_st to wa_functions_t.
append wa_functions_st to wa_functions-functions.

* wa_functions = wa_functions_t.

wa_sales_data_st-functions = wa_functions.

append wa_sales_data_st to wa_sales_data-sales.

* wa_bankdetail_st-task = c_insert.
* wa_bankdetail_st-DATA_KEY-BANKS = 'DE'.
* wa_bankdetail_st-DATA_KEY-BANKL = '12412654'.
* wa_bankdetail_st-DATA_KEY-BANKN = '46575466'.
** wa_bankdetail_st-DATA-BKONT =
* wa_bankdetail_st-DATA-KOINH = '3456' .

* append wa_bankdetail_st to wa_bank_t.

*wa_bankdetail-BANKDETAILS = wa_bank_t.

* wa_vat_DATA_KEY-LAND1 = 'DE'.
* wa_vat_data-STCEG = 'DE126523123'.
wa_vat-task = c_insert.
wa_vat-DATA_KEY-LAND1 = 'DE'.
wa_vat-data-STCEG = 'DE126523123'.
append wa_vat to wa_vat_t.
wa_VAT_NUMBER-VAT_NUMBERS = wa_vat_t.

wa_central-data-ktokd = '0001'.
wa_central-data-STCEG = 'DE126523123'.

wa_central_dt-central = wa_central.
wa_central_dt-VAT_NUMBER = wa_VAT_NUMBER.
* wa_central_dt-BANKDETAIL = wa_bankdetail.

* wa_customer-header-object_instance-kunnr = '77775'.
wa_customer-header-object_task = c_insert.
wa_customer-company_data = wa_company_code.
wa_customer-CENTRAL_DATA = wa_central_dt.
wa_customer-sales_data = wa_sales_data.

append wa_customer to wa_customers-customers.

CALL METHOD cmd_ei_api=>maintain_bapi
EXPORTING
is_master_data = wa_customers
IMPORTING
ES_MASTER_DATA_CORRECT = wa_correct
ES_MESSAGE_CORRECT = wa_mes_correct
ES_MASTER_DATA_DEFECTIVE = wa_defective
ES_MESSAGE_DEFECTIVE = wa_mes_error.
if wa_mes_error-is_error is initial.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
endif.

---------------Original Message---------------
From: Mathews
Sent: Friday, October 14, 2011 1:02 AM
Subject: Sample Code for CMD_EI_API for Creating Customer and Vendor Master Data

Dear ABAPERS,

1)I have requirement where I need to create customer and vendor master data. BAPI for customer does not suit my req as I need to give reference partner no as mandadatory. But if I dont have the customer for the particular sales area then it would be a wrong master data. For vendor there is no bapi or FM to create. Presently it is running by BDC but I need to change it to class CMD_EI_API.
2)What is the difference between MAINTAIN and MAINTAIN_BAPI method.
3) Please share your sample code as I tried my level best but not succeeded in creating.
4) Is this way of creating vendor and customer master data is correct.
IF any sample code available then share your precious code or precious suggestions.

Thanks
Mathews

__.____._
Copyright © 2011 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Mark as helpful
View this online
  
Popular White Papers

In the Spotlight
Have you explored the Toolbox.com Marketplace? Learn more and access a free course now.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language