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

moving structure to idoc SDATA.

Former Member
0 Likes
3,199

Hi Gurus!,

I'm running into the following problem here. I want a line of a structure, referenced to PTEX2010, to be moved to an idoc segment (edidd-sdata to be exact).

But everything I tried resulted in hash key (#) error output in the idoc sdata field where I am expecting values. It seems to go wrong/being messed up when moving fields typed P.

Here's the sample proggie I work with

report  zron_test_idoc.


types: begin of ty_2010.
        include structure ptex2010.
types: end of ty_2010.

data: it_2010 type table of ty_2010.
data: wa_2010 like line of it_2010.
data: t_idoc_data_line type edidd.
data: t_idoc_data type table of edidd.

data: l_sdata type edi_sdata.


data: wa_2222 type string.

field-symbols: <x_struc_2000>    ,
               <x_struc_2010>  type c  .



start-of-selection.

  break-point.

  t_idoc_data_line-segnam = 'Z1PTEX2010'.
  t_idoc_data_line-mandt  = sy-mandt.
  assign wa_2010 to <x_struc_2010> casting .
  t_idoc_data_line-sdata  = <x_struc_2010>.
  append t_idoc_data_line to t_idoc_data.


end-of-selection.

  write: t_idoc_data_line-sdata+300(200).

This is just an example. When you run it you can see the ## # tags where I expected a value. Any ideas how to tranport the work area correctly formatted to the idoc-sdata?

thanks,

Ron.

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
1,757

Hi Ron,

IDOCs are used for data exchange between systems. All segment fields in all IDOCs are defined as pure character fields, the content id pure ASCII . A type P field does not follow any compatible syntax, the representation is not ASCII.

If you want to use IDOC, you can define a segment type with all required fields of PTEX2010 as CHAR with sufficient size. Then you can MOVE-CORRSPONDING PTEX2010 to <IDOC-segment.> and SDATA = <IDOC-segment.>

Regards,

Clemens

P.S.: Created 2 hours before...

Hi Gurus!,

I'm running into the following problem here. I want a line of a structure, referenced to PTEX2010, to be moved to an idoc segment (edidd-sdata to be exact).

But everything I tried resulted in hash key (#) error output in the idoc sdata field where I am expecting values. It seems to go wrong/being messed up when moving fields typed P.

Here's the sample proggie I work with

report  zron_test_idoc.


types: begin of ty_2010.
        include structure ptex2010.
types: end of ty_2010.

data: it_2010 type table of ty_2010.
data: wa_2010 like line of it_2010.
data: t_idoc_data_line type edidd.
data: t_idoc_data type table of edidd.

data: l_sdata type edi_sdata.


data: wa_2222 type string.

field-symbols: <x_struc_2000>    ,
               <x_struc_2010>  type c  .



start-of-selection.

  break-point.

  t_idoc_data_line-segnam = 'Z1PTEX2010'.
  t_idoc_data_line-mandt  = sy-mandt.
  assign wa_2010 to <x_struc_2010> casting .
  t_idoc_data_line-sdata  = <x_struc_2010>.
  append t_idoc_data_line to t_idoc_data.


end-of-selection.

  write: t_idoc_data_line-sdata+300(200).

This is just an example. When you run it you can see the ## # tags where I expected a value. Any ideas how to tranport the work area correctly formatted to the idoc-sdata?

thanks,

Ron.

4 REPLIES 4
Read only

tushar_shukla
Active Participant
0 Likes
1,757

Check the following code :


data: t_idoc_data_line type edidd,
        t_idoc_data type table of edidd. 
 
data  wa_z1ptex2010 type Z1PTEX2010. 

*Populate the Z1PTEX2010 segment
wa_z1ptex2010-field1 = .........
..........................................
........................................

t_idoc_data_line-sdata  = wa_z1ptex2010.
 t_idoc_data_line-segnam = 'Z1PTEX2010'.    
  append t_idoc_data_line to t_idoc_data.

Read only

brad_bohn
Active Contributor
0 Likes
1,757

Use the corresponding DDIC structure for your segment definition, then move that work area to SDATA. See any of the outbound process code examples in the system. You don't need the field symbols...

Read only

Clemenss
Active Contributor
0 Likes
1,758

Hi Ron,

IDOCs are used for data exchange between systems. All segment fields in all IDOCs are defined as pure character fields, the content id pure ASCII . A type P field does not follow any compatible syntax, the representation is not ASCII.

If you want to use IDOC, you can define a segment type with all required fields of PTEX2010 as CHAR with sufficient size. Then you can MOVE-CORRSPONDING PTEX2010 to <IDOC-segment.> and SDATA = <IDOC-segment.>

Regards,

Clemens

P.S.: Created 2 hours before...

Read only

Former Member
0 Likes
1,757

Exactly the case Clemens,

We discovered that the Z.. segment of the idoc also had type references that contained P! So that's not allowed as well.

After changing the segment-types from P to C AND changing the program a little it worked like a charm.

thanks all for your contributions!

cheers,

Ron.