cancel
Showing results for 
Search instead for 
Did you mean: 

BPC Routine in Transformation: how to load description and parenth1 ?

0 Kudos
1,060

Hi Expert,

I have simple transformation file like below:

and below is the er_data (final result) looks like:

As you can see that evdescription & parenth1 has been assigned with value, but when I checked the BPC web admin, I cant see any description and parenth1.

Below is the status of package:

/CPMB/MODIFY completed in 0 seconds /CPMB/BW_IOBJ_MASTER_SOURCE completed in 0 seconds /CPMB/BW_IOBJ_TEXT_SOURCE completed in 1 seconds /CPMB/MERGE_IOBJ_MD_DATA completed in 0 seconds /CPMB/IOBJ_SOURCE_MD_CONVERT completed in 1 seconds /CPMB/SPLIT_IOBJ_MD_TXT_DATA completed in 0 seconds /CPMB/BPC_MASTER_DATA_TARGET completed in 4 seconds /CPMB/BPC_TXT_DATA_TARGET completed in 0 seconds /CPMB/CLEAR completed in 0 seconds

[Selection]

--------------------------------------------------------------

INFOOBJECT = ZCMATBPC SELECTION = <?xml version="1.0" encoding="utf-16"?><Selections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Selection Type="Attribute" /><Selection Type="Hierarchy" ImportText="1" /><Selection Type="Language" TextType="2"><Language>E</Language></Selection><Selection Type="AttributeList"><Attribute>ZCMATBPC</Attribute><Attribute>0MATL_TYPE</Attribute><Attribute>0MATL_GROUP</Attribute><Attribute>ZCMATGTXT</Attribute><Attribute>0CHRT_ACCTS</Attribute><Attribute>0GL_ACCOUNT</Attribute><Attribute>ZCGLALTXT</Attribute></Selection><KeyDate>20181108</KeyDate><Relation><Value Right="Hierarchy" Left="Attribute">1</Value></Relation></Selections> WRITEMODE = 2 FORMAT = No TRANSFORMATION = \ROOT\WEBFOLDERS\NNNNN\Material\DATAMANAGER\TRANSFORMATIONFILES\NEW_MATERIAL.xls DIMNAME = MATERIAL CLEAR_ALL = No

[Message]

--------------------------------------------------------------

Task name MASTER DATA SOURCE:

Record count: 4924 Task name

TEXT SOURCE:

Record count: 4924 Task name

CONVERT:

No 1 Round:

End routine is called in convert

Reject count: 0

Record count: 4924

Skip count: 0

Accept count: 5119

Task name MASTER DATA TARGET:

Submit count: 5119

Task name TXT DATA TARGET:

Submit count: 0

model: Material.

Package status: WARNING

any idea what should I do to save evdescription and parenth1 ?

System Information:

BPC NW 10.1

BW 750 SP 11

Many Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

gcybill
Active Participant
0 Kudos

Curious whether implementing the START_ROUTINE implementation as ENDROUTINE is the right approach.

The BADI code looks to be following START ROUTINE coding approach, which will not work for ENDROUTINE.

Secondly, BPC Description can only pick-up either from short, medium, or long text from the source InfoObject TEXT. InfoObject ATTR cannot be used as the source of BPC Description. Customization has to be done at source/BW layer.

Third, Hierarchy extraction should use separate package:

/CPMB/IMPORT_IOBJ_HIER

former_member186338
Active Contributor
0 Kudos

May be er_data is filled incorrectly.

Start with simple ROUTINE badi with single line:

er_data = ir_data.

Look on the table.

Compare with your table.

former_member186338
Active Contributor
0 Kudos

Strange to ask question about issue in ROUTINE badi without providing text of badi!

0 Kudos
TYPES: BEGIN OF zty_material_attr,
             id(32)                TYPE c,
             bpc_mat_type(5)       TYPE c,
             material_type_code(7) TYPE c,
*             parenth1(32)          TYPE c,
           END OF zty_material_attr.

    DATA: lt_material TYPE STANDARD TABLE OF zty_material_attr,
          lr_material TYPE REF TO data.

    DATA: lo_appl               TYPE REF TO cl_uja_application,
          lr_ref_attr           TYPE REF TO data,
          lr_result             TYPE REF TO data,
          lo_ref_if_uja_dim     TYPE REF TO cl_uja_dim,
          lo_cx_uja_admin_error TYPE REF TO cx_uj_application_exception,
          lo_er_data            TYPE REF TO data,
          lo_ir_data            TYPE REF TO data.

    DATA: lv_ir_field(40) TYPE c,
          lv_er_field(40) TYPE c,
          it_hier_info    TYPE uja_t_hier,
          it_hier_name    TYPE uja_t_hier_name,
          it_attr_list    TYPE uja_t_attr,
          it_attr_name    TYPE uja_t_attr_name,
          it_appl_dim     TYPE uja_t_appl_dim,
          it_dim_name     TYPE ujq_t_dim,
          wa_appl_dim     LIKE LINE OF it_appl_dim,
          wa_dim_name     LIKE LINE OF it_dim_name,
          wa_hier_info    TYPE uja_s_hier,
          wa_attr_list    TYPE uja_s_attr,
          l_dimname       TYPE uj_dim_name,
          l_error_message TYPE string.

    CONSTANTS: lc_appset_id    TYPE uj_appset_id VALUE 'NNNNNN',
               lc_appl_id      TYPE uj_appl_id VALUE 'Material',
               lc_material(20) TYPE c VALUE 'MATERIAL',
               lc_id(20)       TYPE c VALUE 'ID',
               lc_parenth1(20) TYPE c VALUE 'PARENTH1'.

    FIELD-SYMBOLS: <ft_ir_data>      TYPE STANDARD TABLE,
                   <fs_ir_data>      TYPE any,
                   <ft_er_data>      TYPE STANDARD TABLE,
                   <fs_er_data>      TYPE any,
                   <lv_ir_field>     TYPE any,
                   <lv_er_field>     TYPE any,
                   <ft_ir_gl>        TYPE STANDARD TABLE,
                   <ft_ir_mat_group> TYPE STANDARD TABLE.

    IF ir_data IS NOT INITIAL.
      ASSIGN ir_data->* TO <ft_ir_data>.
    ENDIF.

    CREATE DATA lo_ir_data LIKE <ft_ir_data>.
    ASSIGN lo_ir_data->* TO <ft_ir_gl>.

    CREATE DATA lo_ir_data LIKE <ft_ir_data>.
    ASSIGN lo_ir_data->* TO <ft_ir_mat_group>.

    <ft_ir_gl> = <ft_ir_data>.
    <ft_ir_mat_group> = <ft_ir_data>.

    SORT <ft_ir_gl> BY ('0GL_ACCOUNT').
    SORT <ft_ir_mat_group> BY ('0MATL_GROUP').

    DELETE ADJACENT DUPLICATES FROM <ft_ir_gl> COMPARING ('0GL_ACCOUNT').
    DELETE ADJACENT DUPLICATES FROM <ft_ir_mat_group> COMPARING ('0MATL_GROUP').

*   Retrieve the structure of MATERIAL Dimension
    IF er_data IS INITIAL.
      TRY.
          CREATE OBJECT lo_appl
            EXPORTING
              i_appset_id      = lc_appset_id
              i_application_id = lc_appl_id.


          REFRESH it_appl_dim.
          lo_appl->get_appl_dim(
              EXPORTING
                  i_appl_id   = lc_appl_id
              IMPORTING
                  et_appl_dim = it_appl_dim ).
      ENDTRY.

      LOOP AT it_appl_dim INTO wa_appl_dim.
        wa_dim_name = wa_appl_dim-dimension.
        APPEND wa_dim_name TO it_dim_name.
      ENDLOOP.

      READ TABLE it_dim_name WITH TABLE KEY table_line = lc_material INTO wa_dim_name.
      IF sy-subrc = 0.
        l_dimname = wa_dim_name.
      ENDIF.

      TRY.
          CREATE OBJECT lo_ref_if_uja_dim
            EXPORTING
              i_appset_id = lc_appset_id
              i_dimension = l_dimname.

*         Retrieve Attribute List
          CALL METHOD lo_ref_if_uja_dim->if_uja_dim_data~get_attr_list
            IMPORTING
              et_attr_list = it_attr_list.

*         Check with multiple attributes
          LOOP AT it_attr_list INTO wa_attr_list.
            APPEND wa_attr_list-attribute_name TO it_attr_name.
          ENDLOOP.

*         Retrieve Hier List
          CALL METHOD lo_ref_if_uja_dim->if_uja_dim_data~get_hier_list
            IMPORTING
              et_hier_info = it_hier_info.

          LOOP AT it_hier_info INTO wa_hier_info.
            APPEND wa_hier_info-hier_name TO it_hier_name.
          ENDLOOP.

        CATCH cx_uja_admin_error INTO lo_cx_uja_admin_error.
          CALL METHOD lo_cx_uja_admin_error->if_message~get_text
            RECEIVING
              result = l_error_message.
          cl_ujk_logger=>log( l_error_message ).
      ENDTRY.

      TRY.
          CALL METHOD lo_ref_if_uja_dim->if_uja_dim_data~create_data_ref
            EXPORTING
              i_data_type  = 'T'               " Data Type
              it_attr_name = it_attr_name      " The list of the components of created struct
              it_hier_name = it_hier_name      " BPC: Internal Table of Hierarchy Name
*             it_extra_field =                  " Extra Caller-Defined fields in the struct to be created
*             if_tech_name = abap_false       " Use Techname as the field name
            IMPORTING
              er_data      = lo_er_data.

        CATCH cx_uja_admin_error INTO lo_cx_uja_admin_error.
          CALL METHOD lo_cx_uja_admin_error->if_message~get_text
            RECEIVING
              result = l_error_message.
          cl_ujk_logger=>log( l_error_message ).
      ENDTRY.
    ENDIF.

    ASSIGN lo_er_data->* TO <ft_er_data>.


*    CREATE DATA lr_material LIKE lt_material.
*    ASSIGN lr_material->* TO <ft_er_data>.


    LOOP AT <ft_ir_gl> ASSIGNING <fs_ir_data>.
      APPEND INITIAL LINE TO <ft_er_data> ASSIGNING <fs_er_data>.

      lv_ir_field = '<fs_ir_data>-0GL_ACCOUNT'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-ID'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_ir_field = '<fs_ir_data>-ZCGLALTXT'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-EVDESCRIPTION'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_er_field = '<fs_er_data>-BPC_MAT_TYPE'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = 'GLA'.
    ENDLOOP.

    LOOP AT <ft_ir_mat_group> ASSIGNING <fs_ir_data>.
      APPEND INITIAL LINE TO <ft_er_data> ASSIGNING <fs_er_data>.

      lv_ir_field = '<fs_ir_data>-0MATL_GROUP'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-ID'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_ir_field = '<fs_ir_data>-ZCMATGTXT'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-EVDESCRIPTION'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_ir_field = '<fs_ir_data>-0GL_ACCOUNT'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-PARENTH1'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>+2.

      lv_er_field = '<fs_er_data>-BPC_MAT_TYPE'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = 'GRP'.
    ENDLOOP.

    LOOP AT <ft_ir_data> ASSIGNING <fs_ir_data>.
      APPEND INITIAL LINE TO <ft_er_data> ASSIGNING <fs_er_data>.

      lv_ir_field = '<fs_ir_data>-ID'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-ID'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_ir_field = '<fs_ir_data>-_LANGU_2EN'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-EVDESCRIPTION'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_ir_field = '<fs_ir_data>-0MATL_GROUP'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-PARENTH1'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_ir_field = '<fs_ir_data>-0MATL_TYPE'.
      ASSIGN (lv_ir_field) TO <lv_ir_field>.
      lv_er_field = '<fs_er_data>-MATERIAL_TYPE_CODE'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = <lv_ir_field>.

      lv_er_field = '<fs_er_data>-BPC_MAT_TYPE'.
      ASSIGN (lv_er_field) TO <lv_er_field>.
      <lv_er_field> = 'DESC'.
    ENDLOOP.

    GET REFERENCE OF <ft_er_data> INTO er_data.