cancel
Showing results for 
Search instead for 
Did you mean: 

File name changes

Former Member
0 Kudos

Hi Folks,

I am asking a small question ,i am getting file from sap(Proxy).I added the time stamp for this in receiver CC.

The final output i am getting as _Account_X126_20120621-080457-693.txt..

But the client wants output file like this..

For getting file in above format..what i changes i need to do in CC..As i checked in CC but i didnt found any option like that.

or If i go MessageTransformBean module.it will work?

Suggest me on this

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member184681
Active Contributor
0 Kudos

Hi,

Have a look at different options for dynamically setting the receiver file name in my Wiki here:

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=272171407

Choose the option that suits your payload in the best manner. For your, quite complex, file name, you can only use Dynamic Configuration and Variable Substitution.

Regards,

Greg

Former Member
0 Kudos

Hi Greg ,

Thanks for the response...

I checked using variable substitution  but i am not getting as file as mentioned in above format.

Any changes need to be done for getting in above format.

SI i need to selct there for OB/IB?

Please correct me if i am wrong?

zameerf
Contributor
0 Kudos

For Variable substitution, first you should try to bring the required file name in one of the fields in your target structure in mapping. Then you can reference that field in receiver communication channel like

variablename  payload:MT_MessageTypeName,1,Record,1,FieldName,1

In your above screenshot you were trying to use something like message:interface_name, this is used when you need the message interface name to be there in file name.

Please refer what SAP help says below under Advanced Tab Page, Variable Substitution

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

Or you can go with Dynamic Configuration with the UDF and set the Filename at runtime.

Former Member
0 Kudos

Hi,

Have u seen the links provided above??

Create a DC code in the mapping itself and just check ASMA.

Perord_year, period_month, GL* these are coming from the source payload??

Thnaks

Amit Srivastava

Former Member
0 Kudos

Hi Folks,

I tried Using DC & checked with ASMA.

But i am not getting file in above format.

I am having 0% java knowledge,can anyone help on this hopw to write code to get file in above format.

Thanks in advance

Former Member
0 Kudos

Hi.

Pls tried this UDF.

I assume. (Period_year and period_month) are generated automatically , if not add as input variable.

Also add the  ProductName and Table if these values are variables, I added as constant.

Put a variable "var1" for GL_LEID

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

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

// Here you set the File Name

String sFileName = null;

DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_MMddyyyyhhmma");  

sFileName = "ACCOUNT_KB_" + var1  + "_" +  dateFormat.format(new Date());

conf.put(FileName, sFileName);

return "";

Don't forget to add to Import section below values.

java.text.SimpleDateFormat

java.text.DateFormat

Regards

Lucho.

Former Member
0 Kudos