cancel
Showing results for 
Search instead for 
Did you mean: 

.dat to .txt using ASMA

Former Member
0 Kudos

Hi all,

I am using Adapter Specific Message Attributes(ASMA) to pick a file and place in another folder.

No Mapping is involved.In Communication channel no File content conversion is used.

The sent file is a .dat extension ,and i want the file with filename same at sender and receiver but with a .txt extension.

So,at sender XXXX.dat

at receiver XXXX.txt

How can i achieve this?

Thanks in Advance,

Accepted Solutions (0)

Answers (2)

Answers (2)

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi all,

>

> I am using Adapter Specific Message Attributes(ASMA) to pick a file and place in another folder.

> No Mapping is involved.In Communication channel no File content conversion is used.

> The sent file is a .dat extension ,and i want the file with filename same at sender and receiver but with a .txt extension.

>

> So,at sender XXXX.dat

> at receiver XXXX.txt

>

> How can i achieve this?

>

> Thanks in Advance,

you will have to use dynamic conf and change the extension.

the easiest way to achieve this is in a java mapping.

Just get the payload inside and pass the same out something like a dummy mapping and then in the code use the dynamic conf. to set the file name.

base these as ref:

https://wiki.sdn.sap.com/wiki/display/XI/WholePayloadtoaXML+field

/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

Former Member
0 Kudos

configure the receiver file adapter filename as ..txt

no issues using this..

if need in details of this scenario go to wiki page of process integration and check there the entire is depicted in detail

Rajesh

Former Member
0 Kudos

hi,

if i uncheck FileName in ASMA , and provide a file name with .txt in File Name Scheme, it works.

But if i check FileName in ASMA and provide *.txt in the File Name Scheme ,it doesnt.

I will be the getting the file with time stamp.so XXXX-<timestamp>.dat should be converted to

XXXX-<timestamp>.txt

Thanks

Former Member
0 Kudos

did you check with out ASMA properties and directly giving filename as .txt

in receiver CC

Rajesh

Former Member
0 Kudos

hi Rajesh,

I couldnt create the files in the destination ,if i uncheck the ASMA in receiver cc.Even,if i check ASMA and File Name also and when i give *.txt,the files are not transferred.

Please suggest a solution

Thanks

Former Member
0 Kudos

Then go for DynamicConfiguration for generating FileName

in order to execute the UDF you need to have mapping

so go for dummymapping same source to target by creating necessary DT,MT,MI,MM and IMs

Rajesh

Shabarish_Nair
Active Contributor
0 Kudos

as i mentioned before use a java mapping with dynamic conf.

that is the easiest way to do it since you wouldnt have to define a graphical mapping with xml structure etc.

Former Member
0 Kudos

hi all,

i tried using UDF with Dynamic Configuration. But getting an error in Message mapping.

AS this is a dummy mapping , i created the following objects in IR:

Data type: File

Message type: File

Message Interface: mi__o_a & mi_i_a

Message Mapping: File_MM

Created a UDF and assigned the UDF to the target structure i.e.,

UDF->File

Interface Mapping: assigned File_MM

Created ID objects also.

And in Sender CC, selected ASMA,

In receiver CC selected ASMA and given the File Name Scheme as *

But still, getting an error in Message mapping,my code in UDF

DynamicConfiguration conf =

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

DynamicConfigurationKey key = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File", "FileName");

String file = conf.get(key); --> i will get the filename as XXXX only ,with no extension such as .dat

String newfile = file+".txt";

conf.put(key, newfile);

return "";

Where am i wrong,

Please suggest

Thanks

VijayKonam
Active Contributor
0 Kudos

If you are using mapping and a UDF, you have to convert the file in to XML. If not i would not work. If you are using ASMA, you need to have name as one of the fields in the payload.

So you have to use FCC to convert the file in to XML. Then use UDF to fill the dynamic configuration variables. Then complete the direcoty objects.

VJ

Former Member
0 Kudos

*If you are using ASMA, you need to have name as one of the fields in the payload.*

My scenario is to just pick the file and place in other folder.I also dont have a structure in IR . Just created a dummy DT,MT,MI etc. SO,how can i get a name of the field in the payload.

So you have to use FCC to convert the file in to XML.

As i do nto have a recordset structure, how can i apply FCC here.

Thanks

VijayKonam
Active Contributor
0 Kudos

You got to live with what the system provides. If your data is text, use FCC and define all that it needs..!! Refer to adapter help for that.. Though you do not have anything to do in mapping.. since you want the name different at receiver side, you have to follow the normal procedure..

VJ