Global Counter Variable - Graphical Mapping

Hi there.
Can anybody help with implementing a global counter variable in the graphical mapping please.
I am trying to populate the "SEGMENT" field of an IDoc with the correct sequence, i.e. add 1 for each new segment. The IDoc has several segments, most of which are embedded. I have tried using the "<b>counter</b>" function but this seems to reset back to one for each instance of it being called.
I would appreciate any pointers.
Thank you.
Mick.

Hi see this for implementation
<b>defining Global Variables</b>
ArrayList arrVI;
int counter =0;
<b>Initialization Section</b>
arrVI= new  ArrayList();
<b>assignment</b>
arrVI.add(sVI[iLoopCounter]);
counter++;
<b>
fetch Values</b>
for (int i =0;i<counter;i++)
result.addValue(arrVI.get(i)+"");
Mudit

Similar Messages

  • Trace not showing Global container variable at mapping test time.

    Hi Folks ,
    I have a scenario file to Proxy scenario. At mapping time I am doing a lookup inside a UDF using JCO connections.
    Lookup is taking 2 fields(ex X an dY) as input and coming up with couple of fields in output.
    Output fileds I am storing in global container and want to access in further mapping .
    I am using trace to see variable values at mapping tijme
    Surprisingly :
    1. For a particular "X" field in Input, No output fields are coming at trace . On testing it end to end I can see fields getting populated at run time at lookup table . but not getting reflected at mapping trace . what could be the possible cause ?
    2.  For few input fields like "Z" . It is showing all the output values at Trace. But when I go and place a value in lookup table for the same Input field "Z" . this new value is not coming up at trace Level while rest of teh values are coming up. Can anyone hint where I am going wrong  ?
    End to end Debugging sahows values populating and being sent across . Where I need to look at ?
    Regards ,
    Santosh

    Hi Horia ,
    By trace do you mean display queue or running the mapping completely in the ESR ?
    --->I am talking about running the mapping at IR and getting the values of trace by using messagetype.traceinfo() in UDF functionality. I am working on Pi 7.0
    Regards ,
    Santosh

  • Global counter Variable

    Hi All,
    I have a requirement where i hav to push 'n' no of files from n different senders(1 file each sender and each is a different scenario) to a same receiver. so, i have to name all the files at the receiving end with some counter. and that counter should be accessed in all the scenarios during mapping. how can i acheive this?
    any help wud b appreciated.
    Thnx in Advance
    Anil

    Hi Anil,
    For perfroming the RFC lookup  from a Table so that you can use the counter value dynamically if you store it in a table, you can refer to this blog,
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    The dynamic filename generation concept is as follows.
    In your filename field. just give a variable with % symbols. (eg: %file% ).
    Now, under the option Variable Name Substitution, you can give how the value has to be created.
    It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
    For the former, your give
    message:interface_name ,etc
    and for the payload part you give,
    Payload: "your element root which u wanna acecss"
    Just check this link out,
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    And read the contents under variable substitution and it will help you understand the concepts better.
    If you have any clarifications, do get back,
    Regards,
    Bhavesh

  • How to debug global values in UDF in a graphical mapping

    Hi Every one,
    I  got a situation in PI where i have to use global values in graphical mapping UDF.
    I can't able to get the values in "Display Queue " option.
    Can you please tell me what is the best way of debugging global variable in graphical mapping UDF.
    1. I declare one array list in the global values
    2. store some values using another UDF to the arraylist.
    3. I am traversing the values in the arraylist, but the values are not showing in "Display Queue".
    What is the solution to this.

    Did you try with trace.addInfo?
    https://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/AbstractTrace.html
    Sample code for the setMail UDF (Carrier B2B) - Business Process Expert - SCN Wiki

  • Global variable in Mapping

    Hi,
    Is there a way to declare a global variable in a mapping? e.g if I want to use a counter variable...
    Zahid

    Hi again,
    I've previously used the mapping input parameters successfully to bind a name (read-only) to the value of an expression, which is particularly effective when you want to filter an ODBC source with a non-trivial expression, which otherwise means the filtering is done on the target side (expensive).
    Unfortunately, Zahid wants to change the global variable within a transformation, and that is a side effect I believe is not allowed in SQL (set mode). Also, transformations live in a separate PL/SQL package, which means that the transformations have no access to the mapping input parameters. Hence my (untested) suggestion that using row mode and developing a separate "global variable" package might do the trick.
    Regards, Hans Henrik

  • XI 3.0: Using global variables in mapping

    Hi everybody
    Since it seems that during mapping you have only access to messages fields, does anybody has got idea or a workaround to use global/external variables or constants during mapping??
    Example: i would like to store the mail address where i send my error mails outside each mapping program (something like using a properties file or something like that).
    Any idea???

    Hi,
    U can refer to the following links in help.sap.com
    GlobalContainer Object
    http://help.sap.com/saphelp_nw04/helpdata/en/75/8e0f8f3b0c2e4ea5f8d8f9faa9461a/content.htm
    Container Object
    http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm
    Also some of the RUN TIME CONSTANTS are available in your BPM. So if you are trying to retrieve those variables in your Mapping(that is used in BPM), also read the following thread.
    Re: Message id in BPM
    Cheers,
    Siva Maranani.

  • Increment counter in XSLT mapping

    Hi Experts,
    I am creating xslt mapping by using mapforce tool. I am trying to get increment counter variable in xslt mapping. can you please tell me what would be the code for getting sequence number.
    Thanks for your help.
    Thanks,
    Hari

    yes, there is a global variable concept in XI which u can use for your Sequence Number concept.
    If you are on SP14 and above, just take a lookat this blog and the GLOBAL Variables Section
    XI: New features in SP14
    check this thread
    Re: Need Help in XSLT Mapping
    Re: Sequence Number in XI Mapping

  • Graphical mapping question - need to create 2 nodes for each record

    The mapping is from flat to nested, i.e. flat file to FIDCC2 idoc. Each record has to go to 2 repeated IDoc segments, each one with different posting key. Right now, I have it working for each record to a segment(for one segment) by using splitByValue (value change). How can I repeat the creation of another but with slightly different constant.
    Also, how do I add line numbers? I remember seeing a posting on this a while ago - cannot locate it.
    Will be Rewarded WELL.
    Thanks,
    Pam

    Hi, Pam
    Using the following example to store it as global variable
    SetParameter from GloabalContainer:
    container.getGlobalContainer ().setParameter ("COUNTER", "0");
    GetParameter from GloabalContainer:
    String myCounter = (String) container.getGlobalContainer().getParameter ("COUNTER");
    When you map to your constant, store it in global variable, then you map other field, get current global variable, check its value, based on the value, you do proper mapping.
    Hope it helps
    Liang

  • Global Container Variable

    Hi
    Give me idea on Global Container variable in Graphical mapping.
    Thanx in Advance

    Hi
    Ref this
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/content.htm
    Design and Configuration [original link is broken]
    Thanks
    Sridhar

  • Graphical-mapping

    Hi,
       plz tell me about graphical-mapping.
    with warm regards.
    vikash

    Hi
    MAPPINGS STANDARD NODE FUNCTIONS:
    Remove Contexts:     We use it to remove Header Contexts from source side. If we donu2019t want header context to repeat in target structure, use this. It removes repeated header contexts and all the items come under the same contexts.
    Split by Value:     This is counter part of remove context. Use this to add the header context at the target side. Suppose if we wan to separate header contexts for every value of item at source use this.
    Copy Value: We can use this to copy the value of a position in the source structure and assign it to a target field for  frequently occurring source structure element. The value is copied each time the target field occurs in the target structure.
    Createif ():     Use it to create a tag in the target structure depending on the condition. Use it, if the nodes at the target side have to be created only after certain condition is true. If value type is u2018INTENALu2019 Internal request node is created and if value type is u2018EXTERNALu2019 external request node is created.
    Collapse Context:     We use it, if we have to create empty tags in target for every context change in the source.
    Exists: While mapping idoc structure to file structure, Lot of times we come across a scenario where the fields (occurrence=0) are not mandatory in the idoc. They are not populated in the source xml and they are required in the target xml (occurrence=1) which gives runtime exception that target element canu2019t be created.
    u can also refer the below links for further assitance
    /people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
    /people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
    Different Node Functions in Graphical Mapping.
    : /people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb398d3
    cheers
    reward points if found useful

  • BPM Counter Variable

    FILE1---> XI -->  IDOC
    I have a BPM to receive the File. Do the Transformation and then send to R/3 as requested. This scenario is working fine for me. The only problem I have is, I need to send a mail at the end of the process, saying that how many IDOCs were sent to R/3.
    I have introduced a Counter Variable(SimpleType,Integer) and counting each time an IDOC is created.
    But when I add a new step to send the Counter Variable, I dont even see that variable in the Message variable of the SEnd Step!!!
    What am I doing wrong?

    Hi Mohan,
    you cannot send variables - only messages
    (there's no way to map variable to a message in BPM)
    how can you do your scenario?
    you can do 1:2 mapping
    you can map your file to 2 kinds of messages:
    - idoc
    - message with one field(conuter)
    then map file to those 2 messages and counter has to contain the number of idocs
    then you'll be able to use it in send step:)
    BTW
    if you're not using combined IDOC have a look at my weblog:
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • Use variable in mapping

    Hi!
    How to use Variable in mapping ? I've tried #PROJECT_CODE.VARIABLE_NAME but execution ends with an error "Illegal character"
    With regards,
    PsmakR

    There is no need to use package name if variable is locate in the same package with the interace. Else (according with documentation):
    Referring to variable MY_VAR in your objects should be done as follows:
    • #MY_VAR: With this syntax, the variable must be in the same project as the object referring to it. Its value will be substituted. To avoid ambiguity, consider using fully qualified syntax by prefixing the variable name with the project code.
    • #MY_PROJECT_CODE.MY_VAR: Using this syntax allows you to use variables across projects. It prevents ambiguity when 2 variables in different projects have the same name. The value of the variable will be substituted at runtime.
    • #GLOBAL.MY_VAR: This syntax allows you to refer to a global variable. Its value will be substituted in your code. Refer to section Global Objects for details.
    • Using “:” instead of “#”: You can use the variable as a SQL bind variable by prefixing it with a colon rather than a hash. However this syntax is subject to restrictions as it only applies to SQL DML statements.
    And make sure you declare it in the package as was suggested in the previous post.

  • Fetching the business system name during graphical mapping

    Hi,
    After the receiver determination is done and in interface determination, while executing the interface mapping, i need the business system name for which the
    mapping is under progress. This i need during mapping.
    Also, i need the configuration scenario name during mapping.
    Is there any XI internal variable/system variables which hold these values so that using user defined function they can be accessed and used in graphical mapping ?
    In appreciate your input in this regard.
    Regards
    Ganesh

    Hi,
      For the configuration name you can map it with a constant and for the sender,receiver services and interfaces you nee to use the UDF as one mentioned below.
    Imports   com.racs.gpt.*;
    public String getMapValue(String a,String b,Container container)
    //String a denotes incoming data string |data1|data2|data3|...|dataN.
    //String b = lookupID.
    //container contains runtime parameters.
    AbstractTrace trace;
    String headerField;
    java.util.Map map;
    String  result;
    trace = container.getTrace();
    // get constant map
    map = container.getTransformationParameters();
    CrossReferenceAPI maprule1 = new CrossReferenceAPI();
    result  =   maprule1.getData(a,b,map);
    trace.addWarning("result = " + result);
    if (result.equals("$NULL$"))
    trace.addWarning("XREF Error.  Mapped data for " + a + " not found");
    ErrorHandler errHandler = new ErrorHandler();
    int lookupID = Integer.parseInt(b);
    errHandler.logSQLError(map, lookupID, a, "");
    result = "?";
    return result;
    Regards
    Madhu

  • Taking a container element into a graphical mapping

    Hi experts,
    I need to take a simple container string value from a container step into a graphical mapping in my BPM.
    Does anybody knows how to do that?
    Regards
    Gonzalo

    Hi,
    Check the discussions
    Accessing container variable of BPM in Message Mapping function
    Re: How to use Container Variable across Maps
    Thanks!

  • Did Anybody Use The Graphics Map?

    Hi,
    I want to use the graphics map but the page test_gis_with_event.htm in GRAPH_BSP_TEST standard demo bsp application doesn't show anything. You can see the screen shots following URL.
    [http://img228.imageshack.us/i/graphicsmapbsp.jpg/|http://img228.imageshack.us/i/graphicsmapbsp.jpg/]
    Did anybody use the graphics map?
    Can somebody help me please?
    Thanks.

    Hi,
    this is an configuration error. Set an breakpoint in class cl_igs_data, method send at the funtion module
    PIGFARMDATA. The variable msg_text willc ontain something like 'ListenerRfc: unknown interpreter'.
    The IGS Connection has been not setup no or not in right way. let it check by your basis.
    Best regards, Stefan

Maybe you are looking for

  • How can I REALLY downgrade my iCloud storage?  HELP!

    How can I REALLY downgrade my iCloud storage?  Apple is trying to scam ppl out of $$. They will NOT allow you to downgrade per their instructions.  It ALWAYS says the iCloud manager is not available, try later.  Here is what my email says: This is a

  • URGENT - Using a session value for query in reports

    Please Reports Team or anyone.... I need to make a pdf report on the web. The query needs to be dynamically so i can make reports on the fly in a secure manner, for example with the use of a session variable as the identifier (eg. select * from emp w

  • Mainstage 2 not loading mainstage 1 files properly

    Hi there, running a 2008 macbook pro 15", 4gb ram. Had no problems installing the logic studio 2009 upgrade, logic's working fine. But Mainstage 2 won't load my old Mainstage files, keeps saying the files are corrupt. If the file does load, it is all

  • Robot not working after another app gains focus

    I'm trying to automate some clicking for a program using Robot. The problem is, once I give focus to the target program, Robot stops working (so basically, the initial click into the program works, but it's useless if I can't release the mouse). Intu

  • Is there some way we can make suggestions to Apple?

    That's my question. Have an idea or two regarding the current ios. Would love to submit to Apple for their consideration.