Skip to Content

This weblog is replacing Mukund Goenka‘s Blog Render an Idoc Schema onto a Spreadsheet.

Introduction

The process of rendering an IDoc schema onto a spreadsheet is part of creating the Business Mappings in the development of Building an XI content package. Before creating the Technical Mappings using the graphical mapping tool, you first do the Business Mappings and understand the importance of business mappings. The easiest tool for business mappings is the Spreadsheet (XSL). This weblog will describe the creation of a Spreadsheet Template for an IDoc. A separate weblog describing the creation of a Spreadsheet Template for an XSD Schema will be published later in SDN.

Background

Business mappings define how the fields of the target Interface need to be filled from a functional (business) point of view. An initial step in the business mapping process is to know the details, at the field level, of the structures that need to be mapped. The creation of business mappings requires the knowledge of the backend application, the interface used by the backend application, and the Industry Standard Interface. Therefore, you first need to possess the two structures:

    1. An interface structure from the SAP side (IDoc for the purpose of this weblog)
    2. The Industry Standards interface structure from the non-SAP side (e.g. a RosettaNet PIP)

Then you will map the two structures based on your functional knowledge. This initial business mapping can be done using the Spreadsheet. The field list of the target interface is created automatically using spreadsheet creation tool.  This Spreadsheet mapping will form the basis on which you will later build the Technical mapping using XI.

System Requirements

In order to be able to create a spreadsheet template with the method described in this weblog the following system requirements must be met:

    1. R/3 system (release 4.6C only, with the application layer – not just basis)
    2. MS Excel on your local machine

Execution

After you have implemented the required coding as described in the appendix, you can create a spreadsheet template using the following steps:

  • Enter program Z_RIDOCSHOW and execute it (function key F8).
  • On the selection screen enter the IDoc name you want to have the spreadsheet created for (for example ORDERS05). Leave the flags unchanged.
  • You will see that a MS Excel Spreadsheet opens up automatically, with the IDOC data loaded onto the spreadsheet.
  • Give an appropriate name to the spreadsheet before saving it.

Appendix

In this appendix we describe step by step how to create the required objects in order to run the program Z_RIDOCSHOW successfully.

Note that this code sample only works in an SAP R/3 4.6C environment.

1&nbsp Data Dictionary Elements

The following data dictionary elements need to be created:

1.1&nbsp Data Elements

We need to create the data element ZDESCRP using the following steps:

  1. Start transaction SE11.
  2. Select Data type, enter the name ZDESCRP and click on Create.
  3. In the popup select Data element and continue.
  4. Enter a short text, e.g. Description.
  5. Under the tab Definition select the data type Elementary type and Build-in type and enter the data type CHAR and the length 200.

image

    1. Under the tab Field label enter the field labels, e.g. Description.
    2. Save and activate the data element.

1.2 Structures

We need to create the structure ZIDOC_STRUCT using the following steps:

  1. Start transaction SE11.
  2. Select Data type, enter the name ZIDOC_STRUCT and click on Create.
  3. In the popup select Structure and continue.
  4. Enter a short text, e.g. IDoc structure used for the Mappings.
  5. Under the tab Components enter the list of Components and Component types as shown in the picture below:

    DDIC2.png

  6. Save and activate the structure.

1.3Table Types

We need to create the table type ZT_IDOC_STRUCT using the following steps:

  1. Start transaction SE11.
  2. Select Data type, enter the name ZT_IDOC_STRUCT and click on Create.
  3. In the popup select Table type and continue.
  4. Enter a short text, e.g. Table Type for IDoc Structure for Mappings.
  5. Under the tab Row type and access select the row type Row type, enter ZIDOC_STRUCT as the row type, and select the access mode Standard table.
  6. Save and activate the structure.

2 Program Z_RIDOCSHOW

Z_RIDOCSHOW is the program that needs to be executed for the creation of the spreadsheet. We can create this program using the following steps:

  1. Start transaction SE38.
  2. Enter program Z_RIDOCSHOW and click on Create.
  3. In the popup enter a title, e.g. xxx, select the attribute type Executable program, and click on Save.
  4. Enter the following source code:

REPORT Z_RIDOCSHOW .

TABLES: sed5struc.

TYPE-POOLS: LEDID.

TYPES: BEGIN OF ty_output,          ID LIKE snodetext-id,          name LIKE snodetext-name,          tlevel LIKE snodetext-tlevel,          text8 LIKE snodetext-text8,          tlength8 LIKE snodetext-tlength8,          text9 LIKE snodetext-text9,          tlength9 LIKE snodetext-tlength9,        END OF ty_output.

—-


  1. selections                                                           *

—-


SELECTION-SCREEN BEGIN OF BLOCK selection WITH FRAME TITLE text-011. SELECT-OPTIONS sc_idoc FOR sed5struc-object NO INTERVALS NO-EXTENSION                OBLIGATORY MEMORY ID idoc. SELECTION-SCREEN END OF BLOCK selection.

*— options SELECTION-SCREEN BEGIN OF BLOCK control                  WITH FRAME TITLE text-012. PARAMETERS: p_basic  LIKE SED5STRUC-SELECT_ORG DEFAULT ‘X’. PARAMETERS: p_ext    LIKE SED5STRUC-SELECT_EXT. SELECTION-SCREEN END OF BLOCK control.

START-OF-SELECTION.

  REFRESH sc_idoc.

  sed5struc-object     = sc_idoc-low.   sed5struc-select_org = p_basic.   sed5struc-select_ext = p_ext.   IF sed5struc-object IS INITIAL.     MESSAGE e001(idmc).     EXIT.   ENDIF.

  IF NOT sed5struc-select_org IS INITIAL.     DATA : l_idoctype LIKE edi_iapi00-idoctyp.

    l_idoctype = sed5struc-object.

    CALL FUNCTION ‘IDOCTYPE_EXISTENCE_CHECK’          EXPORTING               pi_idoctyp       = l_idoctype          EXCEPTIONS               object_not_found = 1               db_error         = 2               OTHERS           = 3.     CASE sy-subrc.       WHEN 0.   ” ok       WHEN OTHERS.         MESSAGE ID sy-msgid TYPE ‘E’ NUMBER sy-msgno WITH             sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.         EXIT.     ENDCASE.

  1. does the user request an extension type

  ELSEIF NOT sed5struc-select_ext IS INITIAL.

    DATA: l_cimtype  LIKE edi_iapi00-cimtyp.     l_cimtype = sed5struc-object.

    CALL FUNCTION ‘EXTTYPE_EXISTENCE_CHECK’          EXPORTING               pi_cimtyp        = l_cimtype          EXCEPTIONS               object_not_found = 1               db_error         = 2               OTHERS           = 3.     CASE sy-subrc.       WHEN 0.   ” ok       WHEN OTHERS.         MESSAGE ID sy-msgid TYPE ‘E’ NUMBER sy-msgno WITH             sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.         EXIT.     ENDCASE.   ENDIF.

END-OF-SELECTION.

  DATA: l_objecttype TYPE c,         l_obj        TYPE edi_iapi00-idoctyp,         released     LIKE sy-saprl,         version      LIKE edi_verrec-version.

  released = sy-saprl.   version  = ‘3’.   l_obj = sed5struc-object.

  IF NOT sed5struc-select_ext IS INITIAL.     l_objecttype = ‘E’.   ELSEIF NOT sed5struc-select_org IS INITIAL.     l_objecttype = ‘B’.   ENDIF.

*=======================   DATA: l_tree TYPE snodetext OCCURS 1,         lt_final TYPE zt_idoc_struct.

  CALL FUNCTION ‘ZEDI_FILL_IDOC_TREE’        EXPORTING             object                = l_obj             object_type           = l_objecttype             object_release        = released             pi_rec_version        = version             enable_further_output = ‘X’        TABLES             pt_idocstruct         = lt_final        EXCEPTIONS             OTHERS                = 1.   IF sy-subrc NE 0.     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH         sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.   ENDIF.

*=========================

  CONCATENATE l_idoctype ‘.xls’ INTO l_idoctype.

  CALL FUNCTION ‘WS_EXCEL’        EXPORTING             filename = l_idoctype             synchron = ‘ ‘        TABLES             data     = lt_final.

    1. Save and activate the program.

3&nbsp Function Group ZEDIT

The program Z_RIDOCSHOW requires a number of function modules to be created in order to be able to run. These function modules are placed in the function group ZEDIT.

3.1&nbsp Function Group ZEDIT

First we need to create the function group ZEDIT using the following steps:

  1. Start transaction SE80.
  2. In the upper left box choose Development class or Local objects depending on your specific requirements and enter the appropriate value (name of the development class or user name for the local objects) in the field underneath and click on the eyeglasses.
  3. Right click on the first entry of the tree and select Create and Function group.

image

    1. In the popup enter the function group ZEDIT, a short text, and click on Save.

3.2&nbsp Include LZEDITTOP

The include LZEDITTOP contains the global data definitions for the function group. We can create this include using the following steps:

  1. Start transaction SE38.
  2. Enter program LZEDITTOP and click on Change (the include has already been created with the creation of the function group).
  3. Enter the following source code:

  4. Save and activate the include.

3.3&nbsp Function Module ZEDI_FILL_IDOC_TREE

We can create the function module ZEDI_FILL_IDOC_TREE using the following steps:

  1. Start transaction SE37.
  2. Enter function module ZEDI_FILL_IDOC_TREE and click on Create.
  3. In the popup enter the function group ZEDIT, a short text, and click on Save.
  4. Under the tab Import enter the Parameter names, Reference types, Default values, and the flags Optional and Pass value as shown in the picture below:

    !https://weblogs.sdn.sap.com/weblogs/images/41850/FM1.png|height=176|alt=image|width=383|src=https://weblogs.sdn.sap.com/weblogs/images/41850/FM1.png|border=0!

  5. Under the tab Tables enter the Parameter names, Reference types, and the flag Optional as shown in the picture below:

    !https://weblogs.sdn.sap.com/weblogs/images/41850/FM2.png|height=114|alt=image|width=382|src=https://weblogs.sdn.sap.com/weblogs/images/41850/FM2.png|border=0!

  6. Under the tab Source code enter the following source code:

FUNCTION zedi_fill_idoc_tree. *”—-


“Local interface: *”  IMPORTING *”     VALUE(OBJECT) TYPE  LEDID_IDOCTYPE *”     VALUE(OBJECT_TYPE) TYPE  LEDID_STRUCT_TYPE *”     VALUE(OBJECT_RELEASE) LIKE  SY-SAPRL DEFAULT SY-SAPRL *”     VALUE(PI_REC_VERSION) LIKE  EDI_VERREC-VERSION DEFAULT ‘3’ *”     VALUE(ENABLE_FURTHER_OUTPUT) TYPE  LEDID_FLAG DEFAULT ‘X’ *”  TABLES *”      PT_IDOCSTRUCT TYPE  ZT_IDOC_STRUCT *”—-


  TYPES: BEGIN OF ty_pre,            tlevel   TYPE i,            pre(150) TYPE c,          END OF ty_pre.

  DATA: ls_idocstruct  TYPE zidoc_struct,         ls_tree        TYPE snodetext,         ls_idoc        TYPE ledid_idoc_struct,         ls_segment     TYPE ledid_segment,         ls_fields      TYPE ledid_segment_struct,         ls_pre         TYPE ty_pre,         lt_pre         TYPE STANDARD TABLE OF ty_pre,         l_pre(200)     TYPE c,         l_index        TYPE i.

  1. initialize global tables

  REFRESH: t_idoc,            t_segments,            t_fields.

  CALL FUNCTION ‘IDOC_TYPE_COMPLETE_READ’        EXPORTING             struct_type    = object_type             idoctype       = object             release        = object_release             version        = pi_rec_version        IMPORTING             idoc_type      = idoc        TABLES             idoc_struct    = t_idoc             segments       = t_segments             segment_struct = t_fields        EXCEPTIONS             OTHERS         = 1.   CASE sy-subrc.     WHEN 0.

  1.     fill global variable G_OBJECT_RELEASE

      g_object_release = object_release.

  1.     fill global variable G_OBJECT_VERSION

      g_object_version = pi_rec_version.

  1.     an IDoc type is now displayed

      g_mode = ‘I’.

  1.     initialize global tables and data

      REFRESH t_excl.

      CALL FUNCTION ‘ZEDI_CONVERT_IDOC_TAB_TO_TREE’            TABLES                 tree = tree.

      CALL FUNCTION ‘RS_TREE_CONSTRUCT’            TABLES                 nodetab = tree.

      SORT: t_idoc     BY segment_type,             t_segments BY segment_type,             t_fields   BY segment_type  fieldname.

      ls_idocstruct-id = ‘ID’.       ls_idocstruct-fld_segtyp = ‘Path’.       ls_idocstruct-name = ‘Name’.       ls_idocstruct-tlevel = ‘Depth’.       ls_idocstruct-idoc_mustfl = ‘Mandatory’.       ls_idocstruct-idoc_occmin = ‘Seg_OccMin’.       ls_idocstruct-idoc_occmax = ‘Seg_occMax’.       ls_idocstruct-fld_datatype = ‘Type’.       ls_idocstruct-fld_domname = ‘DomName’.       ls_idocstruct-fld_decimals = ‘DECIML’.       ls_idocstruct-fld_signflag = ‘Sign’.       ls_idocstruct-fld_extlen = ‘Len’.       ls_idocstruct-text9 = ‘Text’.

      APPEND ls_idocstruct TO pt_idocstruct.       CLEAR: ls_idocstruct.

      LOOP AT tree INTO ls_tree.         MOVE-CORRESPONDING ls_tree TO ls_idocstruct.

        IF ls_tree-type = ‘TB’.

          CLEAR ls_pre.

          IF ls_tree-tlevel = 2.             REFRESH lt_pre.             CLEAR l_pre.             ls_pre-tlevel = 1.             APPEND ls_pre TO lt_pre.           ENDIF.

          IF ls_tree-tlevel = 2.             l_pre = ls_tree-name.           ELSEIF ls_tree-tlevel > 2.             l_index = ls_tree-tlevel – 1.             READ TABLE lt_pre INTO ls_pre INDEX l_index.             CONCATENATE ls_pre-pre ‘ /’ ls_tree-name INTO l_pre.           ENDIF.

          ls_pre-tlevel = ls_tree-tlevel.           ls_pre-pre    = l_pre.           INSERT ls_pre INTO lt_pre INDEX ls_tree-tlevel.

          READ TABLE t_idoc INTO ls_idoc                WITH KEY segment_type = ls_tree-name                BINARY SEARCH.           IF sy-subrc IS INITIAL.             ls_idocstruct-idoc_mustfl = ls_idoc-syntax_attrib-mustfl.             ls_idocstruct-idoc_occmin = ls_idoc-syntax_attrib-occmin.             ls_idocstruct-idoc_occmax = ls_idoc-syntax_attrib-occmax.           ENDIF.

        ELSEIF ls_tree-type = ‘DE’.

          READ TABLE t_fields INTO ls_fields                WITH KEY segment_type = ls_tree-text7                         fieldname    = ls_tree-name                BINARY SEARCH.           IF sy-subrc IS INITIAL.            ls_idocstruct-fld_decimals = ls_fields-field_attrib-decimals.            ls_idocstruct-fld_signflag = ls_fields-field_attrib-signflag.             ls_idocstruct-fld_extlen = ls_fields-field_attrib-extlen.             ls_idocstruct-fld_domname = ls_fields-field_attrib-domname.            ls_idocstruct-fld_datatype = ls_fields-field_attrib-datatype.           ENDIF.

        ENDIF.

        ls_idocstruct-fld_segtyp = l_pre.

        APPEND ls_idocstruct TO pt_idocstruct.         CLEAR: ls_idoc, ls_segment, ls_fields, ls_idocstruct.       ENDLOOP.

    WHEN OTHERS.       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.   ENDCASE.

ENDFUNCTION.

    1. Save and activate the function module.

3.4&nbsp Function Module ZEDI_CONVERT_IDOC_TAB_TO_TREE

We can create the function module ZEDI_CONVERT_IDOC_TAB_TO_TREE using the following steps:

  1. Start transaction SE37.
  2. Enter function module ZEDI_CONVERT_IDOC_TAB_TO_TREE and click on Create.
  3. In the popup enter the function group ZEDIT, a short text, and click on Save.
  4. Under the tab Tables enter the Parameter names, Reference types, and the flag Optional as shown in the picture below:

    !https://weblogs.sdn.sap.com/weblogs/images/41850/FM3.png|height=114|alt=image|width=383|src=https://weblogs.sdn.sap.com/weblogs/images/41850/FM3.png|border=0!

  5. Under the tab Source code enter the following source code:

FUNCTION zedi_convert_idoc_tab_to_tree. *”—-


“Local interface: *”  TABLES *”      TREE STRUCTURE  SNODETEXT *”—-


  DATA: wa_idoc         TYPE ledid_idoc_struct.

  REFRESH: tree.

  1. IDOC contains the object type: basis idoc type, extension type
  2. or idoc type.

  1. get user specific attribute setting
  2. perform fa2_get_user_attributes  using edi_attrib.

  PERFORM fa2_get_user_attributes_all.

  1. construct tree based on idoc type data and flags

  PERFORM f01_construct_root_node TABLES   tree                                   CHANGING edi_attrib.

  1. construct every other node

  LOOP AT t_idoc INTO wa_idoc.

  1. new reference segment starts here? insert dummy node, set level to 2
  2.   IF last_refsegment NE wa_idoc-ref_segment.
  3.     last_refsegment = wa_idoc-ref_segment.
  4.    PERFORM f01_construct_refsegment_node TABLES tree
  5.                                           USING wa_idoc.
  6.   ENDIF.

    PERFORM f01_construct_segment_node TABLES tree                                        USING  wa_idoc                                               edi_attrib.

  1. adjust attributes in IDoc table according to L_ATTRIBUTES

    IF edi_attrib-do2 EQ on.       wa_idoc-dont_show_docu = off.     ELSE.       wa_idoc-dont_show_docu = on.     ENDIF.     IF edi_attrib-at2 EQ on.       wa_idoc-dont_show_attrib = off.     ELSE.       wa_idoc-dont_show_attrib = on.     ENDIF.     MODIFY t_idoc FROM wa_idoc.

  ENDLOOP.

ENDFUNCTION.

    1. Save and activate the function module.

3.5&nbsp Include LZEDITF01

The include LZEDITF01 contains the following form routines used within the function group:

    1. F01_CONSTRUCT_FIELD_NODE
    2. F01_CONSTRUCT_ROOT_NODE
    3. F01_CONSTRUCT_SEGMENT_NODE
    4. F01_CONSTRUCT_SINGLE_FIELD
    5. FA1_ADD_CHECKBOX
    6. FA2_FILL_FIELD
    7. FA2_GET_USER_ATTRIBUTES_ALL

We can create this include using the following steps:

  1. Start transaction SE37.
  2. Enter function module ZEDI_CONVERT_IDOC_TAB_TO_TREE and click on Display.
  3. Within the source code scroll to the line PERFORM FA2_GET_USER_ATTRIBUTES_ALL and double click on the string FA2_GET_USER_ATTRIBUTES_ALL.
  4. In the popup that asks you if you want to create the object click on Yes.
  5. The next popup suggests to use the include LZEDITF01 for the subroutine. Confirm this suggestion.
  6. Enter the following source code (overwrite the suggested code):

—-


***INCLUDE LZEDITF01 . —-


&—-


*&      Form  FA2_GET_USER_ATTRIBUTES_ALL &—-


FORM fa2_get_user_attributes_all.

  CLEAR: edi_attrib,          edi_idcatt,          edi_cfile,          edi_htmfil.

  CALL FUNCTION ‘IDOC_CONFIGURE_DOC’        EXPORTING             service            = ‘R’        CHANGING             attrib_data        = edi_attrib             idcatt_data        = edi_idcatt             cfile_data         = edi_cfile             htmlfile_data      = edi_htmfil        EXCEPTIONS             undefined_service  = 1             user_action_cancel = 2             OTHERS             = 3.

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

ENDFORM.                    ” FA2_GET_USER_ATTRIBUTES_ALL

&—-


*&      Form  F01_CONSTRUCT_ROOT_NODE &—-


FORM f01_construct_root_node TABLES   p_tree STRUCTURE snodetext                              CHANGING p_attrib LIKE edi_attrib.

  1. set attributes in IDOC according to P_ATTRIB

  idoc-dont_show_docu = p_attrib-do1.   m_toggle idoc-dont_show_docu.        ” negative logic!   idoc-dont_show_attrib = p_attrib-at1.   m_toggle idoc-dont_show_attrib.      ” negative logic!

  CLEAR p_tree.   p_tree-type      = ‘H’.   p_tree-tlevel    = 1.

  1. fill IDOCTYP/CIMTYP and type description into TREE-NAME

  IF idoc-idoc_type_attrib-struct_type EQ ledid_extended_idoc_type_id.     p_tree-name      = idoc-idoc_type_attrib-extension_type.   ELSE.     p_tree-name      = idoc-idoc_type.   ENDIF.   p_tree-nlength   = 30.   p_tree-color     = 1.   p_tree-intensiv  = 1.

  1. show description in the last text field

  PERFORM fa2_fill_field USING p_tree on ‘9’ ‘T’                                idoc-idoc_type_attrib-descrp(75).

  1. add checkbox for attributes

  PERFORM fa1_add_checkbox  USING p_tree                                   p_attrib-at1                                   ‘/’             ” no documentation                                   ‘/’.            ” no values

  APPEND p_tree.

ENDFORM.                    ” F01_CONSTRUCT_ROOT_NODE

&—-


*&      Form  F01_CONSTRUCT_SEGMENT_NODE &—-


FORM f01_construct_segment_node TABLES p_tree STRUCTURE snodetext                                 USING  p_wa_idoc  TYPE ledid_idoc_struct                                        p_attrib   LIKE edi_attrib.

  1. construct node for a segment

  CLEAR p_tree.

  p_tree-type      = ‘TB’.

  IF p_wa_idoc-syntax_attrib-parseg EQ space.     IF p_wa_idoc-syntax_attrib-occmax EQ 1.

  1. subtree starts with level 1

      lev_offset = 1.     ELSE.

  1. subtree starts with level 2

      lev_offset = 0.     ENDIF.

  1. handle extension types a bit differently (refence segments occupy
  2. one hierarchy level)

    IF idoc-idoc_type_attrib-struct_type EQ ledid_extension_type_id.       lev_offset = lev_offset + 1.     ENDIF.   ENDIF.

  p_tree-tlevel  = p_wa_idoc-syntax_attrib-hlevel + lev_offset.

  1. segment type name and description

  p_tree-color     = 4.

  1. set different intensity for a leaf than for a node that has children

  IF p_wa_idoc-syntax_attrib-parflg EQ on.     p_tree-intensiv  = ‘1’.   ELSE.     p_tree-intensiv  = ‘0’.   ENDIF.   p_tree-name      = p_wa_idoc-segment_type.

  p_tree-nlength = 30.

  1. display description

  PERFORM fa2_fill_field USING p_tree on ‘9’ ‘T’                                p_wa_idoc-segment_type_attrib-descrp.

  1. add checkboxes for attributes and documentation

  PERFORM fa1_add_checkbox  USING p_tree                                   p_attrib-at2                                   p_attrib-do2                                   ‘/’.

  APPEND p_tree.

  1. add segment fields as a separate node

  PERFORM f01_construct_field_node TABLES p_tree                                    USING  p_wa_idoc-segment_type                                           p_tree-tlevel                                           p_attrib.

ENDFORM.                               ” F01_CONSTRUCT_SEGMENT_NODE

&—-


*&      Form  F01_CONSTRUCT_FIELD_NODE &—-


FORM f01_construct_field_node TABLES   p_tree STRUCTURE snodetext                            USING  p_segment_type LIKE edisegmhd-segtyp                                   p_tlevel LIKE streenode-tlevel                                   p_attrib LIKE edi_attrib.

  DATA: l_level          LIKE streenode-tlevel,         l_field          TYPE ledid_segment_struct.

  1. calculate hierarchy level for the current node

  l_level = p_tlevel + 1.

  1. create parent node for fields

  CLEAR p_tree.   p_tree-type      = ‘D’.   p_tree-tlevel    = l_level.   p_tree-name      = text-101.   p_tree-nlength   = strlen( p_tree-name ).   p_tree-color     = 2.   p_tree-intensiv  = ‘0’.   APPEND p_tree.

  LOOP AT t_fields INTO l_field      WHERE segment_type = p_segment_type.

  1. create a node for each field

    PERFORM f01_construct_single_field TABLES p_tree                                        USING  l_field                                               l_level                                               p_attrib.

  1. adjust attributes in IDoc table according to L_ATTRIBUTES
  2. (fields in structures do have a negative logic!)

    l_field-dont_show_docu = p_attrib-do3.     m_toggle l_field-dont_show_docu.     l_field-dont_show_attrib = p_attrib-at3.     m_toggle l_field-dont_show_attrib.     l_field-dont_show_values = p_attrib-val.     m_toggle l_field-dont_show_values.     MODIFY t_fields FROM l_field.

  ENDLOOP.

ENDFORM.                               ” F01_CONSTRUCT_FIELD_NODE

&—-


*&      Form  F01_CONSTRUCT_SINGLE_FIELD &—-


FORM f01_construct_single_field TABLES p_tree STRUCTURE snodetext                                 USING  p_field TYPE ledid_segment_struct                                        p_level LIKE streenode-tlevel                                        p_attrib LIKE edi_attrib.

  CLEAR p_tree.   p_tree-type      = ‘DE’.   p_tree-tlevel    = p_level + 1.   p_tree-name      = p_field-fieldname.   p_tree-text7     = p_field-segment_type.     ” hide segment name   p_tree-text8     = p_field-field_attrib-rollname. ” hide data element   p_tree-nlength   = 30.   p_tree-color     = 2.   p_tree-intensiv  = ‘0’.

  1. add field description

  PERFORM fa2_fill_field USING p_tree on ‘9’ ‘T’                                p_field-field_attrib-descrp.

  1. add checkboxes for attributes, documentation and field values

  PERFORM fa1_add_checkbox  USING p_tree                                   p_attrib-at3                                   p_attrib-do3                                   p_attrib-val.   APPEND p_tree. ENDFORM.                               ” F01_CONSTRUCT_SINGLE_FIELD

&—-


*&      Form  FA1_ADD_CHECKBOX &—-


FORM fa1_add_checkbox  USING p_node STRUCTURE snodetext                              p_attr LIKE edi_attrib-do1                              p_docu LIKE edi_attrib-at1                              p_valu LIKE edi_attrib-val.

  1. set MOREINFO flag if at least one checkbox is positive

  IF p_attr EQ on OR      p_docu EQ on OR      p_valu EQ on.     p_node-moreinfo = on.   ENDIF.

  IF p_attr EQ ‘/’.

  1. deactivate this field

    p_node-tlength2 = 0.   ELSE.     CASE p_attr.       WHEN on.

  1. add filled checkbox for attributes

        p_node-text2 = ‘SYM_FILLED_SQUARE’.       WHEN off.

  1. add empty checkbox for attributes

        p_node-text2 = ‘SYM_SQUARE’.     ENDCASE.     p_node-hotspot2 = on.     p_node-tlength2 = 1.     p_node-kind2    = ‘S’.     p_node-tcolor2  = 3.     p_node-tintensiv2 = ‘0’.   ENDIF.

  IF p_docu EQ ‘/’.

  1. deactivate this field

    p_node-tlength3 = 0.   ELSE.     CASE p_docu.       WHEN on.

  1. add filled checkbox for documentation

        p_node-text3 = ‘SYM_FILLED_CIRCLE’.       WHEN off.

  1. add empty checkbox for documentation

        p_node-text3 = ‘SYM_CIRCLE’.     ENDCASE.     p_node-hotspot3 = on.     p_node-tlength3 = 1.     p_node-kind3    = ‘S’.     p_node-tcolor3  = 3.     p_node-tintensiv3 = ‘0’.   ENDIF.

  IF p_valu EQ ‘/’.

  1. deactivate this field

    p_node-tlength4 = 0.   ELSE.     CASE p_valu.       WHEN on.

  1. add filled checkbox for values

        p_node-text4 = ‘SYM_FILLED_DIAMOND’.       WHEN off.

  1. add empty checkbox for values

        p_node-text4 = ‘SYM_DIAMOND’.     ENDCASE.     p_node-hotspot4 = on.     p_node-tlength4 = 1.     p_node-kind4    = ‘S’.     p_node-tcolor4  = 3.     p_node-tintensiv4 = ‘0’.   ENDIF.

ENDFORM.

&—-


*&      Form  FA2_FILL_FIELD &—-


FORM fa2_fill_field USING    p_tree  STRUCTURE snodetext                              value(p_adjust_length) TYPE ledid_flag                              value(p_field_number) TYPE c                              value(p_format) TYPE c                              value(p_value).

  FIELD-SYMBOLS: .

  1. all field names are now built

  = p_value.

  1. adjust length?

  IF p_adjust_length EQ on.    

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

    1. Claus Wallacher
      Hi Sravya,

      if you read the very first line of the weblog, you will see that this weblog replaces the old one from Mukund. Reason for doing this was the fact that the old weblog did not contain the complete coding required to run this program. Since it was not possible to update the old weblog, a new one had to be created.

      Regards,
      Claus

      (0) 
  1. Srinath varadarajan
    hi,

    i have a similar requirement in ECC 5.0 but there are certain satndard function modules like IDOC_CONFIGURE_DOC and IDOC_CONFIGURE_0020 are misiing in the ecc 5.0 can you please help me out with this requiremnt.
    Can you please suggect me any of the alternate function modules in the ecc 5.0 .

    Regards
    Srinath

    (0) 
    1. Yukai Shi Post author
      Hi Srinath,

      ECC 5.0 has changed the ABAP coding, and those two modules are not the only ones missing to generate the spreadsheet. Unfortunately, we do not have the resource to re-do the coding for ECC 5.0 currently. I will check with our colleagues to see if there is any alternate. My quick guess is it would be faster and easier for you to start coding from the scratch to fullfil the requirement.

      Best regards,
      Yukai

      (0) 
  2. Apoorva Singh
    I  was following this nicely explained weblog to help me to get Idoc structures schemas to an excel file but i encounter the error. The error says that the FM:  IDOC_CONFIGURE_DOC  doesn’t exist and it indeed doesn’t exist.

    Thanks
    Apoorva

    (0) 

Leave a Reply