Skip to Content
author's profile photo Former Member
Former Member

Read transfered name value pairs from IPC within my Java Userexits

Dear SAP developers,

I have the following requirement: In my java userexits I would like to read out the header name value pairs which are transfered via the COND_COM_BADI. I think they can be set via the implementation of the method IF_EX_CRM_COND_COM_BADI~HEADER_NAME_VALUE. Can anybody give me a Java code snippet how this is done?

I would guess that there must be some kind of method which returns a Map that contains these name value pairs. But where is this method located?

Greets Ruben

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Aug 11, 2010 at 09:42 AM

    Hi Ruben,

    In your java routine use item.getAttributeValue to read the attribute passed from COND COM BADI.

    public BigDecimal overwriteConditionValue(IPricingItemUserExit item,
    			IPricingConditionUserExit condition) 
    {   
    
    String flag = item.getAttributeValue("ATTR_1");
    }
    

    Also you can refer the coding part of this wiki its a requirement routine,

    http://wiki.sdn.sap.com/wiki/x/s4TYCw

    Regards,

    Arun

    Edited by: Arun Kumar on Aug 11, 2010 11:52 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Ruben,

      1.I dont think you can pass attributes at header level. And all attributes must be assigned only through /SAPCND/UEASS. You have to fill the attribute values in any of the methods HEADER_COMMUNICATION_STRUCTURE or ITEM_COMMUNICATION_STRUCTURE.

      2. You can assign values to different condition types using the below sample code,

      IPricingConditionUserExit[] prSubItems = pricingItem.getUserExitConditions();
      IPricingConditionUserExit iPCondition  = null;
      for (int j = 0; j < prSubItems.length; j++) 
      {	
           if(prSubItems[j].getConditionTypeName() .trim().equalsIgnoreCase("ZC00"))
           {
              iPCondition = (IPricingConditionUserExit) prSubItems[j];
              iPCondition.setConditionRateValue(...)
           }
      }
      

      3. String length is restricted to 50 chars and i wonder why you have to pass the pricing procedure details. You can get the pricing procedure using "pricingItem.getUserExitDocument().getPricingProcedure()"

      Refer these similar threads,

      pass-internal-table-to-ipc-from-abap

      how-to-add-new-field-to-field-catalog-in-pricing

      Regards,

      Arun

      Edited by: Arun Kumar on Aug 11, 2010 7:27 PM

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2010 at 08:47 AM

    Hi Arun,

    thank you very much for your replies. They helped me because when it is only possible to pass a string with the restriction to 50 chars then it does not make sense from my point of view to pass a customizing table via CRM_COND_COM_BADI. Because every time when it is growing I have to create new attributes.

    Now I have got the idea to access this Z-Table via JavaConnector once with the first call and then store this data within a singleton.

    Greets Ruben

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi ,

      I have same requirement to pass multi-valued attributes from CRM_COND_COM_BADI to my IPC Java user exit in which I need to extract all the values as String array.

      I have implemented the same process as you have explained above. But I am not able to retrieve the values in my Java user exit for my custom attributes. All the values are coming as empty list in my String array.

      The steps I have done as below.

      1. Defined the Filed Catalog attribute ZZ_KBETR in maintain field catalog ( Filed type = I, Virtual = A, Selection type = D).

      SPRO->CRM->Basic Functions->Pricing->Maintain Catalog

      2. Click on change mode and New entries.

      3. Enter the custom field with the custom Data type - ZZ_KBETR Data element

      4. Save and generated the field catalog. I could see my custom attribute in the BADI item communication structure.

      5. Implemented the logic to populate multiple values for ZZ_KBETR, in the BADI.

      6. Used the method String zz_kbetr[] = item.getAttributeValues("ZZ_KBETR");

      I am attaching my Field catalog configuration and Java piece of code. Please help me what went wrong as it is very urgent for my Client requirement.

      String ZZKBETR_1[] = pricingItem.getAttributeValues("ZZKBETR_1");

      if(ZZKBETR_1 != null )

      {

      userexitlogger.writeLogDebug(" 935 formula , overwriteConditionValue :: ZZKBETR_1.length=[ "+ZZKBETR_1.length+"]");

      for(int k=0;k<ZZKBETR_1.length;k++)

      {

      try

      {

      userexitlogger.writeLogDebug(" 935 formula , overwriteConditionValue :: ZZKBETR_1["+k+"]= [" + ZZKBETR_1[k] + "] ");

      }

      catch(Exception ex1)

      {

      userexitlogger.writeLogDebug(" 935 formula , overwriteConditionValue :: Error Message=[ "+ex1.getMessage()+"]");

      }

      }

      }

      CRM_COND_COM_BADI - > IF_EX_CRM_COND_COM_BADI~ITEM_NAME_VALUE method Logic as below

      l_seqno = l_seqno + 1.

      is_val-attr_name = 'ZZKBETR_1'.

      is_val-seq_number = l_seqno.

      is_val-attr_value = 'VSE0100'.

      INSERT is_val INTO TABLE ct_item_name_value.

      CLEAR is_val.

      l_seqno = l_seqno + 1.

      is_val-attr_name = 'ZZKBETR_1'.

      is_val-seq_number = l_seqno.

      is_val-attr_value = 'VSE1200'.

      INSERT is_val INTO TABLE ct_item_name_value.


      l_seqno = l_seqno + 1.

      is_val-attr_name = 'ZZKBETR_1'.

      is_val-seq_number = l_seqno.

      is_val-attr_value = 'VSE1300'.

      INSERT is_val INTO TABLE ct_item_name_value.

      Can some body throw light into this, why I am not getting the multi values in Java user exit - Condition Value Formula. In the CRM ABAP debugging I am able to see the multi values for ZZKBETR_1.



      I am able to retrieve the values for CAMPAIGN_GUID in user exit, if I pass multi values from BADI. But I am not at all able to retrieve the multi values for my custom attributes.


      Any kind of help or inputs are highly appreciated and will be rewarded.


      Am I doing some thing wrong at maintain Field catalog configuration. What are the properties/parameters (Field type , Virtual, selection type ) to be provided for custom fields at maintain field catalog.



      Thanks

      Srikar

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.