Skip to Content

Document Objectives:


The objective of this document is to provide important configuration details of Master Data Article Hierarchy with the enhancements details.


0Material does not provide the article hierarchy. The level of hierarchy provided in 0Material with the below standard data source

0MATERIAL_LGEN_HIER

0MATERIAL_LKLS_HIER

0MATERIAL_LPRH_HIER

Which provide only MERCHANDISE level of Hierarchy. To derive the exact Article (SKU) level we need to use the below standard options. There is no specific documents that demonstrate article hierarchy.


Configuration Details


You can go RSA5 on ECC and look for the IS-R nodes. You’ll have two kinds of extractors: 0CM_CDT1_ATTR and 0RF_ARTHIER1_ATTR. In my case I had to use the 0RF_ARTHIER1_ATTR series extractors.


Activate in R/3 the following data sources:

0RF_ARTHIER1_ATTR,0RF_ARTHIER2_ATTR,0RF_ARTHIER3_ATTR,0RF_ARTHIER4_ATTR, 0RF_ARTHIER5_ATTR,0RF_ARTHIER6_ATTR,0RF_ARTHIER7_ATTR,0RF_ARTHIER8_ATTR, 0RF_PRODUCT_ATTR,0RF_PRODUCT_TEXT,0RF_ARTHIER1_TEXT,0RF_ARTHIER2_TEXT, 0RF_ARTHIER3_TEXT,0RF_ARTHIER4_TEXT,0RF_ARTHIER5_TEXT, 0RF_ARTHIER6_TEXT, 0RF_ARTHIER7_TEXT, 0RF_ARTHIER8_TEXT.


Untitled1.png


Replicate the Data source:

In BI, replicate the data sources for the source system that you activated the data sources for. Also, activate the standard content for the DSO 0RF_DS01. These include update rules, transfer rules, info objects and info sources.


Untitled2.png

After you have activated the 0RF_DS01 DSO, you can go to RSA5 (in the BI server) and activate the data source 0RF_ARTHIER_ACT. After this, activate the info source 0RF_ACT_HIER. Also activate the update rules related to these on the BI content.

Untitled3.pngUntitled4.png

Now you have to create Info packages for each data source that you’ve activated on step 1. I used deltas for the ATTR and full for the TEXT.

Run the Info packages. If the loads are green, then congratulations, you have half of the work. The most important thing that is having the hierarchy on the BI server is done.

Maintain the Hierarchy

Maintain the Hierarchy tab and click on the external characteristics. I had to add the characteristics:


0CM_CDT1 (Category), 0CM_CDT2 (Subcategory), 0CM_CDT3 (Segment), 0CM_CDT4 (Sub segment), 0CM_CDT5 (Sub-Sub segment), 0CM_CDT6 (Product Group),0CM_CDT7 (Brand),0CM_HIEID (Hierarchy ID),0CM_MCATDIV (Industry), and 0RF_SKU (Retail Fashion SKU)

Untitled5.png

Once you have these, then you can continue. Now expand the 0MATERIAL node, right click the hierarchy node, and link it to a 3.x info source, for flat files. Select the IDOC method instead of the PSA.


Untitled6.png


Create an Info package for this hierarchy. You can choose between frontend and server. If you choose server, be sure that you and the user ALEREMOTE have access to the folder that you select, and write down the file name that you chose.


Untitled7.png

Now let’s go to SE38. You’ll create a program that converts the DSO with all the article hierarchy into a file with data in the required lay out for uploading this as a hierarchy for 0MATERIAL. Here you have an example of the program that I’ve developed:


PROGRAM TO DOWNLOAD FROM DSO to Flat File

REPORT  zrf_arthier_download.

INCLUDE zrf_arthier_download_top.
INCLUDE zrf_arthier_download_forms.

*Parameters
PARAMETERS: p_hier TYPE /bi0/arf_ds0100-cm_hieid.
PARAMETERS: p_local  RADIOBUTTON GROUP rad1,
            p_server
RADIOBUTTON GROUP rad1 DEFAULT ‘X’.

START-OF-SELECTION.

  PERFORM selection USING p_hier.

* Checks if there is any hierarchy on the DSO
 
IF it_dso[] IS NOT INITIAL.
   
PERFORM prepare_download USING p_hier.
* If the download table contains any data, it downloads it.
   
IF it_download[] IS NOT INITIAL.
     
PERFORM download_file USING p_local.
   
ENDIF.
 
ELSE.
   
EXIT.
 
ENDIF.

*&———————————————————————*
*&  Include           ZRF_ARTHIER_DOWNLOAD_TOP
*&———————————————————————*
* Types
TYPES: BEGIN OF ty_dso,
        rf_sku    
TYPE /bi0/arf_ds0100-rf_sku,
        cm_cdt1   
TYPE /bi0/arf_ds0100-cm_cdt1,
        cm_hieid  
TYPE /bi0/arf_ds0100-cm_hieid,
        validfrom 
TYPE /bi0/arf_ds0100-validfrom,
        cm_mcatdiv
TYPE /bi0/arf_ds0100-cm_mcatdiv,
        cm_cdt2   
TYPE /bi0/arf_ds0100-cm_cdt2,
        cm_cdt3   
TYPE /bi0/arf_ds0100-cm_cdt3,
        cm_cdt4   
TYPE /bi0/arf_ds0100-cm_cdt4,
        cm_cdt5   
TYPE /bi0/arf_ds0100-cm_cdt5,
        cm_cdt6   
TYPE /bi0/arf_ds0100-cm_cdt6,
        cm_cdt7   
TYPE /bi0/arf_ds0100-cm_cdt7,
        validto   
TYPE /bi0/arf_ds0100-validto,
        rf_tlevel 
TYPE /bi0/arf_ds0100-rf_tlevel,
      
END OF ty_dso.

TYPES: BEGIN OF ty_download,
       
field(255) TYPE c,
      
END OF ty_download.

* Internal tables
DATA it_dso      TYPE TABLE OF ty_dso.
DATA it_download TYPE TABLE OF ty_download.

* Work areas
DATA wa_dso      TYPE ty_dso.
DATA wa_download TYPE ty_download.

* Constants
CONSTANTS c_nodeid(7)     TYPE c VALUE ‘Node Id’.
CONSTANTS c_infname(15)   TYPE c VALUE ‘InfoObject Name’.
CONSTANTS c_nodename(9)   TYPE c VALUE ‘Node Name’.
CONSTANTS c_link(4)       TYPE c VALUE ‘Link’.
CONSTANTS c_parent(11)    TYPE c VALUE ‘Parent Node’.
CONSTANTS c_validto(8)    TYPE c VALUE ‘Valid to’.
CONSTANTS c_validfrom(10) TYPE c VALUE ‘Valid from’.
CONSTANTS c_language(8)   TYPE c VALUE ‘Language’.
CONSTANTS c_short(5)      TYPE c VALUE ‘Short’.
CONSTANTS c_medium(6)     TYPE c VALUE ‘Medium’.
CONSTANTS c_long(4)       TYPE c VALUE ‘Long’.
CONSTANTS c_sep(1)        TYPE c VALUE ‘,’.
CONSTANTS c_en(2)         TYPE c VALUE ‘EN’.
CONSTANTS c_hieid(9)      TYPE c VALUE ‘0CM_HIEID’.
CONSTANTS c_mcatdiv(11)   TYPE c VALUE ‘0CM_MCATDIV’.
CONSTANTS c_cdt1(8)       TYPE c VALUE ‘0CM_CDT1’.
CONSTANTS c_cdt2(8)       TYPE c VALUE ‘0CM_CDT2’.
CONSTANTS c_cdt3(8)       TYPE c VALUE ‘0CM_CDT3’.
CONSTANTS c_cdt4(8)       TYPE c VALUE ‘0CM_CDT4’.
CONSTANTS c_cdt5(8)       TYPE c VALUE ‘0CM_CDT5’.
CONSTANTS c_cdt6(8)       TYPE c VALUE ‘0CM_CDT6’.
CONSTANTS c_cdt7(8)       TYPE c VALUE ‘0CM_CDT7’.
CONSTANTS c_0material(9TYPE c VALUE ‘0MATERIAL’.
CONSTANTS c_e(1)          TYPE c VALUE ‘E’.
CONSTANTS c_x(1)          TYPE c VALUE ‘X’.

*&———————————————————————*
*&  Include           ZRF_ARTHIER_DOWNLOAD_FORMS
*&———————————————————————*

*&———————————————————————*
*&      Form  SELECTION
*&———————————————————————*
*       text
*———————————————————————-*
*      –>P_P_HIER  text
*———————————————————————-*
FORM selection  USING    p_hier.

  REFRESH it_dso.
 
REFRESH it_download.
 
CLEAR wa_dso.
 
CLEAR wa_download.

  SELECT rf_sku
         cm_cdt1
         cm_hieid
         validfrom
         cm_mcatdiv
         cm_cdt2
         cm_cdt3
         cm_cdt4
         cm_cdt5
         cm_cdt6
         cm_cdt7
         validto
         rf_tlevel
        
INTO TABLE it_dso
        
FROM /bi0/arf_ds0100
        
WHERE cm_hieid = p_hier
        
AND   rf_del_ind <> c_x.

ENDFORM.                    ” SELECTION

*&———————————————————————*
*&      Form  PREPARE_DOWNLOAD
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM prepare_download USING p_hier.

  TYPES: BEGIN OF ty_parent,
         
id(8) TYPE c,
          name 
TYPE /bi0/arf_ds0100-cm_cdt1,
        
END OF ty_parent.

  DATA it_parent TYPE TABLE OF ty_parent.

  DATA wa_parent TYPE ty_parent.

  DATA l_short(20TYPE c.
 
DATA l_medium(40) TYPE c.
 
DATA l_long(60)   TYPE c.
 
DATA l_count(8)   TYPE c.
 
DATA l_validfrom  TYPE /bi0/arf_ds0100-validfrom.
 
DATA l_validto    TYPE /bi0/arf_ds0100-validto.

  REFRESH it_parent.
 
CLEAR wa_parent.

* Put the headers
 
CONCATENATE c_nodeid
              c_sep
              c_infname
              c_sep
              c_nodename
              c_sep
              c_link
              c_sep
              c_parent
              c_sep
              c_validto
              c_sep
              c_validfrom
              c_sep
              c_language
              c_sep
              c_short
              c_sep
              c_medium
              c_sep
              c_long
             
INTO wa_download-field.
 
APPEND wa_download TO it_download.
 
CLEAR wa_download.

* Get the first node
 
SELECT SINGLE txtsh
                txtmd
        
INTO (l_short,
               l_medium)
        
FROM /bi0/tcm_hieid
        
WHERE cm_hieid = wa_dso-cm_hieid
        
AND   langu    = c_e.

  CLEAR l_validto.
 
SELECT MAX( validto )
        
INTO l_validto
        
FROM /bi0/arf_ds0100
        
WHERE cm_hieid = p_hier.

  CLEAR l_validfrom.
 
SELECT MIN( validfrom )
      
INTO l_validfrom
      
FROM /bi0/arf_ds0100
      
WHERE cm_hieid = p_hier.

  CONCATENATE ‘1’
              c_sep
              c_hieid
              c_sep
              p_hier
              c_sep
              c_sep
             
‘0’
              c_sep
              l_validto
              c_sep
              l_validfrom
              c_sep
              c_en
              c_sep
*              l_short
              l_medium
              c_sep
              l_medium
              c_sep
             
INTO wa_download-field.

  APPEND wa_download TO it_download.
 
CLEAR wa_download.

* Here I get the second node of the hierarchy
 
READ TABLE it_dso INTO wa_dso WITH KEY rf_tlevel = 1.

  SELECT SINGLE txtsh
                txtmd
                txtlg
        
INTO (l_short,
               l_medium,
               l_long)
        
FROM /bi0/tcm_mcatdiv
        
WHERE cm_hieid   = wa_dso-cm_hieid
        
AND   cm_mcatdiv = wa_dso-cm_mcatdiv
        
AND   langu      = c_e.

  CLEAR l_count.
  l_count =
2.

  CONDENSE l_count.
 
CONDENSE wa_parent-id.

  CONCATENATE l_count
              c_sep
              c_mcatdiv
              c_sep
              wa_dso-cm_hieid
              wa_dso-cm_mcatdiv
              c_sep
              c_sep
             
‘1’
              c_sep
              wa_dso-validto
              c_sep
              wa_dso-validfrom
              c_sep
              c_en
              c_sep
*              l_short
              l_medium
              c_sep
              l_medium
              c_sep
             
INTO wa_download-field.

  APPEND wa_download TO it_download.

  wa_parent-id = l_count.
  wa_parent-name = wa_dso-cm_mcatdiv.
 
APPEND wa_parent TO it_parent.
 
CLEAR wa_parent.
 
CLEAR wa_download.
 
CLEAR wa_dso.
 
CLEAR l_short.
 
CLEAR l_medium.
 
CLEAR l_long.

* Get the following nodes
 
LOOP AT it_dso INTO wa_dso
      
WHERE rf_tlevel = 02
      
AND cm_cdt1 <> space
      
AND cm_cdt2 = space.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt1
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt1  = wa_dso-cm_cdt1
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_mcatdiv.

    CONCATENATE l_count
                c_sep
                c_cdt1
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt1
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
*                l_short
                l_medium
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt1.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
       
WHERE rf_tlevel = 03.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt2
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt2  = wa_dso-cm_cdt2
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_cdt1.

    CONCATENATE l_count
                c_sep
                c_cdt2
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt2
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
*                l_short
                l_medium
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt2.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
     
WHERE rf_tlevel = 04.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt3
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt3  = wa_dso-cm_cdt3
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_cdt2.

    CONCATENATE l_count
                c_sep
                c_cdt3
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt3
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
                l_short
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt3.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
   
WHERE rf_tlevel = 05.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt4
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt4  = wa_dso-cm_cdt4
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_cdt3.

    CONCATENATE l_count
                c_sep
                c_cdt4
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt4
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
                l_short
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt4.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
   
WHERE rf_tlevel = 06.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt5
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt5  = wa_dso-cm_cdt5
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_cdt4.

    CONCATENATE l_count
                c_sep
                c_cdt5
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt5
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
                l_short
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt5.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
   
WHERE rf_tlevel = 07.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt6
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt6  = wa_dso-cm_cdt6
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_cdt5.

    CONCATENATE l_count
                c_sep
                c_cdt6
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt6
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
                l_short
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt6.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
   
WHERE rf_tlevel = 08.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtsh
                  txtmd
                  txtlg
          
INTO (l_short,
                 l_medium,
                 l_long)
          
FROM /bi0/tcm_cdt7
          
WHERE cm_hieid = wa_dso-cm_hieid
          
AND   cm_cdt7  = wa_dso-cm_cdt7
          
AND   langu    = c_e.

    READ TABLE it_parent
        
INTO wa_parent
        
WITH KEY name = wa_dso-cm_cdt6.

    CONCATENATE l_count
                c_sep
                c_cdt7
                c_sep
                wa_dso-cm_hieid
                wa_dso-cm_cdt7
                c_sep
                c_sep
                wa_parent-
id
                c_sep
                wa_dso-validto
                c_sep
                wa_dso-validfrom
                c_sep
                c_en
                c_sep
                l_short
                c_sep
                l_medium
                c_sep
                l_long
               
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-cm_cdt7.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.

  LOOP AT it_dso INTO wa_dso
 
WHERE rf_tlevel = 00
   
AND rf_sku <> space.

    l_count = l_count + 1.
   
CONDENSE l_count.

    SELECT SINGLE txtmd
          
INTO l_medium
          
FROM /bi0/tmaterial
          
WHERE material = wa_dso-rf_sku
          
AND   langu    = c_e.

    IF wa_dso-cm_cdt7 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt7.
   
ELSEIF wa_dso-cm_cdt6 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt6.
   
ELSEIF wa_dso-cm_cdt5 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt5.
   
ELSEIF wa_dso-cm_cdt4 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt4.
   
ELSEIF wa_dso-cm_cdt3 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt3.
   
ELSEIF wa_dso-cm_cdt2 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt2.
   
ELSEIF wa_dso-cm_cdt1 <> space.
     
READ TABLE it_parent
     
INTO wa_parent
     
WITH KEY name = wa_dso-cm_cdt1.
   
ENDIF.

    CONCATENATE l_count
            c_sep
            c_0material
            c_sep
            wa_dso-rf_sku
            c_sep
            c_sep
            wa_parent-
id
            c_sep
            wa_dso-validto
            c_sep
            wa_dso-validfrom
            c_sep
            c_en
            c_sep
            c_sep
            l_medium
            c_sep
           
INTO wa_download-field.

    wa_parent-id = l_count.
    wa_parent-name = wa_dso-rf_sku.
   
APPEND wa_parent TO it_parent.
   
APPEND wa_download TO it_download.
   
CLEAR wa_download.
   
CLEAR l_short.
   
CLEAR l_medium.
   
CLEAR l_long.
   
CLEAR wa_parent.
 
ENDLOOP.
ENDFORM.                    ” PREPARE_DOWNLOAD
*&———————————————————————*
*&      Form  DOWNLOAD_FILE
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM download_file USING p_local.

  CONSTANTS c_fbd(8)    TYPE c VALUE ‘fbdaix98’.
 
CONSTANTS c_sidd(3)   TYPE c VALUE ‘FBD’.
 
CONSTANTS c_fbt(8)    TYPE c VALUE ‘fbtaix98’.
 
CONSTANTS c_sidt(3)   TYPE c VALUE ‘FBT’.
 
CONSTANTS c_fbp(8)    TYPE c VALUE ‘fbpaix01’.
 
CONSTANTS c_sidp(3)   TYPE c VALUE ‘FBP’.
 
CONSTANTS c_part1(9TYPE c VALUE ‘/usr/sap/’.
 
CONSTANTS c_part2(31) TYPE c VALUE ‘/SYS/global/bi_data/arthier.csv’.

  DATA l_filename  TYPE string.
 
DATA l_filelocal TYPE rlgrap-filename.

  CLEAR l_filename.

  IF p_local IS INITIAL.
* Server download
   
IF sy-host = c_fbd.
     
CONCATENATE c_part1
                  c_sidd
                  c_part2
                 
INTO l_filename.
   
ELSEIF sy-host = c_fbt.
     
CONCATENATE c_part1
                  c_sidt
                  c_part2
                 
INTO l_filename.
   
ELSEIF sy-host = c_fbp.
     
CONCATENATE c_part1
                  c_sidt
                  c_part2
                 
INTO l_filename.
   
ENDIF.

    OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
   
LOOP AT it_download INTO wa_download.
     
TRANSFER wa_download TO l_filename.
   
ENDLOOP.
   
CLOSE DATASET l_filename.
   
COMMIT WORK.
 
ELSE.
* Local download
   
CLEAR l_filelocal.
   
CALL FUNCTION ‘KD_GET_FILENAME_ON_F4’
*   EXPORTING
*     PROGRAM_NAME        = SYST-REPID
*     DYNPRO_NUMBER       = SYST-DYNNR
*     FIELD_NAME          = ‘ ‘
*     STATIC              = ‘ ‘
*     MASK                = ‘ ‘
     
CHANGING
        file_name           = l_filelocal
*   EXCEPTIONS
*     MASK_TOO_LONG       = 1
*     OTHERS              = 2
              .
   
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   
ELSE.

      IF l_filelocal <> space.
        l_filename = l_filelocal.
       
CALL FUNCTION ‘GUI_DOWNLOAD’
         
EXPORTING
*     BIN_FILESIZE                    =
            filename                        = l_filename
*     FILETYPE                        = ‘ASC’
*     APPEND                          = ‘ ‘
*     WRITE_FIELD_SEPARATOR           = ‘ ‘
*     HEADER                          = ’00’
*     TRUNC_TRAILING_BLANKS           = ‘ ‘
*     WRITE_LF                        = ‘X’
*     COL_SELECT                      = ‘ ‘
*     COL_SELECT_MASK                 = ‘ ‘
*     DAT_MODE                        = ‘ ‘
*     CONFIRM_OVERWRITE               = ‘ ‘
*     NO_AUTH_CHECK                   = ‘ ‘
*     CODEPAGE                        = ‘ ‘
*     IGNORE_CERR                     = ABAP_TRUE
*     REPLACEMENT                     = ‘#’
*     WRITE_BOM                       = ‘ ‘
*     TRUNC_TRAILING_BLANKS_EOL       = ‘X’
*     WK1_N_FORMAT                    = ‘ ‘
*     WK1_N_SIZE                      = ‘ ‘
*     WK1_T_FORMAT                    = ‘ ‘
*     WK1_T_SIZE                      = ‘ ‘
*     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*     SHOW_TRANSFER_STATUS            = ABAP_TRUE
*   IMPORTING
*     FILELENGTH                      =
         
TABLES
            data_tab                        = it_download
*     FIELDNAMES                      =
*   EXCEPTIONS
*     FILE_WRITE_ERROR                = 1
*     NO_BATCH                        = 2
*     GUI_REFUSE_FILETRANSFER         = 3
*     INVALID_TYPE                    = 4
*     NO_AUTHORITY                    = 5
*     UNKNOWN_ERROR                   = 6
*     HEADER_NOT_ALLOWED              = 7
*     SEPARATOR_NOT_ALLOWED           = 8
*     FILESIZE_NOT_ALLOWED            = 9
*     HEADER_TOO_LONG                 = 10
*     DP_ERROR_CREATE                 = 11
*     DP_ERROR_SEND                   = 12
*     DP_ERROR_WRITE                  = 13
*     UNKNOWN_DP_ERROR                = 14
*     ACCESS_DENIED                   = 15
*     DP_OUT_OF_MEMORY                = 16
*     DISK_FULL                       = 17
*     DP_TIMEOUT                      = 18
*     FILE_NOT_FOUND                  = 19
*     DATAPROVIDER_EXCEPTION          = 20
*     CONTROL_FLUSH_ERROR             = 21
*     OTHERS                          = 22
                  .
       
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       
ENDIF.
     
ENDIF.
   
ENDIF.

  ENDIF.
ENDFORM.                    ” DOWNLOAD_FILE





Go to SE 38 again, Enter the following Program Name ZAF_ARTHIER_DOWNLOAD click Execute.


Untitled8.png

Select the Hierarchy id

Untitled9.png

Execute to the Application Server AL11.


Now come to 0material Hierarchy infopackage,

External data

Select Load External data from Application Server and specify the path,


Untitled10.png

Now Schedule it in the Schedule tab,

Check the load, and go to the Hierrachy structure you can see the Article Hierarchy.

Untitled11.png

Untitled12.png

This is just an example, but you can create or you own or modify this.

Remember to change the file name if you’ve chosen to upload the file from the server.

Now you’re ready to include the program, the Infopackages and the last Infopackage that you created in a process chain. Enjoy your Article Hierarchy!

To report this post you need to login first.

5 Comments

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

  1. Joachim Umbeck

    Hi Ramesh,

    very useful, thanks for the effort.

    Athough I do not understand how the activation of InfoSource 0RF_ACT_HIER and the DataSource 0RF_ARTHIER_ACT is linked to your ABAP program (that is pulling data out of 0RF_DS01 directly and other master data).


    My preference would be of course to use the InfoSource directly to update the hierarchy without going via flat file …

    Regards

    Joachim

    (0) 

Leave a Reply