cancel
Showing results for 
Search instead for 
Did you mean: 

Create warranty for IBASE individual product in CRM_EQUI_LOAD badi

Former Member
0 Kudos

Hi Experts,

  We are trying to create Ibase individual product for an Equipment which is replicating from ECC. we are able to create ibase using CRM_EQUI_LOAD badi but here the problem is we are not able to add warranty through this badi.

we have only few warranty products in CRM like WTY_12, WTY_18 etc. This warranty product should add to ibase individual object as warranty.

With using CRM_IBCWTY_IL_API_CREATE function module we are trying to add this warranty.

*here is the Code

ls_product_id = 'WTY_12'"Default warranty product
SELECT SINGLE product_guid FROM comm_product INTO ls_warranty_guid
          WHERE  product_id = ls_product_id.

   is_interlinkage_to_create-warranty_guid ls_warranty_guid.
    is_interlinkage_to_create-start_date    LV_WFDATE. "warranty start date
   * is_interlinkage_to_create-START_DATE_RULE = ' '.
    is_interlinkage_to_create-end_date      LV_WTDATE. "warranty end date
    is_interlinkage_to_create-END_DATE_RULE = 'WTY001'.
    is_interlinkage_to_create-determine_dates = 'X'.

   append is_interlinkage_to_create to it_interlinkage_to_create.
   CLEAR is_interlinkage_to_create.


   lv_object_reference = '04'. "individual object
  lv_object_guid = ls_comp-guid_compc. "guid of ibase.


CALL FUNCTION 'CRM_IBCWTY_IL_API_CREATE'
   EXPORTING
     IV_OBJECT_GUID                  = lv_object_guid
     IV_OBJECT_REFERENCE             = lv_object_reference
*    IV_TIMESTAMP                    =
*    IV_ENQMODE                      = 'E'
*   IV_RAISE_EXCEPTION              = ' '
*    IV_SAVE                         = 'X'
     IT_INTERLINKAGE_TO_CREATE       = it_interlinkage_to_create
  IMPORTING
    ET_MESSAGES                     = it_messages
    ET_INTERLINKAGE                 = it_interlinkage
  EXCEPTIONS
    ERROR_OCCURRED                  = 1
    OTHERS                          = 2
           .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.


with this code we are not able to adding the warranty. Please help me in this. Thank you.


One more thing I have created a custom implementation for CRM_EQUI_LOAD badi and this custom implementation is in active and standard implementation is in inactive. should I activate standard one also or not. Thank you.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Experts,

Please help us for this issue. We are struck up on this issue from 2weeks.

we are trying to create relationship also. please check following code once.

CALL FUNCTION 'GUID_CREATE'
  IMPORTING
    EV_GUID_16       = il_guid
*   EV_GUID_22       =
*   EV_GUID_32       =
           .


ls_ildata-ILGUID = il_guid. "Relationship Guid
ls_ildata-SOURCEGUID = ls_comp-GUID_COMPC. "Ibase GUID
ls_ildata-DESTINGUID = ls_warranty_guid."Warranty Product(WTY_12) GUID
ls_ildata-RELTYPE = lv_reltype." IOBWTY for Individual object
ls_ildata-LOGSYS = ls_equit-LOGSYS. "ECC logsys
ls_ildata-START_DATE = lv_wfdate. "YYYYMMDDTTMMSS
ls_ildata-START_DATE_RULE = ''.
ls_ildata-END_DATE = lv_wtdate. "YYYYMMDDTTMMSS
ls_ildata-END_DATE_RULE = 'WTY001'.
append ls_ildata to it_ildata.
CLEAR ls_ildata.

CALL FUNCTION 'COM_IL_API_CREATE'
   EXPORTING
     IV_RELTYPE               = lv_reltype
*   IV_ENQMODE               = 'E'
*   IV_RAISE_EXCEPTION       = ' '
     IT_ILDATA                = it_ildata
*   IV_NO_CHECK              = ' '
  IMPORTING
    ET_INTERLINKAGE          = it_inter_w
    ET_MESSAGES              = it_message_w
  EXCEPTIONS
    LOCK_FAILED              = 1
    OTHERS                   = 2
           .
IF SY-SUBRC EQ 0.
ENDIF.

But It's throwing following errors.

Relationship type &1 for source object type &2 cannot be maintained

Object entered for this relationship type is not supported


Please help me. help will be highly appreciated.. Thank you.

former_member186543
Active Contributor
0 Kudos

Hi Vijay,

The relationship IOBWTY has to be between two products, so the source and destination guids have to be of the iobject( equipment product ), the error you have mentioned below is thrown in the FM : CRM_IL_WTY_IBCWTY_CHECK ( Please debug here ).

/Hasan

Former Member
0 Kudos

Hi Rafiq,

  Thank you, what is the ILGUID here. with the about code i am getting

Object entered for this relationship type is not supported error.


Thank you..

former_member186543
Active Contributor
0 Kudos

Hi Vijay,

You can leave the ILGUID and a possible reason that you are getting this error could be that either the source guid or the destination guid is not of the product.

Please debug through the performs in CRM_IL_WTY_IBCWTY_CHECK. This FM checks and throws the error Object entered for this relationship type is not supported error.

/Hasan

former_member186543
Active Contributor
0 Kudos

Hi Vijay,

The standard implementation of this badi has the feature of adding warranty data as you have added in ECC, since the standard FM used in this implementation : CRM_CREATE_OBJECT_FROM_EQUI , has the code to add warranty.


IF gc_warrenty_load IS NOT INITIAL.

         PERFORM set_warrenty_data

           USING it_equi_dmbdoc

           CHANGING ls_message_ext

                    ct_error_segments.

       ENDIF.

This code gets triggered if the table SMOFTABLES has an entry for

OBJNAME           SUBOBJNAME      R3TABNAME

EQUIPMENT                                      BGMKOBJ

/Hasan

Former Member
0 Kudos

Hi Rafiq,

  Thank you for your reply.

I have copied the standard implimentation to custom implementation only so

CRM_CREATE_OBJECT_FROM_EQUI this FM is available in that implementation.

CRM_CREATE_OBJECT_FROM_EQUI in this function module gc_warrenty_load is initial so its not able add warranty data. Please help me in this issue. Thank you.

  We have an entry in SMOFTABLES table for OBJNAME - EQUIPMENT.

.

former_member186543
Active Contributor
0 Kudos

Hi Vijay,

Under T-Code r3ac1 , for the object EQUIPMENT please see that the table entry BGMKOBJ should not be inactive.

/Hasan

Former Member
0 Kudos

Hi Rafiq,

  We made it to ilnactive stage. Now i am able to go in that perform to add warranty.

But still we are unable to adding warranty for IBASE individual object.

In perform  set_warrenty_data we have a function module called  CRM_ADD_WARRENTY_TO_IOBJ .

In this FM we have a perform  get_single_warrenty, with using system is picking destination guid.

but in my case its coming empty so we are unable to go further.

We even went into that perform and debugged it. Following fm system is using to fetch the warranties for that product guid. but lt_warrenties is empty.

CALL FUNCTION 'CRM_PRDWTY_IL_API_READ'
     EXPORTING
       iv_product_guid      = p_product_guid
       iv_org_filter        = 'X'
       iv_sales_org         = p_sales_org
       iv_distribution_chan = p_distribution_channel
     IMPORTING
       et_interlinkages     = lt_warrenties
     EXCEPTIONS
       OTHERS               = 2.

Can you pls tell us what are ILGUID, SourceGUID and DestGUID.

former_member186543
Active Contributor
0 Kudos

Hi Vijay,

Yes for warranties to replicate from ECC to CRM, it's a totally different concept as compared between ECC and CRM. A reference product(PRODREF acts as a template) has to be linked with the equipment in ECC, also either a customer or a vendor warranty is attached to the equipment in ECC which flows to CRM.

The FM you wrote above : CRM_PRDWTY_IL_API_READ , is then used to read the warranties from the reference product(PRODREF) , the fetched warranty from the reference product is added to the equipment iobject in the ibase.

Anyhow, since your system doesn't seem to be set that way so you have to follow the custom logic as you are already doing.

I have replied below on the code thread, please see !

/Hasan