Record counter in message mapping

Hi all,
I'm having a multiple IDOCs to 1 file scenario, and structure is like this:
source:
IDOC(1..unbounded)
target:
structure1(1..unbounded)
>field1(1..1)
IDOC is mapped directly to structure1.
for field, I need the number of total IDOC structure sent.
This means, if 3 IDOC are coming, then field1 need to have value "3".
I used the "count" function from the statistic functions, but when I got multiple IDOCs, I'm having a mapping error.
How can I count number of incoming IDOCs in a field inside each structure per IDOC?

Hi Chapa,
After "count" use "CopyValue" (index 0), it will work. FYI [Link1|http://help.sap.com/saphelp_nw04/helpdata/en/26/d22366565be0449d7b3cc26b1bab10/frameset.htm]
Regards,
Raghu_Vamsee

Similar Messages

  • Record count per message

    How do we count the number of records send in a message. the scenario is from FTP to Proxy. No graphical mapping involved. Need to count the number of records that XI processed for a particular message.

    Kumar,
    On receiver end you have proxy's..right? you can code to count number of records  per messages inside proxys. I think this would be the simplest way.
    Nilesh

  • Reset counter in message mapping

    Hi,
    I'm creating several UNH segments from one IDOC and need to reset a counter, used in a subsegment, for each UNH.
    I am using the standard *counter function. Is it possible to reset that counter or do I have to create an own counter? In that case can anyone please help me with that?
    Thank you!
    /Sten

    HI,
    there is a global variable concept in XI which u can use for your Sequence Number concept. And can be reset with the use of UDFs. I doubt if you can reset the Counter API
    If you are on SP14 and above, just take a lookat this blog and the GLOBAL Variables Section
    /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    Thanks
    Swarup

  • UDF issue about record counter

    Hi gurus,
    i want to create the auto-increasing counter for the records in my message mapping.But during my testing,the sequence number always pops up "1" which means it don't calculate based on the cache value. The code as below:
    =========================================================================================
    public String Counter(Container container){
    GlobalContainer gcontainer =  container.getGlobalContainer();
         Object o = gcontainer.getParameter("counter");
          Integer iSeq ;
          if(o == null)
               iSeq = new Integer(1);
          }else
               iSeq = (Integer)o;
               iSeq = new Integer(iSeq.intValue() + 1);
               gcontainer.setParameter("counter",iSeq);
          return iSeq.toString();
    ==========================================================================================
    can anyone shed light on this?
    Thanks in advance.

    Hi rajesh
    anothr smart option.
    in meesage mapping editor under function tab
    add the below code
    Under Attributes and Methods  Integer iSeq ;
    Under init   iSeq = new Integer(0);
    Then UDF:
    public String Counter(Container container){
    iSeq = iSeq+1;
    return iSeq.toString();
    Edited by: Debashish on Jul 15, 2011 9:09 AM

  • Request Message mapping in SXMB_MONI for File - RFC - File without BPM

    Hi ,
    In my File-RFC-File scenario, the messages are processed successfully.
    but when i look into the SXMB_MONI for File to RFC step, the records are present only till the  Message split According to Receiver List and not able to see the records from Request Message mapping step onwards.it contains
    <?xml version="1.0" encoding="UTF-8" ?>
      <ns1:Z_PI_LOTUSNOTES_UNIFORM xmlns:ns1="urn:sap-com:document:sap:rfc:functions" />
    in my mapping for the receiver RFC i have not done the mapping for all the fields. few fields i have disabled. whether this could create a problem in message mapping. pls let me know what needs to be done.

    Is it only for this scenario that the above display issue is occuring or is it for all scenarios?
    If onlt a particular Pipeline steps are displayed then you can check what is the TRACE level set in SXMB_ADM --> Integration Engine Configuration --> and check if the TRACE parameter is set to at least 2 (max is 3 which will ensure that your DB will get full quickly)
    For more information refer: /people/michal.krawczyk2/blog/2005/05/10/xi-i-cannot-see-some-of-my-messages-in-the-sxmbmoni
    Regards,
    Abhishek.

  • Record Count validation - BPM v.s. Message Mapping

    Greetings,
      I've got a file of sales orders coming in from File -> RFC -> File.
    In my incoming file, the final record contains my record count.
    In my outbound file are, of course, the messages from my RFC to create orders.
    In my BPM I receive the inbound file, then use a transformation  to count the number of orders and split them into separate messages so I can loop through them in a block & call the RFC.
    I want to validate my order count against the number of orders listed in my trailer record.  Should I use a switch step in my BPM... or should I use a UDF in my message split? All I want to do... I think... is supress everything coming in and pass a message stating the error... in my outbound file.
    Please advise...
    Doug -

    Hi Doug,
    As pointed by Prabhu, u need to validate it within Mapping...
    However , I am of the opinion that the source system should ensure to send correct record count before passing on to XI....
    Thanks,
    Himadri

  • Filtering of records in Message Mapping

    I am facing problem during filtering record in message mapping. My message comes from R3 and should be sent to one business service in entirety and should also be sent to another business service in part. To resolve this I created a message map for selecting record based on some conditions but this creates empty XML nodes wherever condition is not satisfied. Everything works fine but the scenario fails at the end while trying to convert XML to text using file adapter. The error is ‘Conversion configuration error: Unknown structure '' found in document', probably configuration error in file adapter (XML parser error)’

    Hi Rajesh,
    This scenario you are trying can be done using CONDITIONAL RECEIVER DETERMINATION and RB SPLIT, where you can basically have one sender and two receivers.
    To do this without using a BPM.
    1. Create your mapping program that will map the information from the source file
    into the destination idoc. This has to be a 1:N split. Just make sure that the destination message type and message interface are are of occurrence N.
    2. Also, you will have 2 destination interfaces and 2 interface mapping, one for the IDOC and one for the mail.
    Now, there are a few essential steps in your configuration,
    1. In the receiver determination, specify the 2 receiver systems, one for your IDOC and the other for your MAIL.
    2. Now, you will have a condition window. Just type the condition on the basis of which the receiver has to be determined for the mail and the idoc business system. Just remember that the condition can be specified only for the source message.
    3. In the Interface Determination, you have an option called RB CLASSIC and RB SPLIT. To do a 1:N split, you will have to do a RB_SPLIT.
    And since you wanted to covert the XML format to text format you require content conversion at the receiver adapter end, for that please go through these links below. It clearly explains your requirement.
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    I hope I have answered your query.
    Regards,
    Abhy
    note: do reward points for the helpful answers.

  • Count-Function in Message Mapping

    Hey, trying to map following structures:
    message
    -m1
    --m11
    -m2
    --m22
    -m3
    --m33
    to
    message
    -m1
    --m11
    -m2
    --m22
    -m3
    --m33
    -f1
    --countItems
    The nodes m1,m2 and m3 can appear 1..unbounded. In target structure I would
    like to have the numbers of all nodes (m1,m2,m3).
    For example: In this source structure m1,m2,m3 appear only one time. In the
    field countItems I would like to have the number 3.
    I tried the count function, but it could only count the structure where I used it (in
    this case: f1).
    How can I count the above-mentioned nodes?
    thanks
    chris

    Hey,
    thanks for your answers.
    But I still couldn't understand how to do this. I open the message mapping for field f1, but the count function could only be set on an target-element, so where to set the counters for m1,m2,m3? Do I have to insert extra fields under m1..m3?
    If I do the counter would increment with every node, so if I have two times m1, in second tree of m1 a two will be insert. If I use the add function, only for these two tree the result would be three!
    @Gangisetty Vijaya Bhaskarudu
    Is this just one UDF? From where he knows, which nodes he have to count, if I have more than m1..m3, but only want to count this three?
    @ sasitharan
    same problem as mentioned above:
    this doesn't work:
    m1--count---\
    I can't use m1 as input for count! Or do I have a wrong count function?
    <b>....au damm, answered my own question. Of course. I use COUNTER and you use
    COUNT!!!!!!!!!!!! I will try this with COUNT!!</b>
    thanks
    chris

  • Message Mapping from flat XML to a Record structure

    Hi All,
    We have a scenario in which the input message is a PDF document. we are following below the blog to convert PDF to XML format which uses <b>PDF box utitlity</b>.
    /people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter
    We are able to convert the PDF doc to a flat XML file.
    Now we have the following queries...
    what are the different ways to map the flat XML to our record structure?
    Do we have any utitlity in PDF box to do that?
    Regards,
    Rakesh.

    Hi Rakesh,
    You have Graphical mapping, Java mapping, ABAP mapping and XSLT mapping. The choice depends on the scenario and what target result you require.
    <b>Message mapping using graphical mapping editor:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/frameset.htm
    <b>XSLT mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    <b>Java Mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    <b>ABAP mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/frameset.htm
    As said earlier, graphical mapping is the simplest and quite a few built in options are available with it, explore it and see which is suitable for your scenario.
    Regards,
    Chandra

  • Record count message

    Hi all,
    I have 2 canvas (1 canvas having database block items ,2nd having control block items & FIND button also in Control block), My requirement is when i select any one of the lov and click on the find button(in 2nd canvas , control block canvas) then it navigates to the database block canvas and displays records, at that time i want to display record count message. for this i add on-count trigger on form level, but not working, Could any one suggest me please.
    declare
      cnt number := 1;
    begin
      go_block('Blockname');
      first_record;
      while :system.last_record = 'FALSE'
      loop
      cnt := cnt + 1;
      next_record;
      end loop;
    message('There are ' || cnt || ' records in this block');
    end;
    Thank You

    994122 wrote:
    declare
      cnt number := 1;
    BEGIN
      IF :SYSTEM.LAST_RECORD='TRUE' THEN
      go_block('HOPE_FORECAST_DATA');
      first_record;
      loop
          cnt := cnt + 1;
              EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
          next_record;
      end loop;
        FND_MESSAGE.SET_STRING('There are ' || cnt || ' records in this block');
        FND_MESSAGE.SHOW;
    message'There are '||to_char(cnt)||' records in this block'); message(' ',no_acknowledge);
      END if;
    end;

  • Filtering records in message mapping by field value

    hi,
    i have a source message:
    record: 1..1
    --row: 0..unbounded
    type: 1..1
    data: 1..1
    i want to map to target message with the same structure only rows with type = x.
    how do i do that in message mapping?
    thanks
    Tomer

    if u mean that the target message shud be generated only when type = x use the below mapping.
    type------------->
                        equalsS----->createif--->row(tgt root)
    Constant[x]--->
    Map
    type--->type
    data--->data

  • Skip record in message mapping

    I have scenario where I am doing a RFC call in message mapping.Based on the result I need to create
    IDOC.If result does not meet the condition then I dont have to create IDOC for that record.
    Is any thing can be worked out that I can skip those
    records which does not meet condition in message mapping.
    Any help is appericiated.
    Rekha.

    Rekha,
    You need to use the BPM to check your RFC return data.
    Then you can have the logic to create / Not create the IDoc.
    Are you using XI 3.0?
    Regards,
    Simon

  • Message Mapping - Initialize counter every context change

    Hi all,
    is there any way to develop a counter customer function in a graphical message mapping so every context change of a field the counter initializes?
    Imagine i have the following structure:
    1 DATA
    1.1 DETAIL
    1.2 DETAIL
    2 DATA
    2.1 DETAIL
    2.2 DETAIL
    and i wanna count DETAIL fields but initialize the counter every DATA field. Is there any way to do it?
    Thanks a lot.

    Hi,
    If your Source structure is
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_DATA xmlns:ns0="http://yash.com.YH1309">
       <DATA>
          <DETAIL/>
          <DETAIL/>
       </DATA>
       <DATA>
          <DETAIL/>
          <DETAIL/>
          <DETAIL/>
       </DATA>
    </ns0:MT_DATA>
    and You want the Target as
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_DATA xmlns:ns0="http://yash.com.YH1309">
       <DATA>
          <DETAIL>COUNTER=1</DETAIL>
          <DETAIL>COUNTER=2</DETAIL>
       </DATA>
       <DATA>
          <DETAIL>COUNTER=1</DETAIL>
          <DETAIL>COUNTER=2</DETAIL>
          <DETAIL>COUNTER=3</DETAIL>
       </DATA>
    </ns0:MT_DATA>
    Create the below UDF with one argument (DETAIL)  and select Execution type all values of a Context
    for (int i =1;i<=DETAIL.length;i++)
    result.addValue("COUNTER=" + i);
    but if you want Your Target as
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_DATA xmlns:ns0="http://yash.com.YH1309">
       <DATA>
          <DETAIL>1</DETAIL>
          <DETAIL>2</DETAIL>
       </DATA>
       <DATA>
          <DETAIL>1</DETAIL>
          <DETAIL>2</DETAIL>
          <DETAIL>3</DETAIL>
       </DATA>
    </ns0:MT_DATA>
    So please Follow abhishek salvi's reply

  • File content conversion record set per message

    Dear All,
    Problem:- File is of huge size because of which file content conversion is taking longer time and is failing.
    File format:-
    Header
    Detail
    Detail
    Header
    Detail
    Detail
    Detail
    Detail
    Header
    Detail
    Detail
    Trailer
    Trailer has total count of all detail record,header record and there are few checks as well as wrt other fields.
    We need to do all the above validation on the file and if it successful it shud process it otherwise alert shud be raised.
    As a step:-
    I have used record set per message for splitting up the file because of huge size this functionality is working fine but because of spitting of file i am not able to do trailer validation as XI is creating multiple records with different message ID's
    Is any other approch which will help to achieve both Spliting as well as validation
    chirag

    Chirag,
    simplest scenario I can think of is splitting the 2 reqs.
    1. create 2 folders, one for "in process" files and other for "validated" files.
    2. create 2 scenarios:
    2.1. your current sender system to in process folder (whatever to File).
           => In this you just do the validation, without FCC. You could create a simple module for that or even do it at mapping runtime, as you said (mapping may be easier to handle errors), and throw a runtime exception (which will eventually trigger an alert).
           => At the end, only files that go successfully throug the validation will be located in the "In Process" folder.
    2.2. do a simple file to file scenario (from "In Process" to "Validated" folder), this time executing FCC & splitting messages if necessary.
    Of course, this will only work if the module/mapping is able to process the large file anyway (hopefully yes, since it will still be a flat file and not XML yet).
    BR,
    Henrique.

  • Help with Message Mapping - Context Change

    I need help with the following message mapping.  I am filtering by EMP_STAT in the Message Mapping.  I have this working for the ROW structures, but I can get the HEADER/REC_COUNT field to calculate.  I can do just a record count of ROW and get it to work, but I can't get it to work with the filter EMP_STAT = 'REG' added.  I get a context error.  Could someone send me the mapping code.
    Sender XML----
    <RECORD>
    <ROW>
    <EMPLOYEE>111</EMPLOYEE>
    <EMP_STAT>REG</EMP_STAT>
    </ROW>
    <ROW>
    <EMPLOYEE>222</EMPLOYEE>
    <EMP_STAT>PT</EMP_STAT>
    </ROW>
    <ROW>
    <EMPLOYEE>333</EMPLOYEE>
    <EMP_STAT>REG</EMP_STAT>
    </ROW>
    </RECORD>
    Receiver XML----
    <RECORD>
    <HEADER>
    <REC_COUNT>2</REC_COUNT>
    </HEADER>
    <ROW>
    <EMPLOYEE>111</EMPLOYEE>
    <EMP_STAT>REG</EMP_STAT>
    </ROW>
    <ROW>
    <EMPLOYEE>333</EMPLOYEE>
    <EMP_STAT>REG</EMP_STAT>
    </ROW>
    </RECORD>

    Hello,
    You can use this mapping
    For REC_COUNT:
    EMP_STAT -> equalsS: constant:REG -> ifWithoutElse -> removeContext -> count -> REC_COUNT
                                     EMPLOYEE -> /
    For ROW:
    EMP_STAT -> equalsS: constant:REG -> ifWithoutElse -> removeContext -> ROW
                                     EMPLOYEE -> /
    For EMPLOYEE:
    EMP_STAT -> equalsS: constant:REG -> ifWithoutElse -> removeContext -> SplitByValue -> EMPLOYEE
                                     EMPLOYEE -> /
    For EMP_STAT:
    Constant: REG -> EMP_STAT
    Hope this helps,
    Mark

Maybe you are looking for

  • Recalculate the Price in SRM once the item is transfer to SRM from SRM MDM

    Hi Experts, I am technical person and am facing one issue,we are using MDM catalog for selecting the product and after selection the product is getting transfer to the SRM. In SRM we have Quantity field available which is editable(we don't want to ma

  • Creative Cloud Installation Failed Download Error - Error Type -7 and Error Code - 401

    I subscribed to Creative Cloud in December 2012 and have been trying to install the applications, but the "Installation Failed" through the Adobe Application Manager. (see screenshot) Here is a line from my log file: 01/08/13 11:08:48:346 | [WARN] | 

  • I cant get google chrome to work on my desk top

    i cant get google chrome to work on my desk top

  • Deleting unwanted apps

    I installed an app called wireshark (traffic monitor) on my mac mini, and now want to remove it. It's not as simple as most apps - it's not in the app folder. I can see the remnants of the app in terminal under Library/Receipts. Question is how do I

  • Please read this post

    Hey Guys, I just wanted to share something with all of you, this forum does not get enough attention from the people who already know how to use the full strength of Java3D, and since there are so many unanswered questions here, and I'm sure most of