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

Idoc nested segment fields update

Former Member
0 Likes
1,262

Hi all,

I have a requirement like this

I have an IDOC say DOC1

DOC1 has a segment say SEG1

SEG1 has a child segment say CLD1

CLD1 has a filed say FLD1 .

i need to update the data in field FLD1.

can any one please tel me how to read data in the FLD1 and how can I update that.

5 REPLIES 5
Read only

ferry_lianto
Active Contributor
0 Likes
850

Hi Vijay,

Please check this link for sample codes on how to update segment field.

http://www.erpgenie.com/sapedi/idoc_abap.htm#Updating%20IDoc%20data%20in%20segments

Regards,

Ferry Lianto

Read only

0 Likes
850

hi ferry,

Thanks for replying

The solution given in that path does not talk about nested child segment.

can u suggest me any other approch

Read only

former_member187255
Active Contributor
0 Likes
850

Vijay,

You can try this example ...

 
describe table dedidd lines l_count.
loop at dedidd from v_index to l_count.
   read table dedidd into st_dedidd index v_index.
     if st_dedidd-segnam eq 'CLD1'.
         st_dedidd-sdata+3(15) = 'Test'." Updated values
         modify dedidd index sy-tabix from st_dedidd.
     endif.
endloop.

Hope this helps to move forward....

Message was edited by:

Ch@ndra

Read only

ferry_lianto
Active Contributor
0 Likes
850

Hi Vijay,

Basically, it is used the same approach to update parent/child segment(s). You need to loop at internal table EDIDD and find the corresponding segment. Then you move to work area, do the modification and lastly update the internal table EDIDD with new value(s).

Please follow step 2 to read and update the child segment field.


DATA: wa_cld1 like CLD1.

LOOP AT itab_edidd WHERE segnam = 'CLD1'. 

  wa_cld1 = itab_edidd-sdata. 

  IF wa_cld1-field1 = <the condition>. 

    wa_cld1-field1 = <new value>. 

    itab_edidd-sdata = wa_cld1. 

    MODIFY itab_edidd.

    EXIT.
 
  ENDIF.
ENDLOOP. 

Regards,

Ferry Lianto

Read only

0 Likes
850

Hi friends

thanks for giving me valuable suggestions.

I got the concept.

I m new to IDOC ....

it will be a great help if u can send me some study material on IDOC

my id is venkat_info@yahoo.com