cancel
Showing results for 
Search instead for 
Did you mean: 

Reg:Passing Dynamic Values to Shell Script

Former Member
0 Kudos

Hi,

I am having IDoc -> File Scenario.

I just want to create a separate folder depends on Vendor Code and dump the files in that folder.

Am using Shell script here.

I just want to pass the LIFNR values dynamically.

Is there any way??

Please help me..

regards,

kanda

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

You can achieve this without script as well using Variable substitution

I think Russell has already given solution which should work

Other than Help.sap

You can refer these as well

Thanks

Gaurav

Former Member
0 Kudos

Hi Kanda,

You should be able to use Variable Substitution or Adapter-Specific Message Attributes, but passing

the value to the script may not work the way you might expect.

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

Variable Substitution will depend on an exact path, but itu2019s not xpath. For example:


Var Name  | Reference
-------------------------------------------------------
vendor    | payload:ORDERS05,1,IDOC,1,E1EDKA1,3,LIFNR,1

You can then use %vendor% in the target directory: /tmp/%vendor%

One potential issue with this approach is that LIFNR may not always be in the 3rd E1EDKA1 segment.

You can also use Adapter-Specific Message Attributes and set the directory name in your map.

https://www.sdn.sap.com/irj/scn/thread?forumID=44&threadID=108738&messageID=1211235#1211235

The UDF code to set the directory will look slightly different than the thread and blogs listed in the link above:


DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
conf.put(key, yourTargetDir);

Iu2019m not sure what your script is doing, but I donu2019t think you can pass the vendor variable to the OS

command directly. However, if you use one of the methods above, you can pass the full file name using

the %F variable. The %F variable will include the directory and filename so the vendor will be part of it.

Your script will need to parse the input string to extract the vendor value. If you just need the script to

create the dir, then you should be able to select u201CCreate Target Directoryu201D in the File Adapter.

Thanks,

-Russ