cancel
Showing results for 
Search instead for 
Did you mean: 

Creating JCo IDoc from flat file structure

Former Member
0 Kudos

Hi,

I need to send an IDoc into SAP using JCo.

The input to my program is a string containing lines representing a flat file idoc, e.g.

Line 1="EDI_DC40 2 ORDERS04.."

Line 2="E1EDK01 00000100000001 USD..."

Line 3="E1EDK14 0000030000000...."

Is there a simple way to use JCo to create & send the IDoc?

i.e.

1) If I use JCo and RFC IDOC_INBOUND_ASYNCHRONOUS, what would be all the steps/calls to SAP (create TID, call IDOC_INBOUND_ASYNCHRONOUS, confirm TID..?)

And can IDOC_INBOUND_ASYNCHRONOUS be called using the flat file structures (without having to map to all the JCo ParameterList fields)? Since the flat file structures are in the format required by the RFC, just in one long string.

Line 1=>IDOC_CONTROL_REC_40

Lines 2..n=>IDOC_DATA_REC_40

2) Similarly, if I were to use JCo plus the JCO IDoc library, is there a way to pass the flat file structures without having to do all the mapping to segment fields?

3) Other options..?

I want to use ALE to SAP, not files, even though the input is in the flat file structure.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Serle,

In SAP 4.7 there is a FM <b>IDOC_INBOUND_FROM_FILE</b>. Hope that will be helpful for your requirement.

Thanks & Regards,

Kathirvel

vijayakhanna_raman
Active Contributor
0 Kudos

Hi Serle,

For details regarding jco check with the link

http://help.sap.com/saphelp_nw04/helpdata/en/35/42e13d82fcfb34e10000000a114084/frameset.htm

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Your reply gives a link to the general JCo documentation.

It doesn't give ideas on how to call an RFC or IDoc from JCO without mapping each and every field from a flat file structure.

I'm looking for a way to do something like this:

Function IDOC_INBOUND_ASYNCHRONOUS has table parameters

IDOC_CONTROL_REC_40 STRUCTURE EDI_DC40

IDOC_DATA_REC_40 STRUCTURE EDI_DD40

Since I have the flat file representation of the IDoc, the first line should overlay exactly onto the EDI_DC40 structure. And the subsequent lines should overlay onto EDI_DD40. (all fields in this RFC are strings)

However JCO and JCO IDoc library seem very strongly typed, so it looks like I would have to map each field from the flat file structure to a field in the JCO Function or JCO IDoc object.

This could be done in a generic way using the function/idoc metadata, however there would still be some overhead.

Is there a way to get round this, and build the function/idoc treating its parameters as one long string?