cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver File Adapter - TimeStamp

Former Member
0 Kudos

How should I get partial time stamp ( I need only CCYYMMDDHHMMSS ) without Hyphans(-). Any Ideas?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Ram

An option is that in your message mapping you include “User Defined Function” with the DynamicConfiguration name and add as parameter the predefined function currentDate and you change the type of TimeStamp there that you want to give.

saludos

J.R.C

bhavesh_kantilal
Active Contributor
0 Kudos

Henrique,

See this for usig Java Mapping to access Adapter SPecific Identifiers,

http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/content.htm

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

You could write a simple UDF which is going to split the value at hyphens.Combine the values and map the output to the target tag

Regards,

Smitha.

henrique_pinto
Active Contributor
0 Kudos

Bhavesh,

that's very interesting.

Where can I have more information on how to access this data on XI mapping?

I have a request to creat a path based on some informations from the payload, but these information need to be manipulated and not just copied (so I can't just use a variable substitution). I think this solution you provided, used in a Java Mapping, would just be the solution I'm looking for (maybe using FilePath instead of FileName, or something like that).

Do you know if I can just use it in a Java Mapping? Which imports do I have to do?

One more thing: in SAP BASIS SWCV, I have http://sap.com/xi/XI/System/ namespace but I don't have http://sap.com/xi/XI/System/File namespace. Is that a problem or it doesn't need to be there for this to work?

Best regards,

Henrique.

Former Member
0 Kudos

If Message mapping is not required ( Interface is just pass thru flat file ) then is there anyway to change the format of the file name on the receiver adapter ?

henrique_pinto
Active Contributor
0 Kudos

Ram,

I'm was also checking this request and I came to this link:

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03fe1bdc7821ade10000000a1553f6/frameset.htm

If you use this XSLT, you can use it on MessageTransformBean Module Processor, in the adapter, and not affect your scenario at all.

Best regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Henrique,

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm

This link gives youi the details. Yes, you can access all Mapping objects from your Java Mapping also.

REgards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Ram,

One option, write a script that will pick up the file after the file adapter has added the hiphen and created the file in the target directory and rename it as per your requirements.

Take a look at this for how to execute scripts in FIle Adapter,

http://help.sap.com/saphelp_nw04/helpdata/en/6a/3f93404f673028e10000000a1550b0/content.htm

Regards,

Bhavesh

henrique_pinto
Active Contributor
0 Kudos

Thanks Bhavesh,

I had found some links on this matter.

Regards,

Henrique.

Former Member
0 Kudos

Insert the timeStamp in a XML tag (using Message Mapping) and use the Variable Substitution. For Example:

Create a "filename" tag

[File Name Schema] = %fileName%

Variable Substitution (Table)

... add a Line

Variable name = fileName

Reference = payload:myXml,1,filename,1

Evandro.

Former Member
0 Kudos

If add Timestamp Tag it goes to the receiver as another field right?. I have already source and target structures defines. If I add another XML tag, My receiver system has to make changes to their programs right ?

Message was edited by: Ram Krish

Former Member
0 Kudos

Create the tag filename as optional (0..1).

What is your process? (File to RFC, File to File) ?

Former Member
0 Kudos

It will be File to File. I just dont want to send File Name in the payload to the receiver. If I do File content conversion, Will it be possible to drop this optional tag?

Former Member
0 Kudos

Is you using Content Conversion? The file that is created is in text format?

I have the folowing XML:


<?xml version="1.0" encoding="UTF-8"?>

<p2:Y_SD_XPLAN_C_SALESORDER xmlns:p2="urn:sap-com:document:sap:rfc:functions">
   <SENDER/>
   <T_SALESORDER>
      <item>
         <FLGALT/>
         <CD_PEDLIN/>
         <DT_PEDLIN_CRI/>
         <EAN11/>
         <STCD1_CL/>
         <DT_PEDLIN_MOV/>
         <QT_PED/>
         <QT_REC/>
      </item>
   </T_SALESORDER>
</p2:Y_SD_XPLAN_C_SALESORDER>

And did this configuration in the Content Conversion Parameter:

Record Structure = record,row

[Table]

row.fieldSeparator = ,

row.endSeparator = 'nl'

row.processConfiguration = fromConfiguration

record.fieldSeparator = '0'

record.fieldFixedLengths = 0

record.fixedLengthTooShortHandling = Cut

record.endSeparator = '0'

Evandro.

Former Member
0 Kudos

Sorry,

I sent a wrong XML.

The correct is:

<?xml version="1.0" encoding="UTF-8"?>

<p3:XPlanCargaPedidos xmlns:p3="urn:spasa.xplan.pedidos.carga"><record><row><FLGALT></FLGALT><CD_PEDLIN></CD_PEDLIN><CD_PEDLIN_XPLAN></CD_PEDLIN_XPLAN><DT_PEDLIN_CRI></DT_PEDLIN_CRI><OBSERVACAO></OBSERVACAO><ID_EMPRESA>1</ID_EMPRESA><EAN11></EAN11><STCD1_CL></STCD1_CL><DT_PEDLIN_MOV></DT_PEDLIN_MOV><QT_PED></QT_PED><QT_REQ></QT_REQ><CONTRAPARTIDA>HAVAIANAS</CONTRAPARTIDA></row><filename>X_20060807164415_lin_ped_colocado.txt</filename></record></p3:XPlanCargaPedidos>

Former Member
0 Kudos

Hi Evandro. What is this XML for?. Is it into wrong message ?

bhavesh_kantilal
Active Contributor
0 Kudos

Ram,

You can use Adapter Specific Identifiers and then change the file name in the mapping. Append the tiem stamp in the format that you want and so on.

Just use this code in an UDF,

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

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

String SourceFileName = conf.get(key);

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );
dateformat.format( new java.util.Date() );
 
String newfilename=SourceFileName+dateformat;

// change to new file name
conf.put(key, newfilename);
return "";

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

I use this XML to get some data from SAP, using RFC, to create a file. The file name come from RFC.

Can you any problem yet?