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

idocs sdata

Former Member
0 Likes
720

hi,

i have an internal table int_edidd of type edidd.

int_edidd-sdata = shilpi,pasricha

i want to store this in filelds fname(shilpi) and lname(pasricha) in a table zidoc3.

how to split the sdata?

please guide.

shilpi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
676

Declare a structure like the segment type.

Suppose the segment name is E1EDK01.

declare a structure of type E1EDK01.

ex:

lw_E1EDK01 type E1EDK01.

Now,


Loop Idocdata.
 if Idocdata-segname eq 'E1EDK01'.
    move Idocdata-sdata to lw_E1EDK01.

* Now you can access the fields like
  lw_E1EDK01-fname = 'shilpi'.
  lw_E1EDK01-fname = 'pasricha].

  move lw_E1EDK01 to Idocdata-sdata.
  modify Idocdata from Idocdata-sdata
                  Transporting sdata. 
    
 endif. 
 clear: Idocdata.

endloop. 

4 REPLIES 4
Read only

Former Member
0 Likes
676

Hi,

Declare two variables,

data:v_var1(500) type c,
       v_var2(500) type c,
       v_len type i.
v_len = STRLEN( int_edidd-sdata).

if v_len gt 500.
v_var1 = int_edidd-sdata+0(500).
shift int_edidd-sdat left by 500 places.
v_len = STRLEN( int_edidd-sdata).
v_var2 = int_edidd-sdata+0(v_len).
else.
v_Var1 = int_edidd-sdata+0(v_len).
endif.
zdoc1-fname = v_var1.
zdoc1-lname = v_var2.

Regards

Kannaiah

Read only

Former Member
0 Likes
677

Declare a structure like the segment type.

Suppose the segment name is E1EDK01.

declare a structure of type E1EDK01.

ex:

lw_E1EDK01 type E1EDK01.

Now,


Loop Idocdata.
 if Idocdata-segname eq 'E1EDK01'.
    move Idocdata-sdata to lw_E1EDK01.

* Now you can access the fields like
  lw_E1EDK01-fname = 'shilpi'.
  lw_E1EDK01-fname = 'pasricha].

  move lw_E1EDK01 to Idocdata-sdata.
  modify Idocdata from Idocdata-sdata
                  Transporting sdata. 
    
 endif. 
 clear: Idocdata.

endloop. 

Read only

0 Likes
676

what about the 'comma' that separates shilpi and pasricha?

regards

shilpi

Read only

0 Likes
676

If you want to have the split at comma, then do like this

split int_edidd  at ',' into  fname lname.

Regards

Kannaiah