cancel
Showing results for 
Search instead for 
Did you mean: 

Global counter Variable

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Anil,

In your RECEIVER file Adapter, you have an Option called <b>ADD COUNTER under FILE CONSTRUCTION MODE</b> and this can be used to append a counter to your File Name every time your Adapter creates a file, thereby solving your problem.

You do not need to look for a global variable in your mapping itself. This is handled by your file adapter.

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

Thnx for the very quick response...in my requirement, my counter variable's range should be 001 - 999. once 999 is reached, the counter should be initialised to 000. can v achieve this?

thnx in advance.

Anil

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Anil,

Yes you can handle this.

You can specify the start value, and increment value. Just check this link for the same.

http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/content.htm

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Anil,

Think i pasted the wrong URL for the receiver file adapter.

Just check FILE CONSTRUCTION MODE in this link,

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

It doesn't have the specification for any max value.

Anyways,

If my requirement changes in this way:

N no of senders to one receiver with different file formats at the receiving end. then v hav to use different comm chnls. But the filenames have to be A1,A2,A3,.....A999, no matter who sends the files.

How to achieve this?

thnx in Advance

Anil

Former Member
0 Kudos

Anil, you can configure the receiever file adapter to pick up the file name dynamically from payload(variable substitution option). You can maintain a Number range object in your XI abap stack , use the "Lookup API" in ur message mapping or make a JCO call from a "user-defined function" in your message mapping to access the next number from this number range , map it to a field in your payload , pass it on to the receiver file adapter and you are done.

Regards

Saravana

Former Member
0 Kudos

Hi Saravana Kumar,

Can u plz ealborate it a bit detail,,,?

Coz, that seems to really solve my problem.

I appreciate ur help.

Thnx in Advance

Anil.

bhavesh_kantilal
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Anil,

You can maintain a number range object in ur XI ABAP stack using tcode SNRO. Now write a ZRFC(remote enabled function module) that will return you the NEXT number from this NRO. I think a wrapper RFC is required because the standard function module to get the next number is by default not remote enabled.Download this wrapper RFC to your IR

Now to access this RFC , you can make a JCO call from your message mapping(create UDF that will acces ur wrapper RFC via JCO) or use the Lookup API to access this RFC. Hope it helps

Regards

Saravana

STALANKI
Active Contributor
0 Kudos

Donot do anything in mapping if your requirement is just to name the files at the reciever.

use reciever adapter configuration for increasing the counetr.