Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error During IDoc Processing

Former Member
0 Likes
1,043

Hi friends,

i want to transfer data in between two systems.

i have created my own message type = ZSACH

Basic type = ZSACH1

segement = ZSACH

model view = new_model

when i am execuiting this IDOC by using the program i am getting the error as

EDI: Syntax error in IDoc (segment cannot be identified)

here i am giving the coding what i have write in my program

parameters :p_logsys like tbdlst-logsys.
data : gen_segment like edidd-segnam value 'ZSACH1'.
data : control_dat like edidc,
       control_dat1 like edidd,
      gen_data like zsach .
tables : zsach1.
data: begin of inttab occurs 0,
        lname type zsach1-lname,
        fname type zsach1-fname,
      end of inttab.
data :
      int_edidd like edidd occurs 0 with header line,
      int_edidc like edidc occurs 0 with header line.
select * from zsach1 into corresponding fields of table inttab.
if sy-subrc ne 0.
  message 'no data' type 'I'.
  exit.
endif.
control_dat-mestyp = 'ZSACH'.
control_dat-idoctp = 'ZSACH1'.
control_dat1-segnam = 'ZSACH'.
control_dat-rcvprt = 'LS'.
control_dat-rcvprn =  p_logsys.

loop at inttab.
  gen_data-lname = inttab-lname.
  gen_data-fname = inttab-fname.
  int_edidd-segnam = gen_segment.
  int_edidd-sdata = gen_data.
  append int_edidd.
endloop.
call function 'MASTER_IDOC_DISTRIBUTE'
  exporting
    master_idoc_control                  = control_dat
*   OBJ_TYPE                             = ''
*   CHNUM                                = ''
  tables
    communication_idoc_control           = int_edidc
    master_idoc_data                     = int_edidd
 exceptions
   error_in_idoc_control                = 1
   error_writing_idoc_status            = 2
   error_in_idoc_data                   = 3
   sending_logical_system_unknown       = 4
   others                               = 5
          .
if sy-subrc <> 0.
  message id sy-msgid type sy-msgty number sy-msgno.
else.
  loop at int_edidc.
    write :/ 'IDOC GENERATED',int_edidc-docnum.
  endloop.
  commit work.
endif.

<Added code tags>

can anyone give better solution for this error..

i have searched in SDN but i can't get the better document

thanks in advance.

Regards,

kk

Moderator Message: Please use "code tags" to format your code.

Edited by: Suhas Saha on Nov 9, 2011 12:59 PM

6 REPLIES 6
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
966

Hello kk,

It is very clear from the error message

EDI: Syntax error in IDoc (segment cannot be identified)

that there is some problem with the segment name.

When i look at your code snippet i can see there is a mismatch in the segment names passed in the IDoc control rec & the data rec.

control_dat1-segnam = 'ZSACH'.
....
int_edidd-segnam = gen_segment. "gen_segment like edidd-segnam value 'ZSACH1'
....

BR,

Suhas

PS: Before searching in SDN try to put-in some self-effort, saves time actually

Read only

Former Member
0 Likes
966

hi suhas,

thanks for your quick reply..

i can't get it can u explain cleally..!

Regards,

karunakar

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
966

> i can't get it can u explain cleally..!

I don't like to spoonfeed, debug your code you'll understand

Read only

Former Member
0 Likes
966

hi suhas

thanks for your responce,

i understand where i have done mistake

now i am refering segment name once only

ihad modified the code like this

control_dat-mestyp = 'ZSACH'.
control_dat-idoctp = 'ZSACH1'.
control_dat-rcvprt = 'LS'.
control_dat-rcvprn =  p_logsys.

loop at inttab.
  gen_data-lname = inttab-lname.
  gen_data-fname = inttab-fname.
  int_edidd-segnam = 'Zsach'.
  int_edidd-sdata = gen_data.
  append int_edidd.
endloop.

but i am getting the sam error only.

can u explain.

Regards,

karunakar

Read only

Former Member
0 Likes
966

Hi,

try using upper case


int_edidd-segnam = 'ZSACH'.

Best regards,

Oliver

Read only

Former Member
0 Likes
966

hi friends,

thanks for giving responce for my thread.

resolved my self so i am closing this thread.

Regards,

Karunakar