‎2011 Nov 09 7:08 AM
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
‎2011 Nov 09 7:43 AM
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
‎2011 Nov 09 8:31 AM
hi suhas,
thanks for your quick reply..
i can't get it can u explain cleally..!
Regards,
karunakar
‎2011 Nov 09 9:37 AM
> i can't get it can u explain cleally..!
I don't like to spoonfeed, debug your code you'll understand
‎2011 Nov 09 9:53 AM
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
‎2011 Nov 09 10:04 AM
Hi,
try using upper case
int_edidd-segnam = 'ZSACH'.
Best regards,
Oliver
‎2011 Nov 10 6:41 AM
hi friends,
thanks for giving responce for my thread.
resolved my self so i am closing this thread.
Regards,
Karunakar