Error in my java service

Hi friends ,
I created a java service and constructed idoc and try to send idoc to sap system. iam getting this error please instruct me what to do…


After reading serviceresults
Segment 0: >>>SDATA= >>>MSGFN=005, SHNUMBER=1000, SCHED_STDT=2003-06-28 11:47:0
0.0<<< , TABNAM=E1OILSH, SEGNAM=E1OILSH, MANDT=000, DOCNUM=0000047112211178, SEG
NUM=000001, PSGNUM=000000, DTINT2=0<<<
Segment 0: >>>SDATA= >>>MSGFN=005, SHNUMBER=1000, SCHED_STDT=2003-06-28 11:47:0
0.0<<< , TABNAM=E1OILSH, SEGNAM=E1OILSH, MANDT=000, DOCNUM=0000047112211178, SEG
NUM=000001, PSGNUM=000000, DTINT2=0<<<
Segment 1: >>>SDATA= >>>MSGFN=005, VBELN=80008479, KUNNR=3000<<< , TABNAM=E1OIL
SA, SEGNAM=E1OILSA, MANDT=000, DOCNUM=0000047112211178, DTINT2=0, SEGNUM=000002,
PSGNUM=000001<<<
Segment 0: >>>SDATA= >>>MSGFN=005, SHNUMBER=1000, SCHED_STDT=2003-06-28 11:47:0
0.0<<< , TABNAM=E1OILSH, SEGNAM=E1OILSH, MANDT=000, DOCNUM=0000047112211178, SEG
NUM=000001, PSGNUM=000000, DTINT2=0<<<
Segment 1: >>>SDATA= >>>MSGFN=005, WERKS=1000, KUNNR=3000 <<< , TABNAM=E
1OILS1, SEGNAM=E1OILS1, MANDT=000, DOCNUM=0000047112211178, DTINT2=0, SEGNUM=000
002, PSGNUM=000001<<<
Segment 2: >>>SDATA= >>>MSGFN=005, VBELN=80008479, KUNNR=3000<<< , TABNAM=E1OIL
SA, SEGNAM=E1OILSA, MANDT=000, DOCNUM=0000047112211178, DTINT2=0, SEGNUM=000003,
PSGNUM=000001<<<


28-06-2003 2:51::Error In sending Idoc to SAP
28-06-2003 2:51::com.wm.app.b2b.server.ServiceException: Invalid IDoc format: Ex
pecting IDOC_CONTROL or IDOC_CONTROL_REC_40


how i can get this IDOC_CONTROL_REC_40
please urgent
thanks in advance…

with regards
satya

Mr thota thankful to you i am strugling from few days with this problem please can tell me detaily. What i have done is i call db record and created an IDOC and called outbound process. My problem is iam not clear to use transFormHirarchyToFlat please let me know i need go for few interfaces in short period.

satya

I believe you have IDOC structure created successfully from the data coming DB, anyway steps to follow sending IDCO to SAP system:

Call the DB and get data - store in hashItems as you are currently.
->Map the output of your DB call(the hashItems in the pipeline) to your record OILSH01 IDOC structure you got from ifr. Here you can insert/hardcode any other required IDOC fields too, such as for the EDI_DC40.
->Now call the pub.sap.idoc:transformHierarchyToFlat(not pub.sap.idoc:transformHierarchyToFile) - This prepares the IDOC and makes it fixed length accordingly.
pub.sap.idoc:encodeSDATA - Converts every SDATA field from orderly Values to byte array. This service is usually called prior to sending an IDoc to an SAP system via pub.sap.client:invokeTransaction.
call “pub.sap.transport.ALE: OutboundProcess” - posts the IDOC to SAP.