cancel
Showing results for 
Search instead for 
Did you mean: 

FIle to IDOC and mail

Former Member
0 Kudos

HI experts,

I am working on a scenario, where a complete text file is sent to ECC system(IDOC) and same file also needed to be dumped in respective email ids .

Their is no mapping.

File doesn't have any fixed format. it contains error statement.

Here their is Custom developed IDOC in place .

i am bit of confused here , how an complete text file without any format is send to IDOC.

do have any File adapter parameters to achieved this process.

Thanks In advance,

Kiran,

Best Regards

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>>i am bit of confused here , how an complete text file without any format is send to IDOC.

Use File adapter at the sender side and pick File content conversion as Message Protocol. Convert flat file to XML format at the source side and map the xml format message to IDOC.

>>>do have any File adapter parameters to achieved this process.

Yes, File adapter (FCC)

Please follow this link

http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Note:Create an another scenario file to email. use file adapter at the sender side and smtp adapter at the target side to send email.

Former Member
0 Kudos

As you said, there is not fixed file format (as it contains erorr information), you can write custom adapter module where you read whole file as a inputstream and convert it to the string and generate the xml. then map your field to target idoc field.

If your file has fixed format, some keyfield in the file, then you can use file content conversion and then map the field to target idoc structure.

Edited by: Chetankumar Patel on Feb 15, 2011 1:13 PM

Former Member
0 Kudos

HI baskar,

Thanks for your reply,

as asked , below is the given content of error file which i need to send to IDOC.

ERRORNRCYBU20101202110318467826245^1INVALID SSN^NRCYBTM59825^3451 ^^^^

ERRORNRCYBU20101202120323467838299^1Missing Standard Hours Worked for Employee ^NRCYBFX26829^^^ ^^^^

here i have only one field "errortext " from sender side to map into Idoc structure.

So not sure how i can achieve this with content conversion.

Thanks,

Kiran

Former Member
0 Kudos

Hi Kiran,

Since your requirement is:

>>"here i have only one field "errortext " from sender side to map into Idoc structure.", therefore you need to use FileContentConversion in your sender file adapter to convert your flat file into XML structure and then map the required error field from the source structure to the target IDoc's any one field. So, You need to have a Sender DataType for the incoming file and the IDoc at the target side with one message mapping to map the error text field from source side to the IDoc.

Now as far as sending the mail is concerned, you have to make another interface in which you have to use a receiver mail adapter with Transport Protocol set to SMTP . Use XIALL as your message protocol and do not use the option "Use Mail Package". The mapping part as well as the source data type and target IDoc all remains the same as said earlier.

Provide all the parameters in To,Subject,From fields according to your requirements and check the option "Use Attachments".

Hope this helps you buddy!!!

Thanks

Biswajit

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>>here i have only one field "errortext " from sender side to map into Idoc structure

I see better option is doing FCC even though you need to map the error text which is only field. Here you get flat file with delimiter ^.

Create XML structure as below and follow FCC sap help link.

flat file structure is

ERRORNRCYBU20101202110318467826245^1INVALID SSN^NRCYBTM59825^3451 ^^^^

<Errors> (occurance 0 to unbounded)

<Error> Error

<field1> NRCYB

<field2> U

<field3>20101202

<field4>110318

<field5>467826245

<field6>

<field7>

<field8>

<field9> 1

<field10> Invalid SSN < This is your error text and map it to the target idoc field>

..

...

...

<field 19>

<Errors>

In File adpater fcc configuration

Specify Recordset structure as : Errors, *

Please follow this link for further details

http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Edited by: Baskar Gopal on Feb 15, 2011 11:53 AM

Former Member
0 Kudos

Hi all,

Thanks for all, for giving an detailed explanation about the problem and yes i was able to achieve the desired result and your suggestions was very helpful here.

coming to mail server, is their any possibility that i can add my Gmail account in the SAP server to rout the emails for testing.

Thanks,

Kiran

Answers (0)