cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Creating Report for Quotation in CRM

former_member549938
Participant
0 Kudos

Hello Friends,

I need to Develop an RFC function module to create Quotation.

Kindly help me in developing it by specifying BAPI s used to create the requirement in CRM.

Thank You For Up Coming Help.

Regards,

Tejaswy.

Accepted Solutions (1)

Accepted Solutions (1)

robert_kunstelj
Active Contributor
0 Kudos

You can use CRM_ORDER_MAINTAIN. There are planty of code samples for this fm.

former_member549938
Participant
0 Kudos

Thanq Robest For You Help and can you please specify the code example for creating quotation using CRM_ORDER_MAINTAIN.

It would be more helpful.

robert_kunstelj
Active Contributor
0 Kudos

This is working sample that I'm using in one of my programs...

  • Header

ls_orderadm_h-handle = '0000000001'.

ls_orderadm_h-process_type = wa_process_type.

ls_orderadm_h-description = st_head-descript.

ls_input_field-ref_handle = 1.

ls_input_field-ref_kind = 'A'.

ls_input_field-objectname = 'ORDERADM_H'.

ls_input_names-fieldname = 'PROCESS_TYPE'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'DESCRIPTION'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

INSERT ls_orderadm_h INTO TABLE lt_orderadm_h.

CLEAR: ls_input_field, ls_input_names.

*Partner

ls_partner-ref_handle = '0000000001'.

ls_partner-ref_kind = 'A'.

ls_partner-kind_of_entry = 'C'.

ls_partner-no_type = 'BP'.

ls_partner-display_type = 'BP'.

ls_partner-ref_partner_handle = '0001'.

ls_partner-partner_no = wa_partner_21.

ls_partner-partner_fct = '00000001'.

ls_input_field-ref_handle = 1.

ls_input_field-ref_kind = 'A'.

ls_input_field-logical_key = '0001'.

INSERT ls_partner INTO TABLE lt_partner.

ls_input_field-objectname = 'PARTNER'.

ls_input_names-fieldname = 'PARTNER_NO'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'PARTNER_FCT'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'KIND_OF_ENTRY'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'DISPLAY_TYPE'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'NO_TYPE'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

  • Sales

ls_sales-ref_handle = '0000000001'.

ls_sales-ref_kind = 'A'.

IF st_head-deldate = '00000000'.

ls_sales-req_dlv_date = t_appointment-timestamp_from.

ELSE.

CONVERT DATE st_head-deldate

TIME sy-uzeit INTO

TIME STAMP ls_sales-req_dlv_date

TIME ZONE tz.

ENDIF.

ls_sales-cust_group3 = st_head-cust_group3.

ls_input_field-ref_handle = 1.

ls_input_field-ref_kind = 'A'.

ls_input_field-objectname = 'SALES'.

ls_input_names-fieldname = 'PO_NUMBER_SOLD'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'REQ_DLV_DATE'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'CUST_GROUP3'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

"----


INSERT ls_input_field INTO TABLE lt_input_field.

INSERT ls_sales INTO TABLE lt_sales.

CLEAR: ls_input_field, ls_input_names.

  • Pricing

ls_pricing-ref_handle = '0000000001'.

ls_pricing-ref_kind = 'A'.

ls_pricing-currency = st_head-currency.

ls_input_field-ref_handle = 1.

ls_input_field-ref_kind = 'A'.

ls_input_field-objectname = 'PRICING'.

ls_input_names-fieldname = 'CURRENCY'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

INSERT ls_pricing INTO TABLE lt_pricing.

CLEAR: ls_input_field, ls_input_names.

  • Orgman

ls_orgman-ref_handle = '0000000001'.

ls_orgman-ref_kind = 'A'.

ls_orgman-dis_channel = wa_dis_channel.

ls_orgman-sales_org = wa_sales_org.

ls_orgman-sales_office = wa_sales_office.

ls_orgman-sales_group = wa_sales_group.

ls_orgman-sales_org_resp = wa_sales_org_resp.

ls_input_field-ref_handle = 1.

ls_input_field-ref_kind = 'A'. "gc_object_ref_kind-orderadm_h.

ls_input_field-objectname = 'ORGMAN'. "gc_object_name-partner.

ls_input_names-fieldname = 'SALES_ORG'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'SALES_OFFICE'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'SALES_GROUP'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'SALES_ORG_RESP'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'DIS_CHANNEL'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

INSERT ls_orgman INTO TABLE lt_orgman.

CLEAR: ls_input_field, ls_input_names,

wa_sales_group,

wa_sales_org,

wa_sales_office,

wa_sales_org_resp,

wa_dis_channel.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • --------- append for item -----------------------------

LOOP AT st_head-t_item INTO it_item.

TRANSLATE it_item-techdata TO UPPER CASE.

CLEAR index.

stevec = stevec + 1.

  • Items

ls_orderadm_i-handle = stevec.

ls_orderadm_i-header_handle = '0000000001'.

ls_orderadm_i-zzorderadm_i0901 = it_item-specitem.

ls_orderadm_i-zzorderadm_i0902 = it_item-integration.

ls_orderadm_i-ordered_prod = it_item-product.

INSERT ls_orderadm_i INTO TABLE lt_orderadm_i.

CLEAR: ls_orderadm_i.

  • Quontity

IF index = 1.

ls_schedlin_i-ref_handle = stevec.

ls_crmt_schedlin_extd-quantity = 1.

INSERT ls_crmt_schedlin_extd INTO TABLE ls_schedlin_i-schedlines.

INSERT ls_schedlin_i INTO TABLE lt_schedlin_i.

CLEAR: ls_crmt_schedlin_extd-quantity, ls_schedlin_i-schedlines.

ELSE.

ls_schedlin_i-ref_handle = stevec.

ls_crmt_schedlin_extd-quantity = it_item-quantity.

INSERT ls_crmt_schedlin_extd INTO TABLE ls_schedlin_i-schedlines.

INSERT ls_schedlin_i INTO TABLE lt_schedlin_i.

CLEAR: ls_crmt_schedlin_extd-quantity, ls_schedlin_i-schedlines.

ENDIF.

  • Priceing condition

IF it_item-value IS NOT INITIAL.

ls_cond-kschl = 'PR00'.

ls_cond-kbetr = it_item-value.

ls_cond-waers = st_head-currency.

INSERT ls_cond INTO TABLE ls_pridoc_com-cond_add.

index_2 = 1.

CLEAR: ls_cond.

ENDIF.

IF it_item-discount IS NOT INITIAL.

ls_cond-kschl = 'ZPPP'.

wa_procent_calc = it_item-discount * 10.

ls_cond-kbetr = wa_procent_calc."it_item-discount.

ls_cond-waers = '%'."st_head-currency.

INSERT ls_cond INTO TABLE ls_pridoc_com-cond_add.

index_2 = 1.

CLEAR: ls_cond, wa_procent_calc.

ENDIF.

IF index_2 = 1.

ls_pridoc_com-ref_handle = stevec.

ls_pridoc_com-ref_kind = 'B'.

INSERT ls_pridoc_com INTO TABLE gt_pridoc_com.

CLEAR: index_2,ls_pridoc_com.

ENDIF.

  • Main Item table

ls_input_field-ref_handle = stevec.

ls_input_field-ref_kind = 'B'.

ls_input_field-objectname = 'ORDERADM_I'.

ls_input_names-fieldname = 'ZZORDERADM_I0901'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'ZZORDERADM_I0902'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'ORDERED_PROD'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'ZZORDERADM_I0903'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

CLEAR: ls_input_field, ls_input_names.

  • schedelin -> quantity

ls_input_field-ref_handle = stevec.

ls_input_field-ref_kind = 'B'.

ls_input_field-objectname = 'SCHEDLIN'.

ls_input_names-fieldname = 'QUANTITY'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

CLEAR: ls_input_field, ls_input_names.

  • status items

IF index_stat = 1.

ls_input_field-ref_handle = stevec.

ls_input_field-ref_kind = 'B'.

ls_input_field-objectname = 'STATUS'. "Table

ls_input_names-fieldname = 'USER_STAT_PROC'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

ls_input_names-fieldname = 'ACTIVATE'.

INSERT ls_input_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_field.

CLEAR: ls_input_field, ls_input_names, index_stat.

ENDIF.

CLEAR: ls_input_field, ls_input_names.

ENDIF.

ENDLOOP.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

it_sales = lt_sales "Header

it_pricing = lt_pricing "Header

it_schedlin_i = lt_schedlin_i "Item

it_pridoc = gt_pridoc_com "Item

it_orgman = lt_orgman "Header

it_partner = lt_partner "Header

it_appointment = gt_appointment "Header

it_status = lt_status "Item

CHANGING

ct_orderadm_h = lt_orderadm_h "Header

ct_orderadm_i = lt_orderadm_i "Item

ct_input_fields = lt_input_field "Input field name for changing

EXCEPTIONS

error_occurred = 1

document_locked = 2

no_change_allowed = 3

no_authority = 4

OTHERS = 5.

  • Get guids

LOOP AT lt_orderadm_h INTO gs_orderadm_h.

INSERT gs_orderadm_h-guid INTO TABLE gt_obj_guids.

ENDLOOP.

CALL FUNCTION 'CRM_ORDER_SAVE'

EXPORTING

it_objects_to_save = gt_obj_guids

EXCEPTIONS

document_not_saved = 1

OTHERS = 2.

COMMIT WORK.

former_member549938
Participant
0 Kudos

Thanks Alot Robert for your help.

former_member549938
Participant
0 Kudos

Hello Robert,

Can you please specify the structures or tables useful to create quotation which you have used.

Thanks For Up Coming Help.

Regards,

Tejaswy.

robert_kunstelj
Active Contributor
0 Kudos

*"----


""Local Interface:

*" IMPORTING

*" VALUE(S_IMPOHEAD) TYPE ZIMPOHEAD

*" EXPORTING

*" VALUE(TY_LOG_TAB) TYPE ZINTF_TAB

*"----


TABLES: crmd_orderadm_h

.

DATA:

it_et_partner TYPE crmt_partner_external_wrkt,

t_et_partner LIKE it_et_partner WITH HEADER LINE,

it_orgman TYPE crmt_orgman_wrkt,

t_orgman LIKE it_orgman WITH HEADER LINE,

t_header_guid TYPE crmt_object_guid_tab,

v_header_guid TYPE crmt_object_guid,

it_header_guid LIKE t_header_guid WITH HEADER LINE,

it_orderadm_h TYPE crmt_orderadm_h_wrkt,

t_orderadm_h LIKE it_orderadm_h WITH HEADER LINE,

it_opport_h TYPE crmt_opport_h_wrkt,

t_opport_h LIKE it_opport_h WITH HEADER LINE,

t_opport_h_2 LIKE it_opport_h WITH HEADER LINE,

it_appointment TYPE crmt_appointment_wrkt,

t_appointment LIKE it_appointment WITH HEADER LINE

.

  • field-symbols: <gf_opport> type it_opport_h.

DATA: st_head TYPE zimpoffitthead,

it_head LIKE TABLE OF st_head WITH HEADER LINE,

st_item TYPE zimpoffititem,

it_item LIKE TABLE OF st_item WITH HEADER LINE.

DATA: wa_guid TYPE crmd_orderadm_h-guid,

wa_partner_02 LIKE t_et_partner-partner_no,

wa_partner_03 LIKE t_et_partner-partner_no,

wa_partner_04 LIKE t_et_partner-partner_no,

wa_partner_11 LIKE t_et_partner-partner_no,

wa_partner_14 LIKE t_et_partner-partner_no,

wa_partner_21 LIKE t_et_partner-partner_no,

wa_partner_35 LIKE t_et_partner-partner_no,

wa_orgman_guid LIKE t_et_partner-ref_guid,

wa_dis_channel LIKE t_orgman-dis_channel,

wa_sales_org LIKE t_orgman-sales_org,

wa_sales_office LIKE t_orgman-sales_office,

wa_sales_group LIKE t_orgman-sales_group,

wa_sales_org_resp LIKE t_orgman-sales_org_resp,

wa_stamp TYPE crmt_date_timestamp_to,

wa_process_type LIKE t_orderadm_h-process_type,

tz TYPE ttzz-tzone VALUE 'CET',

wa_procent_calc LIKE zimpoffititem-discount,

stevec TYPE i VALUE 0,

index TYPE i VALUE 0,

index_2 TYPE i VALUE 0,

index_stat TYPE i VALUE 0,

lv_prod_sales TYPE comv_pr_sales_ot.

.

DATA: ls_orderadm_h TYPE crmt_orderadm_h_com,

lt_orderadm_h TYPE crmt_orderadm_h_comt,

ls_orderadm_i TYPE crmt_orderadm_i_com,

lt_orderadm_i TYPE crmt_orderadm_i_comt,

ls_partner TYPE crmt_partner_com,

lt_partner TYPE crmt_partner_comt,

ls_sales TYPE crmt_sales_com,

lt_sales TYPE crmt_sales_comt,

ls_pricing TYPE crmt_pricing_com,

lt_pricing TYPE crmt_pricing_comt,

ls_orgman TYPE crmt_orgman_com,

lt_orgman TYPE crmt_orgman_comt,

ls_pridoc_com TYPE crmt_pridoc_com,

lt_pridoc_com TYPE crmt_pridoc_comt,

  • ls_cond TYPE prct_cond_external_change, " change pricing conditions

ls_cond TYPE prct_cond_external_input, " add pricing conditions

gt_pridoc_com TYPE crmt_pridoc_comt,

ls_schedlin_i TYPE crmt_schedlin_i_com,

lt_schedlin_i TYPE crmt_schedlin_i_comt,

ls_crmt_schedlin_extd TYPE crmt_schedlin_extd,

ls_input_field TYPE crmt_input_field,

lt_input_field TYPE crmt_input_field_tab,

ls_input_names TYPE crmt_input_field_names,

lt_input_names TYPE crmt_input_field_names_tab,

gt_obj_guids TYPE crmt_object_guid_tab,

gs_orderadm_h TYPE crmt_orderadm_h_com,

ls_status TYPE crmt_status_com,

lt_status TYPE crmt_status_comt,

len_of_desc TYPE i,

ls_orgman_wrk TYPE crmt_orgman_wrk

.

DATA:

con_a_guid TYPE crmt_object_guid,

con_b_guid TYPE crmt_object_guid,

con_header_guid TYPE crmt_object_guid.

DATA: dat_ty1 TYPE crmt_dates_type VALUE 'ZREQ_DLV_DAT',

date_1 TYPE sydatum,

ls_date TYPE crmt_appointment_com,

gt_appointment TYPE crmt_appointment_comt

.

.

  • deklaracij za preverjanje statusa

DATA: lv_status_open TYPE crmt_boolean,

lv_status_in_process TYPE crmt_boolean.

  • Dklaracija za datume.

DATA: ls_logical_date_key TYPE crmt_date_logical_date_key,

lv_ref_kind TYPE crmt_object_kind,

wa_date_wrk TYPE crmt_date_wrk.

former_member549938
Participant
0 Kudos

Thanks Alot Robert.

former_member549938
Participant
0 Kudos

Hello Robert,

While I am trying to pass the import and export parameters types ZIMPOHEAD and ZINTF_TAB,In CRM Ehp1 SE37 for creating RFC it is saying doesnt exist. What must be the problem behind declaring them in associated type.

Regards,

Tejaswy.

robert_kunstelj
Active Contributor
0 Kudos

That is because these are my Z structures which I fill when passing data from external system. You must create your own Z structure according to your needs or replace Z structure with some internal table.

former_member549938
Participant
0 Kudos

Ok Robert.

former_member549938
Participant
0 Kudos

Hello Robert,

And more over we have configuration problem in our firm regarding products.

So we dnt have feasibility to test the code.

But they gave me task to write the code for developing RFC in creating quotation.

We are completely new to crm we are diving ourseleves in learing them.

Kindly help me solving my problem.

Please kindly specify the structures which you have created.

Best Regards,

Tejaswy.

robert_kunstelj
Active Contributor
0 Kudos

I sent you structures and table definitions on e-mail.

former_member549938
Participant
0 Kudos

THANKS ALOT ROBERT.

I GOT YOUR MAIL.

BUT WHAT ABOUT ZSALES_SOLUTION,ZZPORTS,ZIMPOITEM,ZSPEC_ITEM,SINTEGRATION,ZTECH_VALUE.

former_member549938
Participant
0 Kudos

Hello Robert,

What does "Replace Z field types with standard types that have the same data type." means .

Thank you for up coming help.

Regards,

Tejaswy.

former_member549938
Participant
0 Kudos

Hello Robert,

In ZIMPOFFITITEM structure , while I am trying to create QUANTITY , as it was not visible in your mail i hav searched for the structure crmt_schedlin_q* . but it is saying not exist.

what does the reason behind it.

Waiting for you reply.

Regards,

Tejaswy.

former_member549938
Participant
0 Kudos

Hello Robert ,

I have resolved every thing including creating z standard types that have some data type but regarding Quantity pls specify component type which you have used in

ZIMPOFFITITEM.

Regards,

Tejaswy.

former_member549938
Participant
0 Kudos

Sorry Robert I got the Quantity component type also.

Thanks alot Robert.

former_member549938
Participant
0 Kudos

Hello Robert,

Thanks Alot Sir.

It was very helpful.

Regards,

Tejaswy.

Answers (0)