如何在 SAP CRM 中创建机会?
How to create Opportunity in SAP CRM?
我是Java开发人员,对SAP CRM还比较陌生,但是当前项目的需求要求我对SAP CRM系统有一个基本的了解。我想知道我可以在哪个工具上找到 SAP 中的客户、机会、潜在客户等。如果问题不完整,请问我适当的问题,我会尽力解释。
我已经看过多个视频和教程,但没有任何帮助,代码目前不可用
我希望有人告诉我在 SAP CRM 中我可以在哪里找到上述字段(客户、机会、案例等,如在 Salesforce 中)。
为此使用 BAPI_OPPORTUNITY_CREATEMULTI
,并且不要忘记在 BAPI 之后 运行 提交,否则您的机会将不会出现在表格中。这是示例:
DATA: return TYPE TABLE OF BAPIRET2 WITH HEADER LINE,
it_opportunity TYPE BAPIBUS20001_OPPORTUNITY,
it_header TYPE BAPIBUS20001_HEADER_INS,
it_item TYPE BAPIBUS20001_ITEM,
it_input_fields TYPE BAPIBUS20001_INPUT_FIELDS,
it_pricing TYPE BAPIBUS20001_PRICING,
<fs_partner> TYPE BAPIBUS20001_PARTNER_INS,
w_status TYPE BAPIBUS20001_STATUS_INS.
* gc_handle_1 is used for an item to bind it to a opportunity and gc_handle_2 is used to bind the information for an item to an item.
CONSTANTS: gc_handle_1 TYPE crmt_handle VALUE '0000000001',
gc_handle_2 TYPE crmt_handle VALUE '0000000002'.
* --ITEM DATA--
APPEND INITIAL LINE TO it_item ASSIGNING FIELD-SYMBOL(<fs_item>).
<fs_item>-mode = 'A'.
<fs_item>-ordered_prod = int_tab-produkt. "your product
<fs_item>-itm_type = 'ZOPT'.
<fs_item>-handle = gc_handle_2. "Identification of this item
<fs_item>-header_handle = gc_handle_1. "Refers to the opportunity for which this item is for.
APPEND INITIAL LINE TO it_input_fields ASSIGNING FIELD-SYMBOL(<fs_fields>).
<fs_fields>-ref_handle = gc_handle_2. "Refers to the item for which this information is for
<fs_fields>-objectname = 'ORDERADM_I'.
<fs_fields>-ref_kind = 'B'.
<fs_fields>-fieldname = 'ORDERED_PROD'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'ITM_TYPE'.
CLEAR return.
* --HEADER DATA --
APPEND INITIAL LINE TO it_header ASSIGNING FIELD-SYMBOL(<fs_header>).
<fs_header>-guid = ''.
<fs_header>-handle = gc_handle_1. "Identification of this opportunity
CONCATENATE 'Konv: ' int_tab-betegnelse INTO <fs_header>-description SEPARATED BY space.
<fs_header>-process_type = 'ZOPP'.
<fs_header>-descr_language = 'K'.
<fs_header>-langu_iso = 'DA'.
<fs_header>-posting_date = sy-datum.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-ref_handle = gc_handle_1.
<fs_fields>-objectname = 'ORDERADM_H'.
<fs_fields>-ref_kind = 'A'.
<fs_fields>-fieldname = 'PROCESS_TYPE'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'OBJECT_ID'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'DESCRIPTION'.
* --PARTNER DATA--
APPEND INITIAL LINE TO <fs_partner> ASSIGNING FIELD-SYMBOL(<fs_partner>).
<fs_partner>-ref_handle = gc_handle_1.
<fs_partner>-display_type = 'BP'.
<fs_partner>-no_type = 'BP'.
<fs_partner>-ref_kind = 'A'.
<fs_partner>-ref_partner_handle = '0000'.
<fs_partner>-partner_no = int_tab-kundeemne.
<fs_partner>-partner_fct = '00000021'.
<fs_partner>-mainpartner = 'X'.
APPEND INITIAL LINE TO <fs_partner> ASSIGNING <fs_partner>.
<fs_partner>-mainpartner = ''.
<fs_partner>-partner_no = int_tab-kontpers.
<fs_partner>-partner_fct = '00000015'.
APPEND INITIAL LINE TO <fs_partner> ASSIGNING <fs_partner>.
<fs_partner>-partner_no = int_tab-amedarb.
<fs_partner>-partner_fct = 'Z0000014'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-objectname = 'PARTNER'.
<fs_fields>-logical_key = '0000'.
<fs_fields>-fieldname = 'PARTNER_FCT'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'PARTNER_NO'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'DISPLAY_TYPE'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'NO_TYPE'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'KIND_OF_ENTRY'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'MAINPARTNER'.
* --OPPORTUNITY DATA--
APPEND INITIAL LINE TO it_opportunity ASSIGNING FIELD-SYMBOL(<fs_opportunity>).
<fs_opportunity>-ref_handle = gc_handle_1.
<fs_opportunity>-startdate = int_tab-start.
<fs_opportunity>-expect_end = int_tab-****.
<fs_opportunity>-probability = int_tab-succes.
<fs_opportunity>-curr_phase = int_tab-aktfas.
<fs_opportunity>-forecast_rel = int_tab-relpro.
<fs_opportunity>-type = int_tab-smgrp.
<fs_opportunity>-importance = int_tab-priori.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-objectname = 'OPPORT_H'.
<fs_fields>-fieldname = 'STARTDATE'.
* --PRICING DATA-
READ TABLE it_opportunity ASSIGNING FIELD-SYMBOL(<fs_opp>) INDEX 1.
*-- Needed to store CURRENCY.
CLEAR it_pricing.
APPEND INITIAL LINE TO it_it_pricing ASSIGNING FIELD-SYMBOL(<fs_pricing>).
<fs_pricing>-REF_HANDLE = 1.
<fs_pricing>-REF_GUID = g_BlankGuid.
<fs_pricing>-REF_KIND = 'A'.
<fs_pricing>-CURRENCY = <fs_opp>-CURRENCY.
<fs_pricing>-CURRENCY_ISO = <fs_opp>-CURRENCY_ISO.
* --OPPORTUNITY DATA--
CLEAR w_status.
w_status-ref_guid = l_opportunity_guid.
w_status-ref_handle = l_count_ref_handle.
w_status-ref_kind = 'A'.
w_status-status = 'E0001'.
w_status-user_stat_proc = 'ZOPPRSTU'.
w_status-activate = 'X'.
APPEND w_status TO t_status.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-ref_handle = l_count_ref_handle.
<fs_fields>-ref_guid = l_opportunity_guid.
<fs_fields>-ref_kind = 'A'.
<fs_fields>-objectname = 'STATUS'.
CONCATENATE w_status-status w_status-user_stat_proc INTO <fs_fields>-logical_key.
<fs_fields>-fieldname = 'STATUS'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'USER_STAT_PROC'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'ACTIVATE'.
CALL FUNCTION 'BAPI_OPPORTUNITY_CREATEMULTI'
EXPORTING
TESTRUN = ' '
TABLES
HEADER = it_header
OPPORTUNITY = it_opportunity
PARTNER = it_partner
PRICING = it_pricing
INPUT_FIELDS = it_input_fields
RETURN = return
ITEM = it_item
STATUS = w_status.
* Opportunity will not appear until you commit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = abap_true.
同时查看报告 CRM_REPORT_CREATE_MASS_OPPT
。
使用 tcode /ncrmd_BUS2000111
你可以在 GUI 模式下创造机会。
关心什么
where exactly I can find the above fields(Accounts, Opportunity, Cases, etc like in Salesforce) in SAP CRM
它们都存储在 CRM 表中,大概是 CRMD_ORDERADM_H
和 CRMD_ORDERADM_I
,并且 CRM 中的所有业务对象操作都是通过 WebUI 进行的。如果左边有合适的business role (e.g. SALESPRO
) you will find opportunity in the navigation bar。
我是Java开发人员,对SAP CRM还比较陌生,但是当前项目的需求要求我对SAP CRM系统有一个基本的了解。我想知道我可以在哪个工具上找到 SAP 中的客户、机会、潜在客户等。如果问题不完整,请问我适当的问题,我会尽力解释。
我已经看过多个视频和教程,但没有任何帮助,代码目前不可用
我希望有人告诉我在 SAP CRM 中我可以在哪里找到上述字段(客户、机会、案例等,如在 Salesforce 中)。
为此使用 BAPI_OPPORTUNITY_CREATEMULTI
,并且不要忘记在 BAPI 之后 运行 提交,否则您的机会将不会出现在表格中。这是示例:
DATA: return TYPE TABLE OF BAPIRET2 WITH HEADER LINE,
it_opportunity TYPE BAPIBUS20001_OPPORTUNITY,
it_header TYPE BAPIBUS20001_HEADER_INS,
it_item TYPE BAPIBUS20001_ITEM,
it_input_fields TYPE BAPIBUS20001_INPUT_FIELDS,
it_pricing TYPE BAPIBUS20001_PRICING,
<fs_partner> TYPE BAPIBUS20001_PARTNER_INS,
w_status TYPE BAPIBUS20001_STATUS_INS.
* gc_handle_1 is used for an item to bind it to a opportunity and gc_handle_2 is used to bind the information for an item to an item.
CONSTANTS: gc_handle_1 TYPE crmt_handle VALUE '0000000001',
gc_handle_2 TYPE crmt_handle VALUE '0000000002'.
* --ITEM DATA--
APPEND INITIAL LINE TO it_item ASSIGNING FIELD-SYMBOL(<fs_item>).
<fs_item>-mode = 'A'.
<fs_item>-ordered_prod = int_tab-produkt. "your product
<fs_item>-itm_type = 'ZOPT'.
<fs_item>-handle = gc_handle_2. "Identification of this item
<fs_item>-header_handle = gc_handle_1. "Refers to the opportunity for which this item is for.
APPEND INITIAL LINE TO it_input_fields ASSIGNING FIELD-SYMBOL(<fs_fields>).
<fs_fields>-ref_handle = gc_handle_2. "Refers to the item for which this information is for
<fs_fields>-objectname = 'ORDERADM_I'.
<fs_fields>-ref_kind = 'B'.
<fs_fields>-fieldname = 'ORDERED_PROD'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'ITM_TYPE'.
CLEAR return.
* --HEADER DATA --
APPEND INITIAL LINE TO it_header ASSIGNING FIELD-SYMBOL(<fs_header>).
<fs_header>-guid = ''.
<fs_header>-handle = gc_handle_1. "Identification of this opportunity
CONCATENATE 'Konv: ' int_tab-betegnelse INTO <fs_header>-description SEPARATED BY space.
<fs_header>-process_type = 'ZOPP'.
<fs_header>-descr_language = 'K'.
<fs_header>-langu_iso = 'DA'.
<fs_header>-posting_date = sy-datum.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-ref_handle = gc_handle_1.
<fs_fields>-objectname = 'ORDERADM_H'.
<fs_fields>-ref_kind = 'A'.
<fs_fields>-fieldname = 'PROCESS_TYPE'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'OBJECT_ID'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'DESCRIPTION'.
* --PARTNER DATA--
APPEND INITIAL LINE TO <fs_partner> ASSIGNING FIELD-SYMBOL(<fs_partner>).
<fs_partner>-ref_handle = gc_handle_1.
<fs_partner>-display_type = 'BP'.
<fs_partner>-no_type = 'BP'.
<fs_partner>-ref_kind = 'A'.
<fs_partner>-ref_partner_handle = '0000'.
<fs_partner>-partner_no = int_tab-kundeemne.
<fs_partner>-partner_fct = '00000021'.
<fs_partner>-mainpartner = 'X'.
APPEND INITIAL LINE TO <fs_partner> ASSIGNING <fs_partner>.
<fs_partner>-mainpartner = ''.
<fs_partner>-partner_no = int_tab-kontpers.
<fs_partner>-partner_fct = '00000015'.
APPEND INITIAL LINE TO <fs_partner> ASSIGNING <fs_partner>.
<fs_partner>-partner_no = int_tab-amedarb.
<fs_partner>-partner_fct = 'Z0000014'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-objectname = 'PARTNER'.
<fs_fields>-logical_key = '0000'.
<fs_fields>-fieldname = 'PARTNER_FCT'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'PARTNER_NO'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'DISPLAY_TYPE'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'NO_TYPE'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'KIND_OF_ENTRY'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'MAINPARTNER'.
* --OPPORTUNITY DATA--
APPEND INITIAL LINE TO it_opportunity ASSIGNING FIELD-SYMBOL(<fs_opportunity>).
<fs_opportunity>-ref_handle = gc_handle_1.
<fs_opportunity>-startdate = int_tab-start.
<fs_opportunity>-expect_end = int_tab-****.
<fs_opportunity>-probability = int_tab-succes.
<fs_opportunity>-curr_phase = int_tab-aktfas.
<fs_opportunity>-forecast_rel = int_tab-relpro.
<fs_opportunity>-type = int_tab-smgrp.
<fs_opportunity>-importance = int_tab-priori.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-objectname = 'OPPORT_H'.
<fs_fields>-fieldname = 'STARTDATE'.
* --PRICING DATA-
READ TABLE it_opportunity ASSIGNING FIELD-SYMBOL(<fs_opp>) INDEX 1.
*-- Needed to store CURRENCY.
CLEAR it_pricing.
APPEND INITIAL LINE TO it_it_pricing ASSIGNING FIELD-SYMBOL(<fs_pricing>).
<fs_pricing>-REF_HANDLE = 1.
<fs_pricing>-REF_GUID = g_BlankGuid.
<fs_pricing>-REF_KIND = 'A'.
<fs_pricing>-CURRENCY = <fs_opp>-CURRENCY.
<fs_pricing>-CURRENCY_ISO = <fs_opp>-CURRENCY_ISO.
* --OPPORTUNITY DATA--
CLEAR w_status.
w_status-ref_guid = l_opportunity_guid.
w_status-ref_handle = l_count_ref_handle.
w_status-ref_kind = 'A'.
w_status-status = 'E0001'.
w_status-user_stat_proc = 'ZOPPRSTU'.
w_status-activate = 'X'.
APPEND w_status TO t_status.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-ref_handle = l_count_ref_handle.
<fs_fields>-ref_guid = l_opportunity_guid.
<fs_fields>-ref_kind = 'A'.
<fs_fields>-objectname = 'STATUS'.
CONCATENATE w_status-status w_status-user_stat_proc INTO <fs_fields>-logical_key.
<fs_fields>-fieldname = 'STATUS'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'USER_STAT_PROC'.
APPEND INITIAL LINE TO it_input_fields ASSIGNING <fs_fields>.
<fs_fields>-fieldname = 'ACTIVATE'.
CALL FUNCTION 'BAPI_OPPORTUNITY_CREATEMULTI'
EXPORTING
TESTRUN = ' '
TABLES
HEADER = it_header
OPPORTUNITY = it_opportunity
PARTNER = it_partner
PRICING = it_pricing
INPUT_FIELDS = it_input_fields
RETURN = return
ITEM = it_item
STATUS = w_status.
* Opportunity will not appear until you commit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = abap_true.
同时查看报告 CRM_REPORT_CREATE_MASS_OPPT
。
使用 tcode /ncrmd_BUS2000111
你可以在 GUI 模式下创造机会。
关心什么
where exactly I can find the above fields(Accounts, Opportunity, Cases, etc like in Salesforce) in SAP CRM
它们都存储在 CRM 表中,大概是 CRMD_ORDERADM_H
和 CRMD_ORDERADM_I
,并且 CRM 中的所有业务对象操作都是通过 WebUI 进行的。如果左边有合适的business role (e.g. SALESPRO
) you will find opportunity in the navigation bar。