cancel
Showing results for 
Search instead for 
Did you mean: 

Populate IDOC no and Timestamp in File Name

Former Member
0 Kudos

Dear Team,

This is basically IDOC-FILE(xml) conversion.

Requirement is to populate the IDOC no and timestamp in Filename when the file gets posted into FTP server:

<FILENAME_IDOCNO_timestamp>

Please help on this. Thank you very much in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member182412
Active Contributor
0 Kudos

Hi Rajesh

Check my blog for reusable function library for dynamic configuration.

Regards,

Praveen

Former Member
0 Kudos

Hi Praveen,

Could you please provide exact solution it would be really greatful.

IDOC No (DOC NUM) is populated in idoc structure but it is not mapped.

File Name is currently delivered as MARA.csv.

Requirement is MARA_IDOCNUM_Timestamp

former_member186851
Active Contributor
0 Kudos

Hello Rajesh,

Use the Dyamnic UDF code,Where IdocNumber(from Input) and Timestamp(Use Current Time in date function) will be ur inputs

String filename = new String("");

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

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

filename = "MARA" + IdocNumber+ Timestamp;

conf1.put(key1,filename);

return filename;

In the Channel enable adapter specific attributes under that filename and map this UDF to any root node.

Former Member
0 Kudos

Hi Raghu,

I'm facing error please find below code and screenshot:

String filename = new String("");

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

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

filename = "MARA_" + "DOCNUM_" + ".csv";

conf1.put(key1,filename);

return DOCNUM;

former_member186851
Active Contributor
0 Kudos

Rajesh,

You cant check in @ mapping level as it required dynamic values to be passed.

You need to run it end-end.

Former Member
0 Kudos

Hi Raghu,

I hop the UDF mapping is correct and in Integration directory I have enabled only ASMA.

former_member186851
Active Contributor
0 Kudos

Hello Rajesh,

you don't required timestamp??

Mara is constant right ,hardcode in the UDF and for Idocnumber dont use " " as its passed from mapping,follow the code I used.

Try in Development first before deploying in production,If you face any errors post so that we can assist then you can move it to production.

Former Member
0 Kudos

Hi Raghu,

I'm facing below error.

former_member186851
Active Contributor
0 Kudos

your using VS or ASMA?

Former Member
0 Kudos

Hi Raghu,

I'm using both. Is it correct.

former_member186851
Active Contributor
0 Kudos

Hello Rajesh,

You can't use both,Use ASMA as mentioned earlier.

Former Member
0 Kudos

Hi Raghu,

I'm using below code and ASMA. But still IDOC no. is not populated in filename.

String filename = new String("");

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

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

filename = "TSPA_" + "DOCNUM_" + ".csv";

conf1.put(key1,filename);

return filename;

Former Member
0 Kudos

Below for the ID part.

former_member186851
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi Raghu,

Please help me on the variable subsitution and file name scheme.

File Name is MARA.csv

IDOC segment is DOCNUM under EDI_DC40

Actual file name scheme delivered to FTP server should be liked "MARA_IDOC NO_Timestamp.csv"

former_member186851
Active Contributor
0 Kudos

Hello Rajesh,

Do you have MARA mapped to any field in the target?

Former Member
0 Kudos

Hi Raghu,

MARA is not mapped but its related fields are mapped to file.

manoj_khavatkopp
Active Contributor
0 Kudos

Raghu,

i guess MARA is a constant .

Rajesh is IDOC number mapped to any target filed?  if no then you have to go for Dynamic Config variable substituion dont help here.

Br,

M

Former Member
0 Kudos

Hi Manoj,

You mean to say to proceed with UDF.

vicky20691
Active Contributor
0 Kudos

Hi ,

I am hoping you know dynamic configuration.

EDIDC40 -> DOCNUM field contains IDOC number

and timestamp can be taken with currentdate (HHmmSS or any format)

so just pass  FileName (concat) DOCNUM (concat) Timestamp  into the UDF and set the filename.

Regards,

Vikas

Former Member
0 Kudos

Hi Vikas,

Could you please elucidate on below solution.

Requirement is only to populate as File Name scheme and not in XML fields.

<FILENAME_IDOCNO_timestamp>

Thanks...!!