Skip to Content

GetMessageID in CPI

Hi experts,

We have a custom service in C4C which we are calling from CPI. in standard scenarios for ERP-C4C replications; GetMessageID udf is there which works for standard scenarios; How to achieve that for custom scenario's?



Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jul 15, 2020 at 07:36 PM

    Hi Hemant Mathuriya,

    Please find below the reference:

    Hope this helps !

    thanks and regards,

    Praveen T

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Praveen,

      I had tried that but got this error. An internal server error occured: Runtime exception during processing target field mapping /ns0:ScannerAPICreateRequest_sync/BasicMessageHeader/ID. The root message is: Exception:[ groovy.lang.MissingPropertyException: No such property: SAP_MessageProcessingLogID for class: Script3] in class method customFunc



  • Posted on Jul 16, 2020 at 10:51 AM

    Hello Hemanth.

    Below code should help you.

    //Add MappingContext parameter to read or set headers and properties
    def String propertyValCheck(String P1,MappingContext context) {
       String messageID = context.getProperty("SAP_MessageProcessingLogID");
       return messageID


    Sriprasad shivaram Bhat

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Sri,

      Thanks for your response. This code works to get the message ID and i am using formatUUID standard function to format the uuid from Message ID. The issue now is that C4C expects it in format 'hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh'. format UUID just places hyphen at these places, however message ID provided by this code is of 28 characters. In one run,it had hyphen as well, so UUID had 2 hyphens and failed in C4C. Please see below.

      Could you suggest a way to make it so that it matches C4C expectations?



      capture.jpg (27.9 kB)
  • Posted on Jul 21, 2020 at 11:58 AM

    Hello Hemanth,

    Below should generate the same code.

    def extCode = UUID.randomUUID().toString()
    //If you want to get rid of -
    extCode = extCode.replaceAll("-","")


    Sriprasad Shivaram Bhat

    Add a comment
    10|10000 characters needed characters exceeded

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.