cancel
Showing results for 
Search instead for 
Did you mean: 

find order GUID from credit memo request

Former Member
0 Kudos

HI Experts,

i have a requirement where i have find order GUID from Credit memo request and fatch customer data generated against order.

we are following this path Oder->confirmation-> invoice-> complaint-> credit memo request.

So from Credit Memo Request i have to find order GIUD. i am only able to find precedr GUID only. i tried with transaction histort (BTDOCFLOW)

but i didn't got much information.

Please Suggest solution, thanks in advance.

Regards

Praveen

Accepted Solutions (1)

Accepted Solutions (1)

deepika_chandrasekar
Active Contributor
0 Kudos

Hi,

You can only get parent document one level up from the current document using DOCFLOW>

You have to take invoice GUID from Complaint then get confirmation doc GUID from invoice GUID then get ORDER GUID from Confirmation doc GUID.

Regards,

Deepika.

Former Member
0 Kudos

Hi Deepika,

thanks for reply, i agreed but can you provide me some sample code for that and i akm also

sending my code.

Regards

Praveen

Former Member
0 Kudos

DATA: lr_entity                TYPE REF TO cl_crm_bol_entity,

         lr_entity_pr             TYPE REF TO cl_crm_bol_entity,

         lr_entity_st             TYPE REF TO cl_crm_bol_entity,

         lr_customer              TYPE REF TO cl_crm_bol_entity,

         lr_mixednode             type ref to  if_bol_bo_property_access,

         obj_name                 TYPE CRMT_EXT_OBJ_NAME,

         obj_key                  TYPE CRMT_GENIL_OBJECT_ID,

         header_guid              TYPE crmt_object_guid,

         ls_header                TYPE CRMST_ADMINH_BTIL,

         ls_orgman                TYPE  CRMST_ORGSET_BTIL,

         lv_process               TYPE  CRMT_PROCESS_TYPE_DB,

         lv_saleapp(14)           type c,

         lv_temp(20)              TYPE c,

         lv_saleorg(14)           TYPE c,

         lv_indus(20)             TYPE c,

         lv_chnl(20)              TYPE c,

         ls_customer              TYPE  CRMST_CUSTOMERH_BTIL,

         ls_customer_h            TYPE  CRMD_CUSTOMER_H,

         ls_partner               TYPE  CRMST_PARTNER_BTIL,

         lv_proc_type             TYPE crmt_process_type,

         lr_access                type ref to if_bol_bo_property_access.

   data :      iv_sale(4) type c,

               lv_buarea(4) type c,

               lv_dept type abtei,

               lv_destinationcrm(10type c,

               iv_profit(10) type c.

   DATA: lv_netvalue TYPE NETWR,

         lv_netval(20type c.

*  if IV_FIRST_TIME = 'X'.

   lr_entity ?= me->TYPED_CONTEXT->BTADMINH->collection_wrapper->get_current( ).

   IF NOT lr_entity IS INITIAL.

     obj_name = lr_entity->get_name( ).

*    if obj_name ne 'BTAdminH' and obj_name ne 'BTOrder'.

     DO.

       if obj_name ne 'BTAdminH' and obj_name ne 'BTOrder'.

         lr_entity_pr ?= lr_entity->get_parent( ).

         IF NOT lr_entity_pr IS INITIAL.

           obj_name = lr_entity_pr->get_name( ).

           if obj_name = 'BTAdminH' or obj_name = 'BTOrder'.

             lr_entity = lr_entity_pr.

             CLEAR : lr_entity_pr.

           ELSE.

             EXIT.

           endif.

         else.

           CLEAR lr_entity_pr.

           EXit.

         ENDIF.

       else.

         CLEAR lr_entity_pr.

         EXit.

       ENDIF.

     enddo.

     """"""""""""""""""""""""""""""""""""""""""""""""""""""

     if LR_ENTITY is BOUND.

       """""""Read the Header Details """"""""""""""""""""""""""

       CALL METHOD LR_ENTITY->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES

         IMPORTING

           ES_ATTRIBUTES = ls_header.

       if ls_header is NOT INITIAL.

         """"""""""""""Read the Org DAta""""""""""""""""

         CALL METHOD LR_ENTITY->GET_RELATED_ENTITY

           EXPORTING

             IV_RELATION_NAME = 'BTHeaderOrgmanSet'

*           IV_MODE          = NORMAL

           RECEIVING

             RV_RESULT        = lr_entity_pr.

         if lr_entity_pr is BOUND.

           """"""""""""""""""Read the Org Properties""""""""""

           CALL METHOD LR_ENTITY_PR->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES

             IMPORTING

               ES_ATTRIBUTES = ls_orgman.

           CLEAR LR_ENTITY_PR.

           if ls_orgman is NOT INITIAL.

*            """"""""""""To check First level Sales org validation""""""""""""""""

             SELECT SINGLE sales_org

               FROM  zcsgl_sale_org

               INTO  lv_saleorg

               WHERE sales_org = ls_orgman-sales_org.

*            if  lv_saleapp is NOT INITIAL.

             """""""""""Read the Partner Relation"""""""""""""""""

             CALL METHOD LR_ENTITY->GET_RELATED_ENTITY

               EXPORTING

                 IV_RELATION_NAME = 'BTHeaderPartnerSet'

*               IV_MODE          = NORMAL

               RECEIVING

                 RV_RESULT        = lr_entity_pr.

             if lr_entity_pr is BOUND.

               """"""""""""Read the Sold To Party Details"""""""""""""

               CALL METHOD LR_ENTITY_PR->GET_RELATED_ENTITY

                 EXPORTING

                   IV_RELATION_NAME = 'BTPartner_00000001'

*                 IV_MODE          = NORMAL

                 RECEIVING

                   RV_RESULT        = lr_entity_st.

               if lr_entity_st is BOUND.

                 CALL METHOD LR_ENTITY_ST->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES

                   IMPORTING

                     ES_ATTRIBUTES = ls_partner.

                 if sy-subrc eq '0' and ( ls_header-process_type eq 'ZFSO'  or ls_header-process_type eq 'ZFSI' or

                     ls_header-process_type eq 'ZPRT' or ls_header-process_type eq 'ZCCM'  OR

                     ls_header-process_type eq 'ZCMR' or ls_header-process_type eq 'ZCCR' ) """"""""Added by Avaneesh on 28/10/2014""

                   and ( ls_partner-REF_PARTNER_NO+0(2) eq '21'  or ls_partner-ref_partner_no+0(2) eq '23' ).

                   """"""""""""To Read & Copy the Previous Order Customer Fields Data"""""""""""""""

                   if lv_saleorg is NOT INITIAL.

                     lr_customer ?= me->typed_context->btcustomerh->collection_wrapper->get_current( ).

                     if ls_header-PREDECESSOR_GUID is NOT INITIAL.

                       SELECT SINGLE PROCESS_TYPE

                                  FROM CRMD_ORDERADM_H

                                  INTO lv_process

                                  WHERE GUID = ls_header-PREDECESSOR_GUID.

                       if ( lv_process eq 'ZFSO'  or lv_process  eq 'ZFSI' or

                              lv_process  eq 'ZPRT' or lv_process  eq 'ZCCM'  or

                               lv_process  eq 'ZCMR' or lv_process  eq 'ZCCR' ) .""""Added on 28/10/2014""""""

                         SELECT SINGLE * from CRMD_CUSTOMER_H

                                INTO ls_customer_h

                                WHERE GUID = ls_header-PREDECESSOR_GUID.

                         CALL METHOD LR_CUSTOMER->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTIES

                           IMPORTING

                             ES_ATTRIBUTES = ls_customer.

dharmakasi
Active Contributor
0 Kudos

Hi Praveen,

You can use BTDocflow entity to find parent of any document. You need to navigate to BTDocflow from BTAdmingH using get related entities and get the parent object guid in field OBJKEY_A refers to the parent document guid and OBJKEY_B refers to the current document guid.

Once you get the paretn guid for one level then use crm_order_read function module to read parent document docflow details and from then take again objkey_a value which will be parent of that document and then go ahead with next orde read fm to get again parent of your document. You have take objkey_a value every time until you get the required document guid.

Best Regards,

Dharmakasi.

Former Member
0 Kudos

Hi Dharm,

Upto Billing document i reached. usually we create billing after confirmation and some time direct from service order. please suggest how to read service cinfirmation or order with respect to billing document.

Regards

Praveen

deepika_chandrasekar
Active Contributor
0 Kudos

Hi,

Use CRM_DOCFLOW_READ_OW FM to read parent document. Pass current document GUID to the FM and get parent document. after you get parent document again call the same FM with parent GUID then get the parent document GUID for that document. You have repeat this till you get ORDER GUID.

objkey_a will have parent document guid.

Regards,

Deepika.

dharmakasi
Active Contributor
0 Kudos

Hi Preveen,

You can use business object type to differentiate confirmation or service order, in btdocflow itself we have a field to business object "OBJTYP_A" refers to parent business object "OBJTYPE_B" holds current object type.

You can check BUS2000116 incase of service order and BUS2000117 incase of confirmation for the objtype field.

Best Regards,

Dharmakasi.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi All, i tried each and every relation, but still problem is remaining. "BTOrderHeaderCustExt."already corrected. still dump.

Regards

Praveen

deepika_chandrasekar
Active Contributor
0 Kudos

it is not BTOrderHeaderCustExt . use BTHeaderCustExt name.

check in genil_model_browser if you want any relation name.

Reagards,

Deepika.

Former Member
0 Kudos

Hi All,

thanks for reply. i have small dought when i bring customer field value from order first time(display mode) customer entity is initial (null reference dump)why?.so i need to click on change button to show those value. after saving its working fine.

Regards

Praveen

dharmakasi
Active Contributor
0 Kudos

Hi Praveen,

While creating document if you do not add any values to custom h context node then system will not create customer_h entity. So the system will have empty reference for customer_h context node.

But now what is your exact issue? can you give further more details about the issue?

Br Dharmakasi.

deepika_chandrasekar
Active Contributor
0 Kudos

In your code if customer_h entity is not bound you have to create customer_h entity from BTadminH entity using create realted entity method and then make changes in that entity.

if lr_custh is not bound.

lr_custh ?= lr_adminh->create_related_entity( iv_relation_name = "BTrderHeaderCustExt" ).

endif.

Regards,

Deepika.

Former Member
0 Kudos

Hi Dharam,

here my admin entity is

lr_entity ?= me->TYPED_CONTEXT->BTADMINH->collection_wrapper->get_current( ).

and my customer entity is.

lr_customer ?= me->typed_context->btcustomerh->collection_wrapper->get_current( ).


lr_custh ?= lr_adminh->create_related_entity( iv_relation_name = "BTrderHeaderCustExt" ).


i tried your code now an defore myself. but system showing dump that  "BTrderHeaderCustExt not supported yet.

i also tried with several relation but none worked. already i paste sample code here. please suggest

how to create customer entity if it is null.

Regards

Praveen

dharmakasi
Active Contributor
0 Kudos

Hi Praveen,

Use the correct relation name. Your missing o in BTOrderHeaderCustExt.

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Praveen,

If you are not sure of relation name check it in GENIL_MODEL_BROWSER and then try.

Regards,

Deepika.