cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple File Names in Receiver File Channel

Former Member
0 Kudos

Hi,

I have an existing scenario where a File name is maintained as Below,

Currently we have a new requirement where in the incoming Idoc if the MESFCT value is AA then we should have a new file name as"Billing_xxx_.xml" sent to the target, but for the existing scenario the MESFCT value will as BA or CD, where we use the same file name as above.

Please let me know how can this be achieved, without touching the existing scenario.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi All,

In the existing file name configuration i see the file output file name as follows,

INVOICE_0000000011111111_20150219-034114-978.xml


I can identify the Idoc number as "000000011111" and time stamp as "20150219", but i am not able to identify what the other values(034114-978) implies, even I can't find it in the XML file.


please any one tell what might be this value...

engswee
Active Contributor
0 Kudos

Selva

That is the time part of the timestamp - hour, minute, seconds and milliseconds.

Configuring the Receiver FTP Adapter - Advanced Adapter Engine - SAP Library


Add Time Stamp

A new file is created for each document. A time stamp with the formatyyyyMMdd-HHmmss-SSSis added to the file name. The time stamp is added as the last part of the name before the extension.

This mode guarantees that no file is overwritten. In this way, files that originate from the same adapter configuration can be sorted.

Rgds

Eng Swee

Message was edited by: Eng Swee Yeoh (added details from SAP library)

Former Member
0 Kudos

I am using UDF for getting two file names based on some field value condition. am getting the output but the file is coming with two time stamps, Can anyone tell how to avoid that, Even I tried changing the file construction mode to Create,but no luck.

Its Coming as

BILLING_0000000014588891_20150305-010612-82720150305-010613-077.xml

Actual file name should as:

BILLING_0000000014588891_20150305-010612-827.xml

former_member182412
Active Contributor
0 Kudos

Hi Selva,

The UDF is right, it is only generating one time stamp, the second time stamp is definitely coming from add time stamp option of file construction mode parameter in the channel.

  • Make sure the cache the channel cache status should be green(Communcation Channel -> Display Cache Status) after you change file construction mode to create.
  • Make sure ASMA properties enabled in the channel
  • Make sure in File Name Scheme you enter %FileName%

Regards,

Praveen.

Former Member
0 Kudos

Hi,

I have proposed the new file name as below by just adding the MESFCT field in the Variable Substitution. But I have doubt whether the value of the file name will be fetched from the source payload or from the target payload. Since the MESFCT value 'AA' is coming in the input payload, but we not sending that value to the target system.

So if the value for the file name is fetching from Source payload then the below format will be correct/if not then I need to go for an alternate option.

INVOICE_0000000011111111_20150219-011111-979-AA.xml



former_member182412
Active Contributor
0 Kudos

Hi Selva,

Your assumption is right, the variable substitution field values will be taken from source payload.

Regards,

Praveen.

praveen_sutra
Active Contributor
0 Kudos

Hi Selva,

We can only use values in the target payload in the variable substitution.

so if you want to use variable substitution you must pass the value in target payload.

hope this helps.

thanks and regards,

Praveen T

naveen_chichili
Active Contributor
0 Kudos

Hi Selva,

You can either use variable substitution or you can create a new receiver  channel and create a condition with variable substitution.

Thanks and Regards,

Naveen    

iaki_vila
Active Contributor
0 Kudos

Hi Selva,

If you don't want to change the ESR development and not to introduce dynamic configuration as Praveen suggested, you could do a second configuration with a receiver rule, based in the field mesfct,  and therefore you will set a new receiver channel with your new variable substitution and you will when the receiver condition will be false your old receiver configuration.

Regards.

former_member182412
Active Contributor
0 Kudos

Hi Selva,

You use below UDF. Excecution type is "Single Values", input fields are MESFCT and DOCNUM.


public String setFileName(String mesfct, String docnum, Container container) throws StreamTransformationException {

        Map<String, Object> mapParameters = container.getInputHeader().getAll();

        DynamicConfiguration conf = (DynamicConfiguration) mapParameters

                .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

        DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File",

                "FileName");

        String fileName = conf.get(KEY_FILENAME);

        if (mesfct.equals("AA")) {

            fileName = "Billing_xxx_.xml";

        }else{

            fileName = docnum;

        }

        conf.put(KEY_FILENAME, fileName);

        return "";

    }

Regards,

Praveen.

Former Member
0 Kudos

Hi,

I tried using the below mapping and UDF to get the File names, I amnually sent data from RWB I am getting the required file names but I see in the output XML that MESFCT is coming with some exception value. Actually the field MESFCT should not appear in the output.

UDF:

public String getFileName(String MESFCT, String DOCNUM, Container container) throws StreamTransformationException{

try

{

String filename = new String("");

SimpleDateFormat dateformat =new SimpleDateFormat("yyyyMMdd-hhmmss-SSS");

String timestamp = dateformat.format(new Date());

if (MESFCT.equals("PL")) {

filename ="BILLING_PLANET_Shiire" +"_"+DOCNUM+"_"+timestamp+".xml";  }

else {

filename ="INVOICE" +"_"+DOCNUM+"_"+timestamp+".xml";   }

DynamicConfiguration DynConfg = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

DynConfg.put(key,filename);

return MESFCT;

}

catch(Exception e)

{

String exception =e.toString();

return exception;

}

}

former_member182412
Active Contributor
0 Kudos

Hi Selva,

The output of the UDF you can map it to root node(i.e IDOC) of the target field, you must not map it to MESFCT.

Regards,

Praveen.

Former Member
0 Kudos