Sitemap

Amicuk Programming Answers

Hi Profit center descriptions

2015-10-11   Views:1

Advertisement

Hi Experts,      For this design only profit centers under the following level 4 nodes will need to be extracted and sent to PROS SOI7CR0326 , SOI7FU0763 , SOI7FU0764 , SOI7FU0765.  All profit centers under these nodes will need to be sent although o

Hi Experts,
     For this design only profit centers under the following level 4 nodes will need to be extracted and sent to PROS SOI7CR0326 , SOI7FU0763 , SOI7FU0764 , SOI7FU0765.  All profit centers under these nodes will need to be sent although only level 4, level 6, and level 7 descriptions should be sent for each profit center.  I used transaction KCH3 to view the hierarchy below.
     I need descriptions for all the profit centers for the above mentioned nodes,  please see the code and give me some solution.
    5  SOI_STREAM      Downstream                                                                               
4  SOI4000011      DOWNSTREAM (OIL)                                                       
        4  SOI5000001      DOWNSTREAM REFINING 1 PEER GRP                                         
        4  SOI5000002      DOWNSTREAM REFINING 2 PEER GRP                                         
        4  SOI5000003      DOWNSTREAM COMMERCIAL PEER GRP                                         
        5  SOI5000004      DOWNSTREAM RETAIL PEER GROUP                                                                               
4  SOI6AC0001      ACCELERATOR BUSINESS UNIT                                          
            4  SOI6CR0001      US CONVENIENCE OPERATIONS                                          
            5  SOI6FU0001      US FUELS OPERATING UNIT                                                                               
5  SOI7FU0692      SECONDARY TRANS / PIPELINE                                     
                5  SOI7FU0762      RESTRUCTURING HIERARCHY                                        
                5 <b> SOI7FU0763</b>      US FUELS MARKETING - EAST/GULF COAST         <--           Level 4 Description                                                                               
5  SOI7FU0766      EGC FUELS SUPPLY GEOGRAPHY                                                                               
5  SOI7FU0017      NORTHEAST GEOGRAPHY                                     <--          Level 6 Description
                                                                                18026650   EAST S&H OPPORTUNITY PROJECTS EXPENSE       <--          Level 7 Description                                                                               
5  SOI7FU0033      NEW YORK HARBOR - SUPPLY ENVELOPE                                                                               
5  SOI7FU0034      TERMINALS&SUPPLYPLANTS -NEW YORK HARBOR                                                                               
5  SOI7FU0174      GASOLINE - NEW YORK HARBOR                                                                               
18000063   MA FIELD DISTRIBUTION                          
                                        18000070   WASHINGTON DC-20003 (LPOB)                     
                                        18000361   WILMINGTON DE-19801 (LPOB)                     
                                        18000371   CORAOPOLIS PA-15108 (LPOB)                     
                                        18000396   PHILADELPHIA PA-EXXON (LTOZ)                   
                                        18004753   BROOKLYN TERMINAL
* This program can be used to export profit center hierarchies or other groups in a level table (format used by RGSIMPH1)
* To actively use this program:
*   - copy it to a local object
*   - adapt DATA_TAB to the data structure in your foreign system
*     (change positions, length of fields, remove TOVALUE if
*      hierarchies contain single values only, ...)
*   - write an export routine for DATA_TAB if you don't want to
*     download it to the presentation server
* Example hierarchy that will be exported by this program
*    HIER-TOP                      Top node
*      |
*      |---- HIER-010              Node 10
*      |       |
*      |       |---- HIER-011      Node 11
*      |       |       - CC 1      Profit center 1
*      |       |       - CC 2      Profit center 2
*      |       |
*      |        ---- HIER-012      Node 12
*      |               - CC 3      Profit center 3
*      |               - CC 4      Profit center 4
*      |
*       ---- HIER-020              Node 20
*              - CC 5              Profit center 5
* The level table  DATA_TAB will look like this:
*    Level  Groupname    Fromvalue  Tovalue           Descript
*    0001   HIER-TOP                                  Top node
*    0002   HIER-010                                  Node 10
*    0003   HIER-011                                  Node 11
*    0004                CC 1       CC 1
*    0004                CC 2       CC 2
*    0003   HIER-012                                  Node 12
*    0004                CC 3       CC 3
*    0004                CC 4       CC 4
*    0002   HIER-020                                  Node 20
*    0003                CC 5       CC 5
*  Standard Architecture Data Structures
INCLUDE: zbiod001,
         zbiud002,
         zbiud007.
DATA: c_text_write(5) TYPE c VALUE 'Write'.
TABLES: CEPC,
        CEPCT.
*------------------------ Data ---------------------------------*
DATA: I_CEPCT  LIKE CEPCT OCCURS 0 WITH HEADER LINE,
      WA_CEPCT LIKE CEPCT,
      I_CEPC   LIKE CEPC OCCURS 0 WITH HEADER LINE,
      WA_CEPC  LIKE CEPC.
DATA: W_OBJECTID LIKE CDHDR-OBJECTID,
      W_LEVEL_CODE(30) TYPE C,
      W_LEVEL_NAME(50) TYPE C,
      W_LEVEL_CODE1(30) TYPE C,
      W_LEVEL_NAME1(50) TYPE C.
DATA: BEGIN OF I_PROFIT OCCURS 10,
  ID(15)                TYPE C,
  CODE(10)                 TYPE C,
  NAME(20)                 TYPE C,
  DESC(40)                 TYPE C,
  HIER_LVL1_CODE(30)       TYPE C,
  HIER_LVL1_NAME(50)       TYPE C,
  HIER_LVL2_CODE(30)       TYPE C,
  HIER_LVL2_NAME(50)       TYPE C,
  HIER_LVL3_CODE(30)       TYPE C,
  HIER_LVL3_NAME(50)       TYPE C,
  HIER_LVL4_CODE(30)       TYPE C,
  HIER_LVL4_NAME(50)       TYPE C,
  HIER_LVL5_CODE(30)       TYPE C,
  HIER_LVL5_NAME(50)       TYPE C,
  HIER_LVL6_CODE(30)       TYPE C,
  HIER_LVL6_NAME(50)       TYPE C,
  HIER_LVL7_CODE(30)       TYPE C,
  HIER_LVL7_NAME(50)       TYPE C,
  HIER_LVL8_CODE(30)       TYPE C,
  HIER_LVL8_NAME(50)       TYPE C,
  HIER_LVL9_CODE(30)       TYPE C,
  HIER_LVL9_NAME(50)       TYPE C,
  HIER_LVL10_CODE(30)      TYPE C,
  HIER_LVL10_NAME(50)      TYPE C,
  HIER_LVL11_CODE(30)      TYPE C,
  HIER_LVL11_NAME(50)      TYPE C,
  CREATED_BY(15)                         TYPE C,
  CREATED_DATE(10)                       TYPE C,
  LAST_UPDATED_BY(15)                    TYPE C,
  LAST_UPDATED_DATE(10)                  TYPE C,
  BATCH_ID(15)                           TYPE C,
  STAGE2_DIM_ID(15)        TYPE C,
  SOURCE_SYSTEM_ID(20)                   TYPE C,
  ALT_ACCOUNT_SET_HIERARCHY_IND(1)       TYPE C,
END OF I_PROFIT.
*Structure required by Essbase. Str_PC1.TXT
DATA: BEGIN OF I_STR_PC1 OCCURS 10,
  HIER_LVL1_CODE(30)       TYPE C,
  FILLER1(1)                TYPE C VALUE '|',
  HIER_LVL1_NAME(50)       TYPE C,
  FILLER2(1)                TYPE C VALUE '|',
  HIER_LVL2_CODE(30)       TYPE C,
  FILLER3(1)                TYPE C VALUE '|',
  HIER_LVL2_NAME(50)       TYPE C,
  FILLER4(1)                TYPE C VALUE '|',
  HIER_LVL3_CODE(30)       TYPE C,
  FILLER5(1)                TYPE C VALUE '|',
  HIER_LVL3_NAME(50)       TYPE C,
  FILLER6(1)                TYPE C VALUE '|',
  HIER_LVL4_CODE(30)       TYPE C,
  FILLER7(1)                TYPE C VALUE '|',
  HIER_LVL4_NAME(50)       TYPE C,
  FILLER8(1)                TYPE C VALUE '|',
  HIER_LVL5_CODE(30)       TYPE C,
  FILLER9(1)                TYPE C VALUE '|',
  HIER_LVL5_NAME(50)       TYPE C,
  FILLER10(1)                TYPE C VALUE '|',
  HIER_LVL6_CODE(30)       TYPE C,
  FILLER11(1)                TYPE C VALUE '|',
  HIER_LVL6_NAME(50)       TYPE C,
  FILLER12(1)                TYPE C VALUE '|',
  HIER_LVL7_CODE(30)       TYPE C,
  FILLER13(1)                TYPE C VALUE '|',
  HIER_LVL7_NAME(50)       TYPE C,
  FILLER14(1)                TYPE C VALUE '|',
  HIER_LVL8_CODE(30)       TYPE C,
  FILLER15(1)                TYPE C VALUE '|',
  HIER_LVL8_NAME(50)       TYPE C,
  FILLER16(1)                TYPE C VALUE '|',
  HIER_LVL9_CODE(30)       TYPE C,
  FILLER17(1)                TYPE C VALUE '|',
  HIER_LVL9_NAME(50)       TYPE C,
  FILLER18(1)                TYPE C VALUE '|',
  HIER_LVL10_CODE(30)      TYPE C,
  FILLER19(1)                TYPE C VALUE '|',
  HIER_LVL10_NAME(50)      TYPE C,
  FILLER20(1)                TYPE C VALUE '|',
  HIER_LVL11_CODE(30)      TYPE C,
  FILLER21(1)                TYPE C VALUE '|',
  HIER_LVL11_NAME(50)      TYPE C,
  FILLER22(1)                TYPE C VALUE '|',
  CODE(10)                 TYPE C,
  FILLER23(1)                TYPE C VALUE '|',
  DESC(40)                 TYPE C,
  FILLER24(1)                TYPE C VALUE '|',
  NAME(20)                 TYPE C,
  FILLER25(1)                TYPE C VALUE '|',
END OF I_STR_PC1.
*Variable declaration
DATA: CTR(2) TYPE C,
      INC TYPE I,
      W_CTR1(2) TYPE C,
      W_INC1 TYPE I.
DATA: w_file_prft LIKE w_prc_files.
*Field symbols.
  FIELD-SYMBOLS: <CD1>,
                 <NM1>.
* External level table will be using the following structure
DATA: BEGIN OF data_tab OCCURS 0,
        level(4)      TYPE n,          "level in hierarchy
        groupname     LIKE grpdynp-name_coall, "name of node
        fromvalue     LIKE setvalues-from,  "From-Value of interval
        tovalue       LIKE setvalues-to,    "To-Value of interval
        descript      LIKE sethier-descript,"description of this entry
      END OF data_tab.
*Constants
CONSTANTS: c_setclass LIKE sethier-setclass VALUE '01++'.
*------------------------ SelectionScreen--------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
* Parameters
PARAMETERS: g_setid   LIKE sethier-setid OBLIGATORY MEMORY ID gse.
SELECTION-SCREEN END OF BLOCK B1.
* Tables to read sets
DATA: sethier   LIKE sethier OCCURS 0 WITH HEADER LINE,  "hierar. nodes
      setvalues LIKE setvalues OCCURS 0 WITH HEADER LINE, "hier. values
      g_setval_index LIKE sy-tabix,    "index for setvalues,
      g_int     TYPE i,
      g_rc      TYPE c,
      g_old_file LIKE lgrwo-exp_file.
*------------------------ AT Selection screen----------------------*
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR g_setid.
* Value request for group name
  CALL FUNCTION 'G_RW_SET_SELECT'
       EXPORTING
            class           = c_setclass
            set             = g_setid
            typelist        = 'BS'
            show_field_name = ' '
            show_table_name = ' '
       IMPORTING
            setid           = g_setid
            set_name        = g_setid.
*peform to read profit center hierarchy
PERFORM READ_SETHIER.
*perform to change the output format to flat file format
PERFORM PROFIT_CENTER_HIER.
*Fill remaining details from profit center master tables
PERFORM FILL_PRCTR_DETAILS.
*perform to download the details
PERFORM F_WRITE_TO_FILE.
FORM READ_SETHIER.
* Preparations: check authority to read sets
    CALL FUNCTION 'G_SET_OR_GROUP_AUTHORITY'
         EXPORTING
              i_setid = g_setid
              i_actvt = '03'.
* Read set
  REFRESH: sethier, setvalues.
  CALL FUNCTION 'G_SET_TREE_IMPORT'
       EXPORTING
            no_rw_info    = 'X'
            setid         = g_setid
       TABLES
            set_hierarchy = sethier
            set_values    = setvalues.
* Copy set into DATA_TAB
  REFRESH data_tab.
  g_setval_index = 1.
  LOOP AT sethier.
    CLEAR data_tab.
    data_tab-level = sethier-level.
    data_tab-groupname = sethier-shortname.
    data_tab-descript = sethier-descript.
    APPEND data_tab.
    CHECK sethier-vcount > 0.
    CLEAR data_tab.
    data_tab-level = sethier-level + 1.
    g_int = g_setval_index + sethier-vcount - 1.
    LOOP AT setvalues FROM g_setval_index TO g_int.
      data_tab-fromvalue = setvalues-from.
      data_tab-tovalue = setvalues-to.
      data_tab-descript = setvalues-descript.
      APPEND data_tab.
    ENDLOOP.
    g_setval_index = g_int + 1.
  ENDLOOP.
ENDFORM.
FORM PROFIT_CENTER_HIER.
* Use DATA_TAB table here to get to the heirarchies.
LOOP AT DATA_TAB.
     W_INC1 = DATA_TAB-LEVEL.
     W_CTR1 = W_INC1.
     IF DATA_TAB-LEVEL = '0000' .
        CONTINUE.
     ENDIF.
    IF NOT DATA_TAB-GROUPNAME IS INITIAL.
      CONCATENATE 'I_PROFIT-HIER_LVL' W_CTR1 '_CODE' INTO W_LEVEL_CODE1.
      ASSIGN  (W_LEVEL_CODE1) TO <CD1>.
      <CD1> = DATA_TAB-GROUPNAME.
      CONCATENATE 'I_PROFIT-HIER_LVL' W_CTR1 '_NAME' INTO W_LEVEL_NAME1.
      ASSIGN (W_LEVEL_NAME1) TO <NM1>.
      <NM1> = DATA_TAB-DESCRIPT.
     ELSEIF NOT ( DATA_TAB-FROMVALUE IS INITIAL OR
                       DATA_TAB-TOVALUE IS INITIAL ) AND
                        DATA_TAB-LEVEL NE '0001' .
          MOVE DATA_TAB-FROMVALUE TO I_PROFIT-CODE.
          PERFORM CLEAR_ABOVE_LEVEL USING W_CTR1.
          APPEND I_PROFIT.
          CONTINUE.
     ENDIF.
ENDLOOP.
ENDFORM.
*       FORM GET_FILE_NAME                                            *
*       Value help for export/import file name                        *
FORM get_file_name CHANGING p_outfile LIKE lgrwo-exp_file.
  DATA: path             LIKE lgrwo-exp_file,
        len              TYPE i,
        separator(1)     TYPE c,
        window_system(4) TYPE c.
  FIELD-SYMBOLS <last_char>.
* get presentation server operating system for file name separator
  CALL FUNCTION 'WS_QUERY'
       EXPORTING
            query  = 'WS'
       IMPORTING
            return = window_system.
  IF window_system = 'MC'.             "Mac OS
    separator = ':'.
  ELSE.                                "Windoze
    separator = ''.
  ENDIF.
* get path name
  path = p_outfile.
  SHIFT path RIGHT DELETING TRAILING space.
  DESCRIBE FIELD path LENGTH len.
  len = len - 1.
  ASSIGN path+len(1) TO <last_char>.
  WHILE <last_char> <> separator AND
        path <> space.
    SHIFT path RIGHT.
  ENDWHILE.
  SHIFT path LEFT DELETING LEADING space.
* get file name
  WHILE p_outfile CS separator.
    SHIFT p_outfile UP TO separator.
    SHIFT p_outfile.
  ENDWHILE.
* get file name
  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            def_filename = p_outfile
            def_path     = path
            mask         = ',*.*,*.*.'
            mode         = 'S'
       IMPORTING
            filename     = p_outfile
       EXCEPTIONS
            OTHERS       = 0.
ENDFORM.
*&      Form  CLEAR_ABOVE_LEVEL
FORM CLEAR_ABOVE_LEVEL USING   P_LEVEL.
*Field symbols.
  FIELD-SYMBOLS: <CD>,
                 <NM>.
*Clear code and name from upper level hierarchies when profit center
* is found in the lower level hierarchies.
    WHILE P_LEVEL <= 10.
     CONCATENATE 'I_PROFIT-HIER_LVL' P_LEVEL '_CODE' INTO W_LEVEL_CODE.
      ASSIGN  (W_LEVEL_CODE) TO <CD>.
      CLEAR <CD>.
     CONCATENATE 'I_PROFIT-HIER_LVL' P_LEVEL '_NAME' INTO W_LEVEL_NAME.
      ASSIGN  (W_LEVEL_NAME) TO <NM>.
      CLEAR <NM>.
      P_LEVEL = P_LEVEL + 1.
    ENDWHILE.
    CLEAR: P_LEVEL,
           W_LEVEL_CODE,
           W_LEVEL_NAME.
ENDFORM.                    " CLEAR_ABOVE_LEVEL
*&      Form  FILL_PRCTR_DETAILS
FORM FILL_PRCTR_DETAILS.
DATA: CTR TYPE I.
*Select description from CEPCT table
  SELECT * FROM CEPCT INTO TABLE I_CEPCT WHERE SPRAS EQ 'EN'.
  SELECT * FROM CEPC INTO  TABLE I_CEPC.
   SORT I_CEPC DESCENDING BY PRCTR DATBI.
   DELETE ADJACENT DUPLICATES FROM I_CEPC COMPARING PRCTR.
   SORT I_CEPC.
   SORT I_PROFIT BY CODE.
LOOP AT I_PROFIT.
   CLEAR: WA_CEPC,
          WA_CEPCT,
          W_OBJECTID.
   CTR = CTR + 1.
     READ TABLE I_CEPC INTO WA_CEPC WITH KEY PRCTR = I_PROFIT-CODE.
     READ TABLE I_CEPCT INTO WA_CEPCT WITH KEY PRCTR = WA_CEPC-PRCTR
                                               DATBI = WA_CEPC-DATBI.
          MOVE: CTR             TO I_PROFIT-ID,
                WA_CEPCT-KTEXT  TO I_PROFIT-NAME,
                WA_CEPCT-LTEXT  TO I_PROFIT-DESC.
    CONCATENATE '0002' I_PROFIT-CODE INTO W_OBJECTID.
       MOVE-CORRESPONDING I_PROFIT TO I_STR_PC1.
       APPEND I_STR_PC1.
ENDLOOP.
FREE I_PROFIT.
ENDFORM.                    " FILL_PRCTR_DETAILS
*&      Form  F_DOWNLOAD
FORM F_DOWNLOAD.
ENDFORM.
*&      Form  F_WRITE_TO_FILE
FORM F_WRITE_TO_FILE.
LOOP AT I_STR_PC1.
    PERFORM WRITE_FILE USING I_STR_PC1
                                   w_file_prft-PRC_FILE..
ENDLOOP.
ENDFORM.                    " F_WRITE_TO_FILE
FORM WRITE_FILE USING W_RECORD W_PRC_FILE.
  DATA: W_RECORD_LEN TYPE I.
*  Retreive the actual length of the record to be written
  DESCRIBE FIELD W_RECORD LENGTH W_RECORD_LEN.
  TRANSFER W_RECORD TO W_PRC_FILE LENGTH W_RECORD_LEN.
  IF SY-SUBRC NE 0.
    MESSAGE ID 'ZZ' TYPE 'A' NUMBER '001'
         WITH C_TEXT_WRITE  W_PRC_FILE.
  ENDIF.
  CLEAR W_RECORD.
ENDFORM.
Thanks & Regards,
Poorna.

The replay answer
Advertisement
hi all,
          here is the solution:
**------------------------ Data ---------------------------------*
DATA: i_cepct  LIKE cepct OCCURS 0 WITH HEADER LINE,
      wa_cepct LIKE cepct,
      i_cepc   LIKE cepc OCCURS 0 WITH HEADER LINE,
      wa_cepc  LIKE cepc.
*Variable declaration
DATA: w_ctr1(2) TYPE c,
      w_inc1 TYPE i.
DATA: w_level_code(30) TYPE c,
      w_level_name(50) TYPE c,
      w_level_code1(30) TYPE c,
      w_level_name1(50) TYPE c.
*Field symbols.
FIELD-SYMBOLS: <cd1>,
               <nm1>.
* External level table will be using the following structure
DATA: BEGIN OF data_tab OCCURS 0,
        level(4)      TYPE n,          "level in hierarchy
        groupname     LIKE grpdynp-name_coall, "name of node
        fromvalue     LIKE setvalues-from,  "From-Value of interval
        tovalue       LIKE setvalues-to,    "To-Value of interval
        descript      LIKE sethier-descript,"description of this entry
      END OF data_tab.
* Tables to read sets
DATA: sethier   LIKE sethier OCCURS 0 WITH HEADER LINE, "hier-nodes
      setvalues LIKE setvalues OCCURS 0 WITH HEADER LINE, "hier-values
      g_setval_index LIKE sy-tabix,    "index for setvalues,
      g_int     TYPE i.
DATA: BEGIN OF i_profit OCCURS 10,
  id(15)                TYPE c,
  code(10)                 TYPE c,
  name(20)                 TYPE c,
  desc(40)                 TYPE c,
  hier_lvl1_code(30)       TYPE c,
  hier_lvl1_name(50)       TYPE c,
  hier_lvl2_code(30)       TYPE c,
  hier_lvl2_name(50)       TYPE c,
  hier_lvl3_code(30)       TYPE c,
  hier_lvl3_name(50)       TYPE c,
  hier_lvl4_code(30)       TYPE c,
  hier_lvl4_name(50)       TYPE c,
  hier_lvl5_code(30)       TYPE c,
  hier_lvl5_name(50)       TYPE c,
  hier_lvl6_code(30)       TYPE c,
  hier_lvl6_name(50)       TYPE c,
  hier_lvl7_code(30)       TYPE c,
  hier_lvl7_name(50)       TYPE c,
  hier_lvl8_code(30)       TYPE c,
  hier_lvl8_name(50)       TYPE c,
  hier_lvl9_code(30)       TYPE c,
  hier_lvl9_name(50)       TYPE c,
  hier_lvl10_code(30)      TYPE c,
  hier_lvl10_name(50)      TYPE c,
  hier_lvl11_code(30)      TYPE c,
  hier_lvl11_name(50)      TYPE c,
  created_by(15)                         TYPE c,
  created_date(10)                       TYPE c,
  last_updated_by(15)                    TYPE c,
  last_updated_date(10)                  TYPE c,
  batch_id(15)                           TYPE c,
  stage2_dim_id(15)        TYPE c,
  source_system_id(20)                   TYPE c,
  alt_account_set_hierarchy_ind(1)       TYPE c,
END OF i_profit.
DATA: BEGIN OF i_str_pc2 OCCURS 10,
        code(10)                 TYPE c,
        desc(50)                 TYPE c,
        hier_lvl1_name(50)       TYPE c,
        hier_lvl3_name(50)       TYPE c,
        hier_lvl4_name(50)       TYPE c,
        extradatetime(20)        TYPE c,
      END OF i_str_pc2,
      BEGIN OF i_setid OCCURS 4,
        g_setid   LIKE sethier-setid,
        v_kokrs LIKE sethier-kokrs,
      END OF i_setid.
DATA : wa_str_pc2 LIKE i_str_pc2,
       wa_setid LIKE i_setid,
       v_datetim(20) TYPE c,
       v_tim(8) TYPE c,
       v_level_dec(50) TYPE c,
       v_profit_desc(50) TYPE c.
*"*"Local interface:
*"  TABLES
*"      IPROFIT STRUCTURE  ZPCT
* Append all the major nodes to I_setid
* SOI7CR0326 – Profit Center node1( under this Hier will be available, and the end you will have profit centers),
* SOI7FU0763 – Profit Center node2,
* SOI7FU0764 – Profit Center node3,
* SOI7FU0765 – Profit Center node4.
  wa_setid-g_setid = text-009.
  wa_setid-v_kokrs = text-004.
  APPEND wa_setid TO i_setid.
  wa_setid-g_setid = text-010.
  wa_setid-v_kokrs = text-004.
  APPEND wa_setid TO i_setid.
  wa_setid-g_setid = text-011.
  wa_setid-v_kokrs = text-004.
  APPEND wa_setid TO i_setid.
  wa_setid-g_setid = text-012.
  wa_setid-v_kokrs = text-004.
  APPEND wa_setid TO i_setid.
* Loop at earch major nodes from i_setid.
  LOOP AT i_setid INTO wa_setid.
    REFRESH: i_profit.
* Preparations: check authority to read sets
    CALL FUNCTION 'G_SET_OR_GROUP_AUTHORITY'
         EXPORTING
              i_setid = wa_setid-g_setid
              i_actvt = '03'.
* Funtion module to import the set hierarchy and nodes values.
    REFRESH: sethier, setvalues.
    CALL FUNCTION 'G_SET_TREE_IMPORT'
         EXPORTING
              no_rw_info    = 'X'
              setid         = wa_setid-g_setid
         TABLES
              set_hierarchy = sethier
              set_values    = setvalues.
* Copy set into DATA_TAB
    REFRESH data_tab.
    g_setval_index = 1.
    LOOP AT sethier.
      CLEAR data_tab.
      data_tab-level = sethier-level.
      data_tab-groupname = sethier-shortname.
      data_tab-descript = sethier-descript.
      APPEND data_tab.
      CHECK sethier-vcount > 0.
      CLEAR data_tab.
      data_tab-level = sethier-level + 1.
      g_int = g_setval_index + sethier-vcount - 1.
      LOOP AT setvalues FROM g_setval_index TO g_int.
        data_tab-fromvalue = setvalues-from.
        data_tab-tovalue = setvalues-to.
        data_tab-descript = setvalues-descript.
        APPEND data_tab.
      ENDLOOP.
      g_setval_index = g_int + 1.
    ENDLOOP.
* Loop at the data_tab to move all the Profit center nodes to i_profit.
    LOOP AT data_tab.
      w_inc1 = data_tab-level.
      w_ctr1 = w_inc1.
      IF data_tab-level = text-002 .
        v_level_dec = data_tab-descript.  "Description of level 4 node
        CONTINUE.
      ENDIF.
      IF NOT data_tab-groupname IS INITIAL.
        CONCATENATE text-001 w_ctr1 text-007 INTO w_level_code1.
        ASSIGN  (w_level_code1) TO <cd1>.
        <cd1> = data_tab-groupname.
        CONCATENATE text-001 w_ctr1 text-008 INTO w_level_name1.
        ASSIGN (w_level_name1) TO <nm1>.
        <nm1> = data_tab-descript.
      ELSEIF NOT ( data_tab-fromvalue IS INITIAL OR
                        data_tab-tovalue IS INITIAL ) AND
                         data_tab-level NE text-003 .
        MOVE data_tab-fromvalue TO i_profit-code.
        PERFORM clear_above_level USING w_ctr1.
        APPEND i_profit.
        CONTINUE.
      ENDIF.
    ENDLOOP.
*Select description from CEPCT table
    SELECT * FROM cepct
             INTO TABLE i_cepct
             WHERE spras EQ text-006.
    SELECT * FROM cepc
             INTO  TABLE i_cepc.
    SORT i_cepc DESCENDING BY prctr datbi.
    DELETE ADJACENT DUPLICATES FROM i_cepc COMPARING prctr.
    SORT i_cepc.
    SORT i_profit BY code.
* Date and Times for each record.
    CONCATENATE sy-uzeit+0(2) text-005 sy-uzeit+2(2) text-005
      sy-uzeit+4(2) INTO v_tim.
    CONCATENATE sy-datum v_tim INTO v_datetim SEPARATED BY space.
    LOOP AT i_profit .
      CLEAR: wa_cepc,
             wa_cepct.
      IF   ( i_profit-code <> space
        AND i_profit-hier_lvl2_name <> space
        AND i_profit-hier_lvl3_name <> space ).
        READ TABLE i_cepc INTO wa_cepc WITH KEY prctr = i_profit-code.
        IF sy-subrc = 0.
        READ TABLE i_cepct INTO wa_cepct WITH KEY prctr = wa_cepc-prctr
                                                  datbi = wa_cepc-datbi.
          IF sy-subrc = 0.
*v_level_dec               ( Description of level 4 node )
*i_profit-hier_lvl2_name   ( Descri Level 6 )
*i_profit-hier_lvl3_name   ( Descri Level 6 )
*i_profit-code             ( Profit Center code )
*v_profit_desc             ( Profit Center description )
   CONCATENATE wa_cepct-ltext text-013 i_profit-code INTO v_profit_desc.
            wa_str_pc2-hier_lvl1_name = v_level_dec.
            wa_str_pc2-hier_lvl3_name = i_profit-hier_lvl2_name.
            wa_str_pc2-hier_lvl4_name = i_profit-hier_lvl3_name.
            wa_str_pc2-code           = i_profit-code.
            wa_str_pc2-desc           = v_profit_desc.
            wa_str_pc2-extradatetime  = v_datetim.
            APPEND wa_str_pc2 TO iprofit.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDLOOP.
    CLEAR: v_level_dec.
  ENDLOOP.
  CLEAR: wa_setid.
ENDFUNCTION.

Go to See the other 2 answers

Hi Profit center descriptions

Category:DefaultRelease time:2015-10-11Views:130

Hi Experts,      For this design only profit centers under the following level 4 nodes will need to be extracted and sent to PROS SOI7CR0326 , SOI7FU0763 , SOI7FU0764 , SOI7FU0765.  All profit centers under these nodes will need to be sent although o[More]

Profit center create / change

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, We have a requirement where in we need to do validation of profit center description field while saving in transactions KE51,KE52. Is there any user-exit or customer exit or badi's which gets invoked while saving in transactions KE51,KE52. Or[More]

Finding Profit center group description ?

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, I want profit center group description for my report, when i look at the setheader table i could see the description in the output but when i try to locate the field in the SE11 for SETHEADER i couldnt find that field ? Can you people tel me[More]

How to get profit center group and its description

Category:DefaultRelease time:-0001-11-30Views:130

According to three tables(as below), i get profit center group, how to get its description? CEPC  (Profit Center Master Data Table) SETLEAF SETNODE PS:(Referrence to teh link fields in table) For Profit centre Group ( SETLEAF-SETNAME ) Select BSEG-BU[More]

How to get the profit center nodes descriptions

Category:DefaultRelease time:-0001-11-30Views:130

Hi Experts,              i have value of profit center   17007236. but i need to get the hierarchy above this profit center and their descriptions. previously i have done similar kind of   problem, but i that case i have top level node from which i h[More]

Difference in Profit center for GR/IR account in MIGO & MIRO Transaction

Category:DefaultRelease time:2015-10-11Views:130

1) We have created material 106267 with material type ROH. We have assigned profit center 1001052999 (common profit center) to material. 2) We have created WBS element MUM-RIV002.SS.RC.RF with profit center 1001052002. 3) We have created PO 400000023[More]

Data required on the basis of Profit center group.

Category:DefaultRelease time:2015-10-11Views:130

Hi,     Is there any table or report from where we can find out the values of customer, cusotmer description, city, GL Account, GL description, amount, sales document or sales order on the basis of PROFIT CENTER GROUP. Means i need the above details[More]

Profit center group number on the report painter report.

Category:DefaultRelease time:2015-10-11Views:130

Hi, We have a client requirement where we have to develop Profit center by Functional Area report by using report painter report functionality, however we are able to bring profit center group description on to the report as per the requirement, but[More]

Profit Center not getting uploaded through BAPI for MM01. Pls help

Category:DefaultRelease time:2015-10-11Views:130

Hello all,               I am getting an errror while uploading a file through BAPI for MM01 , The error says Error: Profit center 1000/sslcommon does not exist for material: AC2 *& Report  ZBAPI_DUMMY REPORT  ZBAPI_MM01. *& Report  ZBAPI2 TABLES[More]

Profit Center wise ROI report considering BS items

Category:DefaultRelease time:2015-10-11Views:130

Dear Expert, As part of our SAP implementation 1.client wants , Profit center wise reporting for balance sheet items, for calculating ROI per profit center, can it be done? If yes, what balance sheet items , SAP standard willl consider while generati[More]

Requirement to populate the Profit center field of Vendor line item thru...

Category:DefaultRelease time:2015-10-11Views:130

Hi, My requirement is to populate the Profit center field of Vendor line item. For this, I want to write a substitution where based on the Business Area of Vendor line item, the system should populate the Profit center while saving. Is it possible th[More]

Hot
How do I sync photos in new download of itunes 11 its driving me crazyif you are looking on the right hand side of the itunes window you will see the work "iTunes Store " next to that it should say "iPhone" click on iphone and it will [More]
We're running a cluster in multicast mode as a  loadbalancer. We have Cisco SF300-08 and when we adding a static ARP entry results in an error message telling the user that the hardware address needs to be a valid  unicast MAC address. So how to setu [More]
Hi, I'm new to Apple Discussions, but not new to posting to forums. Currently I'm not able to post to Discussions>Safari>Safari for Mac. I can login, view all post threads, create and save a draft, preview the draft, but cannot post the draft to Dis [More]
I am facing difficulty in boot X4170 - Solaris 10 SunOS Release 5.10 Version Generic_144489-09 64-bit Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved. Cannot mount root on /scsi_vhci/[email protected]:a fstype ufs pan [More]
Hi experts My client wants to see the trial balance as below. Account Head     Opening Debit     Opening Credit     Period Debit     Period Credit     Closing Debit     Closing Credit i have searched but i could not get the above format. Can I get th [More]
HI, I know the tax procedure of TAXINN, but i have small doubt about Tax Code and Conditon Record. If we maintain the Tax Percentage i n the Tax Code and Condtion Record also.  What is the use maintain the Tax Percentage in two menctioned placess.   [More]
Short Text     User-based Hardware Sizing     Long Text     Dear SAP Support, We would like to know the SAP Hardware sizing for "User-Based sizing". Our queries is 1. In "User-Based sizing", What we have to consider, the number of user [More]
Hi there, How can we activate PO indicator in the material master? Pls guide, thank you.at mm02, check the autom.PO.Read other 2 answers [More]
What can I do to repair error -42110 after the installation of your solftware update to version 11.0-2-25 ?http://support.apple.com/kb/TS1424 http://support.apple.com/kb/TS3297Read other 2 answers [More]
Dear All If i try to change the character format of the Order operation long text, It is not allowing me to do so. In the script for the Order papers we can change the character format. But for the operation long text, It won't allow ineither in IW31 [More]