cancel
Showing results for 
Search instead for 
Did you mean: 

Report to create subopportunity

Former Member
0 Kudos
69

Hi EXPERTS,

i have one requirement that, to write a report program to create subopportunity under one master opportunity and maintain

link between this.

Please help me to solve this?

Thanks in advance,

Saju.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If your requirement is to create a sub-opportunity as a link( either preceding or succeeding) to master opportunity , you can use FM CRM_ORDER_MAINTAIN and fill parameters CT_DOC_FLOW and CT_ORDERADM_H followed by CRM_ORDER_SAVe and COMMIT.

Regards,

Nithish

Edited by: nithish P on Feb 1, 2012 11:06 AM

Former Member
0 Kudos

HI NITISH,

thank u for replying me.

can you guide me that, how to prepare the doc_links itab.

Former Member
0 Kudos

Hi,

Try to create a sub opportunity manually from master opportunity . You can place a break point in crm_order_maintain FM and check how the parameters CT_DOC_FLOW and CT_INPUT_FIELDS are getting filled.Pass the exact parameters in the report program.

clear wa_doc_link 
         wa_doc_link-objkey_a  = <master opportunity guid>. 
          wa_doc_link-brel_kind = 'A'. 
          wa_doc_link-brel_mode =' A'. 
          wa_doc_link-reltype   = 'VONA'. 
          wa_doc_link-objkey_b  = < sub opportunity guid> ( since its not available use FM GUID_CREATE ). 
          wa_doc_link-vona_kind  = 'X". 
          APPEND wa_doc_link TO it_doc_link. 

  clear wa_doc_flow. 
     wa_doc_flow-ref_guid   = <master opportunity guid>. 
                wa_doc_flow-ref_kind   = 'A'. 
      wa_doc_flow-doc_link   = it_doc_link. 
      APPEND wa_doc_flow TO it_doc_flow. 

      CLEAR wa_input_fields. 
      wa_input_fields-ref_kind    = 'A'. 
      wa_input_fields-objectname  = 'DOC_FLOW'. 
      wa_input_fields-ref_guid    = <master opportunity guid>. 
      INSERT  wa_input_fields INTO TABLE  it_input_fields.

*****  Populate header details of sub opportunity ***
    wa_field_names-fieldname = 'MODE'.
                    INSERT wa_field_names INTO TABLE it_field_names.

                    CLEAR wa_field_names.
                    wa_field_names-fieldname = 'PROCESS_TYPE'.
                    INSERT wa_field_names INTO TABLE it_field_names.

                  
                    CLEAR wa_input_fields.
                    wa_input_fields-ref_guid    =< sub opportunity guid> 
                    wa_input_fields-ref_kind    = 'A'.
                    wa_input_fields-objectname  = 'ORDERADM_H'.
                    wa_input_fields-field_names = it_field_names.
                    INSERT  wa_input_fields INTO TABLE  it_input_fields.

                    CLEAR : wa_order_h.

                    wa_order_h-mode   = 'A'..
                    wa_order_hprocess_type = 'ZXXX'   < sub oppurtunity process type>.
                    wa_order_h-guid =  < sub opportunity guid> 
.
                    APPEND wa_order_h TO it_order_h.

Pass all parameters to crm_order_maintain followed by crm_order_save (guid <sub oppurtunity>) and bapi_transaction_commit.

Regards,

Nithish

Edited by: nithish P on Feb 1, 2012 2:52 PM

Edited by: nithish P on Feb 1, 2012 2:58 PM