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

Deleting Segement

former_member187255
Active Contributor
0 Likes
772

Hi Gurus,

When i am trying to delete a segment programatically system is able to delete it successfully but its not getting deleting the child elements of that segment.

How can we delete a Segment(with child segments) programatically is there any function module which can tell the link between parent and child segments..????

Thanks in advance.

Jo.

Hi Gurus,

When i am trying to delete a segment programatically system is able to delete it successfully but its not getting deleting the child elements of that segment.

How can we delete a Segment(with child segments) programatically is there any function module which can tell the link between parent and child segments..????

Thanks in advance.

Jo.

3 REPLIES 3
Read only

Former Member
0 Likes
653

Hi John,

If you are dealing with IDoc, you can use this FM <b>IDOC_SEGMENT_STRUCTURE_READ</b> to read between parent and child segments. Otherwise, just disregard this reply.

You can code something like this ...

REPORT ztest01.

TYPE-POOLS ledid.

PARAMETERS: p_segtyp LIKE edisegmhd-segtyp.

DATA t_segment_struct TYPE ledid_t_segment_struct.

DATA wa_segment_struct LIKE LINE OF t_segment_struct.

CALL FUNCTION 'IDOC_SEGMENT_STRUCTURE_READ'
  EXPORTING
*   RELEASE = SY-SAPRL
    segtyp                    = p_segtyp
*   VERSION = '3'
  TABLES
    segment_struct            = t_segment_struct
  EXCEPTIONS
    segment_unknown           = 1
    segment_structure_unknown = 2
    segment_not_in_release    = 3
    OTHERS                    = 4.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

LOOP AT t_segment_struct INTO wa_segment_struct.
  WRITE:/ wa_segment_struct.
ENDLOOP.

Hope this will help.

Regards,

Ferry Lianto

Please reward points if helpful.

Read only

0 Likes
653

Hello Ferry,

I think the below FM only gives the fieldnames used in that segment, but doesn't let us know the parent child linking relationship.

I think what I understood from John's question is something like below.

For example:

E1MASTL

E1MASAL

E1STKOL

E1STPOL

E1MASTL is a parent segment. It's child are as follows.

So in the above case which function module or database table gives us the parent-child linking relationship.

Thanks.

Regards.

SG

Read only

0 Likes
653

Hi John,

You can use the follwoing function module.

CALL FUNCTION 'IDOCTYPE_READ'

EXPORTING

PI_IDOCTYP = L_IDOCTYP

IMPORTING

PE_ATTRIBUTES = G_IDOCTYP_ATTR

TABLES

PT_SYNTAX = GT_IDOCSYN

PT_PRE_SYNTAX = GT_PREV_IDOCSYN.

You will the entries in table PT_PRE_SYNTAX.

Cheers

Prasad