Hi Profit center descriptions

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.

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.

Similar Messages

  • Profit center create / change

    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 is there any other means by which we can do this.
    Regards,
    Kavitha.

    Hi Kavitha,
    Check this User exits <b>PCASELEK</b> or <b>PCA00003</b> (or PCA*)
    and also <b>BADI BADI_PCA_BILANZ_1 ,BADI_PCA_BILANZ_2</b>
    I hope these would help u out...
    Regards,
    Sridhar

  • Finding Profit center group description ?

    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 how to solve this problem ?
    Thanks,
    Lavanya.

    Hi Lavanya,
    You can get the description from the table SETHEADERT, field DESCRIPT.
    Cheers,
    Sri.

  • How to get profit center group and its description

    According to three tables(as below), i get profit center group, how to get its description&#65311;
    CEPC  (Profit Center Master Data Table)
    SETLEAF
    SETNODE
    PS:(Referrence to teh link fields in table)
    For Profit centre Group ( SETLEAF-SETNAME )
    Select BSEG-BUKRS / BSEG-PRCTR from BSEG.
    SELECT SINGLE SETNAME INTO WA_SETNAME
    FROM SETLEAF
    WHERE SETCALSS = '0106'
    AND SUBCLASS = BSEG-BUKRS
    AND VALFROM = BSEG-PRCTR
    i can get two records, why?

    Hi,
    I am not sure of the significance of this table...
    But looking at the table structure it is having LINEID as one of the key fields..
    So you can have more than one record for the same combination..
    Thanks,
    Naren

  • How to get the profit center nodes descriptions

    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 have extracted bottom level descriptions and profit center values. this can be referred in the below link.
    Re: Profit Center Groups
    but now i have profit center values but i need to get the above hierarchy value and descriptions. which are shown in bold letters.
    any suggestions or any function module available please kindly reply me. point will be rewarder for all answers.
       <b> 5  SOI_STREAM      Downstream PPS                                                                               
    5  SOI5000007      DOWNSTREAM NON-OPERATING BU'S                                                                               
    5  SOI6IS0001      INTEGRATED SUPPLY TRADING                                                                               
    5  SOI7IS0091      IST EAST COAST                                                                               
    5  SOI7IS0092      CHICAGO PRICING BASIS                                                                               
    5  SOI7IS0100      (CHG) CHICAGO BASIS GAS BOOK                                                                               
    5  SOI7IS0126      MARKETING CHICAGO  BASIS GAS  </b>
                                                                                    17007236   CHG 4022 GRAFTON OH (LTAZ)       
                                    17007326   CHG 4022 GRAFTON OH (LTAZ)       
    Thanks & Regards,
    Poorna.

    Hello Poorna
    The following sample report may be useful to you. The sample cost center was taken from the cost center group 'H1' on our IDES ECC 5.0.
    *& Report  ZUS_SDN_COST_CENTER_BOTTOM_UP
    REPORT  zus_sdn_cost_center_bottom_up.
    TYPE-POOLS:  abap.
    DATA:
      gd_setid                 TYPE setid,
      gt_supersets             TYPE STANDARD TABLE OF setlist,
      gs_setlist               TYPE setlist,
      gs_setinfo               TYPE setinfo,
      gt_setinfo               TYPE STANDARD TABLE OF setinfo,
      gs_costcenterdetail      TYPE bapi0012_ccoutputlist,
      gt_return                TYPE bapirettab.
    DATA:
      gs_layout                TYPE lvc_s_layo.
    PARAMETERS:
      p_kokrs      TYPE kokrs  DEFAULT '1000',
      p_kostl      TYPE kostl  DEFAULT '2-1110'.
    START-OF-SELECTION.
      CALL FUNCTION 'BAPI_COSTCENTER_GETDETAIL1'
        EXPORTING
          controllingarea            = p_kokrs
          costcenter                 = p_kostl
    *     KEYDATE                    = SY-DATLO
    *     MASTER_DATA_INACTIVE       = ' '
        IMPORTING
          costcenterdetail           = gs_costcenterdetail
        TABLES
          return                     = gt_return
    *     EXTENSIONIN                =
    *     EXTENSIONOUT               =
      CALL FUNCTION 'G_SET_ENCRYPT_SETID'
        EXPORTING
          setclass             = '0101'  " cost center group
          shortname            = gs_costcenterdetail-costctr_hier_grp
          kokrs                = p_kokrs
        IMPORTING
          setid                = gd_setid
        EXCEPTIONS
          no_co_area_specified = 1
          illegal_setclass     = 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.
      CALL FUNCTION 'G_SET_GET_ALL_SUPERSETS'
        EXPORTING
    *     CLIENT          =
          setname         = gd_setid
        TABLES
          supersets       = gt_supersets.
      CLEAR: gs_layout.
      gs_layout-cwidth_opt = abap_true.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_structure_name = 'SETLIST'
          i_grid_title     = 'Supersets'
          is_layout_lvc    = gs_layout
        TABLES
          t_outtab         = gt_supersets
        EXCEPTIONS
          program_error    = 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.
      ENDIF.
      REFRESH: gt_setinfo.
      LOOP AT gt_supersets INTO gs_setlist.
        CLEAR: gs_setinfo.
        CALL FUNCTION 'G_SET_GET_INFO'
          EXPORTING
            class                           = '0101'  " Cost Center Group
    *       NO_SET_TITLE                    = ' '
            setname                         = gs_setlist-setname+4
    *       TABLE                           = ' '
    *       FIELDNAME                       = ' '
    *       USE_TABLE_BUFFER                = 'X'
    *       CLIENT                          =
          IMPORTING
            info                            = gs_setinfo
          EXCEPTIONS
            set_not_found                   = 1
            illegal_field_replacement       = 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.
        APPEND gs_setinfo TO gt_setinfo.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_structure_name = 'SETINFO'
          i_grid_title     = 'Setinfos'
          is_layout_lvc    = gs_layout
        TABLES
          t_outtab         = gt_setinfo
        EXCEPTIONS
          program_error    = 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.
      ENDIF.
    END-OF-SELECTION.
    Regards
      Uwe

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

    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 4000000236 for account assignment category u2018Qu2019 for the above material with WBS element MUM-RIV002.SS.RC.RF   . After posting GRN for PO 4000000236 we have identified that for GR/IR account profit center is taken from material master & for stock account profit center is taken from WBS element.
    Please find the below Flow
    In MIGO
    Entry
    Accounting Document number in Entry View
    5000001125
    PSKY          G/L Code      Description
             Amount
         Curr.
              Profit Center
         WBS element
    89          231101     RAW MATERIAL STOCK     2,000.00     INR          1001052002     MUM-RIV002.SS.RC.RF
    96          162101     GR/IR-Material     -2,000.00     INR          1001052999     MUM-RIV002.SS.RC.RF
    Document number in Ledger View
    L.item     PK     SG     Account     Description         Amount     Curr.     Tx     Profit Ctr     WBS element
    1     89          231101     RAW MATERIAL STOCK     2,000.00     INR          1001052002     MUM-RIV002.SS.RC.RF
    2     96          162101     GR/IR-Material     -2,000.00     INR          1001052999     MUM-RIV002.SS.RC.RF
    3     50          162001     InterSegment Clrg     -2,000.00     INR          1001052002     
    4     40          162001     InterSegment Clrg     2,000.00     INR          1001052999     
      It should take profit center from WBS element for GR/IR account & Stock account but for GR/IR account profit center is taking form material master & for stock account profit center is taking from WBS element.
    MIRO
    Entry
    Accounting Document number Entry View
    5100000657
    PK     SG     Account     Description         Amount     Curr.     Tx     Profit Ctr     WBS element
    31          100000     Ambuja Cement Ltd     -1,996.00     INR     V4          
    86          162101     GR/IR-Material     2,000.00     INR     V4     1001052002     MUM-RIV002.SS.RC.RF
    40          254001     VAT Receivable     80     INR     V4          
    50          172103     TDS PAYABLE -194C     -42     INR               
    50          176101     WCT-TDS payable     -42     INR               
    Document number in Ledger View
    PK     SG     Account     Description         Amount     Curr.     Tx     Profit Ctr     WBS element
    31          160100     CRS-Domestic Supp     -1,996.00     INR     V4     1001052002     
    86          162101     GR/IR-Material     2,000.00     INR     V4     1001052002     MUM-RIV002.SS.RC.RF
    40          254001     VAT Receivable     80     INR     V4     1001052002     
    50          172103     TDS PAYABLE -194C     -42     INR          1001052002     
    50          176101     WCT-TDS payable     -42     INR          1001052002     
    In the MIRO Accounting Document profit center for [162101] GR/IR-Material A/C has taken from WBS element
    Please note that we are using document splitting with Profit center is mandatory
    We have created same scenario for Cost center. After posting the GRN profit center is taken from cost center for both GR/IR account in MIGO & MIRO accounting documents.
    Plez help

    Hello
    ANy suggestion for question & if solved do let me know

  • Data required on the basis of Profit center group.

    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 on the basis of  profit center group.
    Can anybody suggest on this
    Regards,
    Shree.

    Hi:
    Using this report, you can display according to profit center wise, not as profit center group wise.
    All the details are displayed accordling according to your requirement.
    Select the screen layout and select the fields you required.
    The Standard report is
    FBL5N - Display/Change Line Items
    Please let me know if you need more information.
    Assign points if useful.
    Regards
    MSReddy

  • Profit center group number on the report painter report.

    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 not able to get profit center group number displayed on the report.
    Can anyone please advice me if we can get the Profit center group number displayed on the report in Report painter report. Else let me know if we can get the requirement met by an ABAPER.

    Hi.
    First of all, through transaction GS01 create a set ID for profit centers.
    Give table GLPCT, let the set type be the default (basic set) and give field name RPRCTR. Then define the range of profit centers you want. If you want all the profit centers give * in the "from value field".
    Then create a variable through transaction GS11. Give table and field as above, choose variable type set and at the default set field choose the set you created.
    Finally, at report painter go to Edit/General Data Selection and select profit center.
    Check both flags (for entering sets and variables) and give at the form field the variable you've made.
    Now the progit center group will be available in the selection screen with default value the set you've made.
    Regards

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

    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
    FLAGS *
    DATA: F_STOP. " Flag used to stop processing
    DATA DECLARATIONS *
    DATA : V_EMPTY TYPE I, " No. of empty records
    V_TOTAL TYPE I. " Total no. of records.
    STRUCTURES & INTERNAL TABLES
    *--- BAPI structures
    DATA: BAPI_HEAD LIKE BAPIMATHEAD,  " Header Segment with Control
    BAPI_MAKT LIKE BAPI_MAKT, " Material Description
    BAPI_MARA1 LIKE BAPI_MARA, " Client Data
    BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
    BAPI_MARC1 LIKE BAPI_MARC, " Plant View
    BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
    BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
    BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
    BAPI_RETURN LIKE BAPIRET2, " Return Parameter
    BAPI_MARDL LIKE BAPI_MARD,
    BAPI_MARDX LIKE BAPI_MARDX.
    *--- Internal table to hold excel file data
    DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    *--- Internal table to hold Matetrial descriptions
    DATA: BEGIN OF IT_MAKT OCCURS 100.
            INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF IT_MAKT.
    *--- Internal to hold the records in the text file
    DATA : BEGIN OF IT_DATA OCCURS 100,
    WERKS(4), " Plant
    MTART(4), " Material type
    MATNR(18), " Material number
    MATKL(9) , " Material group
    MBRSH(1), " Industry sector
    MEINS(3), " Base unit of measure
    SPART(2), " Division
    EKGRP(3), " Purchasing group
    PRCTR(10), " Profit Center
    VPRSV(1), " Price control indicator
    BKLAS(4), "Valuation Class
    *stprs(12), " Standard price
    PEINH(3), " Price unit
    SPRAS(2), " Language key
    MAKTX(40), " Material description
    LGORT(4) , " storage location
    DISMM(2) , "MRP TYPE
    VERPR(23), " Moving Average Price
    MTVFP(2) , " Availability Check
    DISLS(2) , "Lot Size
    DISPO(3) , "MRP Controller
    BESKZ(1) , "Procurment Type
    FHORI(3) , "SCHEDMARGIN KEY
    PERKZ(1) , "Period Indicator
    END OF IT_DATA.
    SELECTION SCREEN. *
    SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
    PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY  " Input File
    PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
    PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
    PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
    P_BEGROW TYPE I DEFAULT 2 NO-DISPLAY,
    P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
    P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK SCR1.
    AT SELECTION-SCREEN *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    *--- Validating file
      PERFORM VALIDATE_FILE USING P_FILE.
    START-OF-SELECTION
    START-OF-SELECTION.
    *--- Perform to convert the Excel data into an internal table
      PERFORM CONVERT_XLS_ITAB.
      IF NOT IT_DATA[] IS INITIAL.
    *--- Perform to delete Header lines
        PERFORM DELETE_HEADER_EMPTY_RECS.
      ENDIF.
    END OF SELECTION. *
    END-OF-SELECTION.
    *--- Perform to upload Material Master data
      PERFORM UPLOAD_MATMAS.
    Form : validate_input_file
    Description : To provide F4 help for file if read from PC
    FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          FILE_NAME     = F_FILE
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
      ENDIF.
    ENDFORM. " validate_input_file
    *& Form CONVER_XLS_ITAB
    text
    FORM CONVERT_XLS_ITAB.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME    = P_FILE
          I_BEGIN_COL = P_BEGCOL
          I_BEGIN_ROW = P_BEGROW
          I_END_COL   = P_ENDCOL
          I_END_ROW   = P_ENDROW
        TABLES
          INTERN      = IT_INTERN.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *--- Perform to move the data into an internal data
      PERFORM MOVE_DATA.
    ENDFORM. " CONVERT_XLS_ITAB
    *& Form MOVE_DATA
    text
    FORM MOVE_DATA.
      DATA : LV_INDEX TYPE I.
      FIELD-SYMBOLS <FS>  .
    *--- Sorting the internal table
      SORT IT_INTERN BY ROW COL.
      CLEAR IT_INTERN.
      LOOP AT IT_INTERN.
        MOVE IT_INTERN-COL TO LV_INDEX.
    *--- Assigning the each record to an internal table row
        ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS> .
    *--- Asigning the field value to a field symbol
        MOVE IT_INTERN-VALUE TO <FS> .
        AT END OF ROW.
          APPEND IT_DATA.
          CLEAR IT_DATA.
        ENDAT.
      ENDLOOP.
    ENDFORM. " MOVE_DATA
    *& Form DELETE_HEADER_EMPTY_RECS
    To delete the Header and empty records
    FORM DELETE_HEADER_EMPTY_RECS.
      DATA: LV_TABIX LIKE SY-TABIX.
      IF NOT P_HEADER IS INITIAL.
        LOOP AT IT_DATA.
          IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
            DELETE IT_DATA FROM 1 TO P_HEADER.
    P_HEADER = 0.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDIF.
      CLEAR IT_DATA.
    *--- To delete the empty lines from internal table
      LOOP AT IT_DATA.
        LV_TABIX = SY-TABIX.
        IF IT_DATA IS INITIAL.
          V_EMPTY = V_EMPTY + 1.
          DELETE IT_DATA INDEX LV_TABIX..
        ENDIF.
      ENDLOOP.
      CLEAR IT_DATA.
    *--- Total no of recs in file
      DESCRIBE TABLE IT_DATA LINES V_TOTAL.
      IF V_TOTAL = 0.
        MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
        F_STOP = 'X'.
        STOP.
      ENDIF.
    ENDFORM. " DELETE_HEADER_EMPTY_RECS
    *& Form UPLOAD_MATMAS
    to upload Material Master data
    FORM UPLOAD_MATMAS .
      LOOP AT IT_DATA.
    Header
        BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
        BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
        BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
        BAPI_HEAD-BASIC_VIEW = 'X'.
        BAPI_HEAD-PURCHASE_VIEW = 'X'.
        BAPI_HEAD-ACCOUNT_VIEW = 'X'.
        BAPI_HEAD-storage_view ='X'.
        bapi_head-mrp_view = 'X'.
        bapi_head-COST_view ='X'.
    Material Description
        REFRESH IT_MAKT.
        IT_MAKT-LANGU = IT_DATA-SPRAS.
        IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
        APPEND IT_MAKT.
    Client Data - Basic
        BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
        BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
       bapi_mara1-unit_of_wt = it_data-gewei.
        BAPI_MARA1-DIVISION = IT_DATA-SPART.
        BAPI_MARAX-MATL_GROUP = 'X'.
        BAPI_MARAX-BASE_UOM = 'X'.
        BAPI_MARAX-UNIT_OF_WT = 'X'.
        BAPI_MARAX-DIVISION = 'X'.
    Plant - Purchasing
        BAPI_MARC1-PLANT = IT_DATA-WERKS.
        BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
        BAPI_MARC1-PROFIT_CTR = IT_DATA-PRCTR.
        BAPI_MARC1-MRP_TYPE = IT_DATA-DISMM.
        BAPI_MARC1-AVAILCHECK = IT_DATA-MTVFP.
        BAPI_MARC1-LOTSIZEKEY = IT_DATA-DISLS.
        BAPI_MARC1-MRP_CTRLER = IT_DATA-DISPO.
        BAPI_MARC1-PROC_TYPE = IT_DATA-BESKZ.
        BAPI_MARC1-SM_KEY = IT_DATA-FHORI.
        BAPI_MARC1-PERIOD_IND = IT_DATA-PERKZ.
        BAPI_MARCX-PLANT = IT_DATA-WERKS.
        BAPI_MARCX-PUR_GROUP = 'X'.
        BAPI_MARCX-AVAILCHECK = 'X'.
        BAPI_MARCX-PROFIT_CTR = 'X'.
        BAPI_MARCX-MRP_TYPE = 'X'.
        BAPI_MARCX-MRP_CTRLER = 'X'.
        BAPI_MARCX-SM_KEY = 'X'.
        BAPI_MARCX-LOTSIZEKEY = 'X'.
       Storage Location.
        BAPI_MARDL-PLANT     = IT_DATA-WERKS.
        BAPI_MARDL-STGE_LOC = IT_DATA-LGORT.
        BAPI_MARDX-PLANT    = IT_DATA-WERKS.
        BAPI_MARDX-STGE_LOC = IT_DATA-LGORT.
    Accounting
        BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
        BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
        BAPI_MBEW1-VAL_CLASS = IT_DATA-BKLAS.
        BAPI_MBEW1-MOVING_PR = IT_DATA-VERPR.
       bapi_mbew1-std_price = it_data-stprs.
        BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
        BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
        BAPI_MBEWX-PRICE_CTRL = 'X'.
        BAPI_MBEWX-STD_PRICE = 'X'.
        BAPI_MBEWX-PRICE_UNIT = 'X'.
        BAPI_MBEWX-MOVING_PR = 'X'.
    *--- BAPI to create material
        CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
        HEADDATA = BAPI_HEAD
        CLIENTDATA = BAPI_MARA1
        CLIENTDATAX = BAPI_MARAX
        PLANTDATA = BAPI_MARC1
        PLANTDATAX = BAPI_MARCX
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA = BAPI_MARDL
    STORAGELOCATIONDATAX = BAPI_MARDX
    VALUATIONDATA = BAPI_MBEW1
    VALUATIONDATAX = BAPI_MBEWX
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA = BAPI_MVKE1
    SALESDATAX = BAPI_MVKEX
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
        IMPORTING
        RETURN = BAPI_RETURN
        TABLES
        MATERIALDESCRIPTION = IT_MAKT
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
        IF BAPI_RETURN-TYPE = 'E'.
          WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,
    IT_DATA-MATNR.
        ELSEIF BAPI_RETURN-TYPE = 'S'.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT          =
         IMPORTING
           RETURN        = BAPI_RETURN
          WRITE: 'Successfully created material' ,IT_DATA-MATNR.
        ENDIF.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT          =
        IMPORTING
          RETURN        = BAPI_RETURN
      ENDLOOP.
    ENDFORM. " UPLOAD_MATMAS

    the Profit center 1000/sslcommon  not created. first create the profit center and then upload your data.check tcode KE52 for created profit centers...

  • Profit Center wise ROI report considering BS items

    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 generating an ROI report
    can you name any standard report to generate ROI report
    2. Client wants profit center wise report in the following format for a profit center.
         Is there any standard report to generate in the format below?
    S.No     Description ( Profit A)
    1     Revenues
    2     Sales Deductions
    3     Cost of Sales
    4     Gross Result (1-2-3)
    5     Less Sales and Distribution Costs & Admin Costs
    6     Net Result ( 4-5)
    Thanks
    Sanjai

    Pl reveiw the reports S_E38_98000090 - Profit Center Group: Key Figures or S_E38_98000091 - Profit Center Comparison: ROI.
    Also take a look at the segment reports S_E38_98000092 to S_E38_98000095.
    You may copy these reports and update to change the formatting.
    Regards
    Subodh

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

    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 thru Validation & Substitutions...
    Plz guide me in writing this
    Points will be suitable rewarded for replies.
    regards
    AVM

    Tcode: GGB1
    An example shows how to make a G/L account available for line item substitution.
    GGB1
    Click FA – Doc Header
    Click Create Substitution icon
    Enter the Text
    Click Create Step icon
    Click the field u want – Say - BKPF- BKTXT
    Choose the option – Say :Constant value
    Give description of ur step
    Click Prerequisite
    Double Click Structure BKPF
    Double Click BKPF-AWKEY
    Click Constant button
    Enter the Text u want to make it appler in the Reference key
    Click Substitution and enter the constant value u want
    Go to Tcode: GGB4
    Click Substituted Fields
    Give ur table and field (Here - BKPF- BKTXT)
    Do it in a similar way..if u cannot proceed, let me know the exact field values..and i can take screenshots and send u across
    Thanks,
    Sridevi

  • Document change/display - Profit Center / Cost center name

    Hi,
    We have a requirement where client wants to display the profit center and cost center names (short or long) when displaying or changing a parked or a posted document. As we all know SAP shows only the profit center and cost center code and not the description during the document display. After all the deliberations, this seems to be an important piece of information while posting a parked document or even viewing it as a posted document.
    What are our options?
    Any help is much appreciated.
    Regards,
    Subodh

    Thanks for your response Tamim.
    Profit center / cost center naming is following a different convention and we are in a roll out phase, therefore we can't think of first item.
    About match code, the requirement is not so much during the posting but primarily while releasing the parked document or viewing the parked / posted document - they want to see the description along side profit / cost center.
    I was looking for clues on any utilities / enhancements / BTE that I may use to bring extra fields during document display.
    Regards,
    Subodh

  • Profit Center Customer Age Analysis

    Team
    Is there any standard report available to extract subject age analysis by the profit center? In FDI1 am able to see BA and also tried evaluations but to no avail.
    Cheers
    Kartik

    Try using standard report S_ALR_87012078 - Due Date Analysis for Open Items Profit center wise in ECC6.
    If the standard report do not suffice your requirement, you can do the following:
    (Note that if you are classical GL, the profit center is not updated on vendor line item.)
    Go to transaction code FDI4
    Select Form Type RFFRRD20 Line item analysis
    Give your form name and description
    Structure (Two axis) - as defaulted
    Click on Create
    You will have lead column
    Delete the rows 2, 3 and 4
    Double click on column 1
    Enter the customer numbers from 1 to 999999
    First column double click (A)
    Slelect following values
    Due date analysis 1
    Days for net due date 0 to 30
    Give the short name, medium name and long text for the column.
    Repeat this step in next columns like 31 to 60, 61 to 90, 91 to 120 and 121 to 99999 days etc in other columns and select due date analysis 1. (B,C,D,E)
    Create one more column by way of formula. To create a new column you need to double click on blue line. Put formula add all five columns you have created above. (F = ABCDE)
    You prepare one more column with
    Due date analysis 2 (G)
    Now you prepare one more column add (F+G) = This will be total open items = over due and not due.
    Now go to FDI1 and prepare a report - assign the form created in FDI4 to the report.
    Characteristics you need to select are
    Account Type (Select Account Type as D for customers)
    Currency
    Customer
    Document Type
    Special G/L Ind
    Company Code
    Change the output types and options according to your requirement.
    Refer FDI2 and FDI3 for other standard reports created.
    Refer FDI5 and FDI6 for other standard forms created.
    Save your report and execute.
    Regards,
    Gaurav

  • Default Profit Center Assignment

    Hi All,
    Our client is using ECC6. He wants Balance Sheet Accounts (Viz Bank A/c, O/S Exps A/c) to be assigned to different profit centers.
    In the present case, Document Splitting is enabled and hence, settings in 3KEH wont work.
    Could somebody help us out..??
    Its urgent . . .
    Thanks a lot in advance

    Dear Eli,
    Thanks for the help.
    I am tying to create a substitution in local sand box and not in client servers.
    I created a new substitution rule at Financial Accounting > Document Line Item level on GGB1. The description is as follows
    Prerequisites:
    BSEG-BUKRS = 'XXXX' AND SYST-TCODE = 'FIBLFFP' AND BSEG-SAKNR = 'XXXXX'
    Substitutions:
    Profit Center  Constant Value XXXX.
    Later on I activated this substitution on OBBH.
    After doing all these settings, when I post entry in FIBLFFP and  check in FB03 the Profit Center is not getting picked.
    Could you please help in this regard..??
    Thanks
    Ravi Kumar

  • Cost center -Description

    Dear Experts,
    How it is possible to maintain
    How to maintain description in several languages for cost centers?
    my client has branches in other countries, so when we maintained description in English (sap login language "EN"), my client is not able to see description when they log in "DE" or "CN" languages.
    how it is possible to maintain description in other languages, when we logged in "EN" language.
    is there any program is available for this?
    The same problem  we are facing for cost centers, cost center groups, profit centers and profit center groups.
    Regards
    babu...

    Dear Eli,
    Thanks for your reply,
    Currently we are log in to other languages and updating the description for master data. but not only for cost centers we are having this issue for Tax codes, Terms of payment and even customisation of some activities.
    but i could not under stood how it can be possible to update through LSMW?
    say for example we can maintain description in other languages for GL accounts as it has separate fields, but i could not see language fields for cost centers or any other language.  could you help in this?
    regards
    babu.

Maybe you are looking for

  • ITunes Match Unknown Error (4010)

    Does anyone know how to solve the "We could not complete your iTunes Store request. An unknown error occurred (4010.)" when trying to set up iTunes Match? It almost went through once but froze at step 3. Now I'm just getting this error above at the e

  • How can i find my phone without the find my iPhone app?

    i lost my iphone while going to a car my friends say that it might of dropped in the floor i said maybe in the car i checked everywhere in the car and i cant find it. My moms sim is in my phone we have the same number yet no one can call or send me a

  • The purpose of javascript in Acrobat

    Is there anyway to reach the content of the pdf with javascript? I would like to traverese the pdf with javascript, search for tag names and replace that tag with a form field. Or even better change the text of differnt tags in the pdf depenig on val

  • Adobe Premiere Elements 4 - Rendering Problem

    If I create small slide shows in Photoshop Elements 6 (ranging from 59 - 125 JPEG Still Shots with captions and/or added text)I can then send each slide show separately into Premiere Elements 4, make further adjustments and add title pages, I can the

  • Microsoft Natural Keyboard Pro Stops Working in Windows 8.1

    My Microsoft Natural Keyboard Pro often (but not always) stops working after I wake my Windows 8.1 Dell laptop up from sleep (or from a shutdown). To make it work, I typically have to log into Windows using my laptop's keyboard. Then I have to unplug