cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution

Former Member
0 Kudos

Hi I was wandering if someong could answer the following questions for me please.

When I have %ABC% as my variable my message fails but when I have %var1% then the message is processed perfectly... why is this?

The main question is... is it possible to take only part of a field in the payload as your variable and insert it into the file name.

So for example could i have a

Field1: 1234567

and then in my file only 567 is written to the file name?

I would be greatful if you guys could answer both questions

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

>>When I have %ABC% as my variable my message fails but when I have %var1% then the message is processed perfectly... why is this?

Can you explain this statement!!!

Basically when I use %ABC% as my variable name the interface doesnt work but it does when i use %var1%

So if your need 567.. I will advice to take that in your mapping itself, so that

>>Field1: 1234567

becomes Field : 567

I need all values for that field it is only for the filename that I need the last 3...

Any suggestions

Former Member
0 Kudos

hi

you can try to create a new field in message type, this field will be populated with a java function (that is, you extract this number from the field you want), so you will have the string in the way you want, and then you can do the variable sustitution without problems.

i hope this helps

Former Member
0 Kudos

Alex,

Just add one more field in the last of your message type. Then in mapping just do the substring of the value what you want.

Then in the receiver communication channel you ignore this field in the communication channel parameters by giving :

NameA.absoluteRowWidth=<noOfColumns>

<noOfColumns> represents the maximum number of columns in this case.

Just go through the this help in the last:

http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm

So you will have the value in the payload which you will use for variable substitution but not writing to the file with the above command.

This should work. Please try.

---Satish

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I had the same problem as you when I used capital letters in my variable.

for example, %ABC% is not working, but %abc% is good.

I think capital letters must been forbidden....

Bye.

Former Member
0 Kudos

Hi Thanks for the suggestion...

Would you mind just clarifying this a little further...

What is CONVERSATION_ID?

How would I add any of this into the header?

former_member187339
Active Contributor
0 Kudos

Hi,

If you want to know about Conversation_id, refer this link

http://help.sap.com/saphelp_nw2004s/helpdata/en/6e/ff0bf75772457b863ef5d99bc92404/content.htm

but i dont think this is relevant to your problem...

Regards

Suraj

Former Member
0 Kudos

Hi Alex,

It is a work around that i am suggesting so that your xml paylaod will have a full string, where as you can have part of the string for variable substituion.

Let me be detailed...when you do variable subtitution, you can substitue it with a value from payload or value from message header...these has details like sender, recevier etc...etc...one of the fields in the message header is CONVERSATION_ID which is usually empty and may not be used depending on your scenario...

so what i was usggesting was that from inside your mapping program set this CONVERSATION_ID...so that you can use it in variable substitution...don't confuse with the actual usage of this variable....just use it a dummy place holder....

Thanks.

former_member187339
Active Contributor
0 Kudos

Hi,

<i>>>When I have %ABC% as my variable my message fails but when I have %var1% then the message is processed perfectly... why is this?</i>

Can you explain this statement!!!

<i>>>The main question is... is it possible to take only part of a field in the payload as your variable and insert it into the file name.</i>

NO...

So if your need 567.. I will advice to take that in your mapping itself, so that

>>Field1: 1234567

becomes Field : 567

and then assign your file name as field value

Regards

Suraj

Former Member
0 Kudos

Hi Alex,

I donot know whether we can use offsetting in the variable substitution in the file adapter...however it might just giving it a try....:)

I have another suggestion or work around which might work...based on couple of assumptions...

- you have a mapping in your process

- the variable CONVERSATION_ID in the message header is not used in your scenario...(i just picked this, it seems to a usable one)...

In the mapping, write a UDF(if it graphical mapping) or java code(in case of java mapping), to set the appropraite value you want in the file name to the CONVERSATION_ID parameter in the message header...

then in the variable substitution, use the message:conversation_id in the reference for the variable 'var1'...

check the variable substitution section....from sap help...

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

Thanks.