Skip to Content

SAP delivered with SPS 14 a new Item called custom extension. This item can be used to programmatically add HTML to the corresponding Web Applícation in Java.

*!http://www.biexcellencesuite.com/portals/0/CMS/weblog/item_cat.jpg|height=1|alt=|width=1|src=http://www.biexcellencesuite.com/portals/0/CMS/weblog/item_cat.jpg|border=0!*

This Item allows to add a custom ABAP Class which is invoke during processing of the template. This ABAP Class Must implement Interface *IF_BICS_CONS_WEBITEM_CUST_EXIT*

You can type in the Name of your newly created ABAP Class in the Item Parameters:

!http://biexcellencesuite.com/portals/0/CMS/weblog/item_prop.jpg|height=1|alt=|width=1|src=http://biexcellencesuite.com/portals/0/CMS/weblog/item_prop.jpg|border=0!

This Interface offers three Methods which should be implemented:

IF_BICS_CONS_WEBITEM_CUST_EXIT~INITIALIZE
IF_BICS_CONS_WEBITEM_CUST_EXIT~FREE
IF_BICS_CONS_WEBITEM_CUST_EXIT~EXECUTE

Within the initialize method, you get a table with the parameters entered in WAD..

The Execute method is intended to produce the HTML which should be displayed in the executed web template. In the WAD you can also define the dataproviders which should be overhanded to the ABAP Class in XML. The processing of the XML is not part of that Article.

The Free Method should be used to clear-up used Data references to free memory.

We used this item to develop an Flash Chart item in BI 7.0 runtime and a full formatted PDF and Powerpoint Export.

To get such a result you need to generate HTML in the Execute Method.

 

TN_T_DATA_PROVIDER,

    L_R_VARIABLE_CONTAINER TYPE REF TO IF_IXML_NODE.

  CLEAR E_XML.

  TRY.

  •     All data passed to the webitem exit is hold in I_XML using XML.

  •     The XML is UTF-8 encoded. You can convert the UTF-8 xstring

  •     to a simple ABAP string by calling the following method:

  •     ==================================================================

      CALL METHOD CL_BICS_CONS_WEBITEM_UTIL=>UTF8_XSTRING_2_STRING

        EXPORTING

          I_UTF8_XSTRING = I_XML

        RECEIVING

          R_STRING       = L_XML.

  •     The XML includes sections about the used data provider and about the

  •     variable container. The following method parses the XML and

  •     provides the IF_IXML_NODE instances for data providers and for the

  •     variable container.

  •     ==================================================================

      CALL METHOD CL_BICS_CONS_WEBITEM_UTIL=>PARSE_XML

        EXPORTING

          I_XML                  = I_XML

        IMPORTING

          E_T_DATA_PROVIDERS     = L_T_DATA_PROVIDERS

          E_R_VARIABLE_CONTAINER = L_R_VARIABLE_CONTAINER.

  •     The following section assemble a small HTML snippet to be returned

  •     to the UI

  •     ==================================================================

      CALL METHOD ME->SET_CHART_DATA

        EXPORTING

          I_XML = L_XML.

      CALL METHOD ME->RENDER_HTML

        IMPORTING

          E_HTML = L_STRING.

data l_span type string.

concatenate ‘‘ into l_span.

      CONCATENATE l_span ‘<!– start of chart >’ L_STRING ‘<! end of chart –></span>’ INTO L_STRING.

  •     The customer exit returns HTML data to be displayed.

  •     The result HTML needs to be stored in E_XML using UTF-8 encoding.

  •     You can convert simple ABAP-strings to UTF-8 by calling the

  •     following the method:

  •     ==================================================================

      CALL METHOD CL_BICS_CONS_WEBITEM_UTIL=>STRING_2_UTF8_XSTRING

        EXPORTING

          I_STRING       = L_STRING

        RECEIVING

          R_UTF8_XSTRING = E_XML.

    CATCH CX_BICS_CONS_WEBITEM_ERROR.

  •     exception handling

  ENDTRY.

This code of method set_chart_data is below:

—-


  • METHOD SET_CHART_DATA

—-


  • Get data in correct format for the IGS

—-


METHOD SET_CHART_DATA .

  • Data declaration

  DATA:

       l_r_view                    TYPE  REF TO cl_rsr_www_view,

       l_t_axis_data_columns       TYPE  rsrds_t_axis_data,

       l_t_axis_data_rows          TYPE  rsrds_t_axis_data,

       l_t_cell_data               TYPE  rsrds_t_cell,

       l_t_axis_chars              TYPE  rsrds_t_axis_chars,

       l_t_axis_info               TYPE  rsrds_t_axis_info,

       l_no_columns                TYPE  i,

       l_paramvalue                TYPE  rsrparametervalue,

       l_switchmatrix              TYPE  rs_bool,

       l_date(8)                   TYPE  c,           “sy-datum,

       l_time(6)                   TYPE  c,           “sy-uzeit,

       l_no_cell_calculation       TYPE  i,

       l_title                     TYPE  gfwcuvac,

       l_num_token(2)              TYPE  n,

       l_token_count               TYPE  i,

       l_token_reset               TYPE  rs_bool.

  FIELD-SYMBOLS:

                   TYPE  igs_ext.

  • Get current view data in flat format

        • CALL METHOD o_r_view->n_r_data_set->refresh( i_version = cl_rsr_data_set=>c_version_20a_flat1 ).

data l_r_inst type ref to /KAIWA/bwef_cl_Easy_usage.

create object l_r_inst.

*CALL METHOD /KAIWA/bwef_cl_Easy_usage=>CONVERT_BICS_TO_3X_VIEW

CALL METHOD l_r_inst->CONVERT_BICS_TO_3X_VIEW

  EXPORTING

    I_XML                = i_xml

   IMPORTING

    E_T_AXIS_DATA_COLUMN = l_t_axis_data_columns

    E_T_AXIS_DATA_ROWS   = l_t_axis_data_rows

    E_T_CELL_DATA        = l_t_cell_data

    E_T_AXIS_CHARS       = l_t_axis_chars

    E_T_AXIS_INFO        = l_t_axis_info

  EXCEPTIONS

    LOCKALREADYRELEASED  = 1

    NOLOGSYSFOUND        = 2

    others               = 3

        .

data l_rows type i.

data l_cols type i.

describe table l_t_axis_data_columns lines l_cols.

describe table l_t_axis_data_rows lines l_rows.

  • Assign view data to local data structures

*add  conversion of Bics to View_data

  • Convert view data to IGS data

  l_paramvalue = n_r_attribute->get( i_id = ‘SWITCHMATRIX’ ).

  l_switchmatrix = l_paramvalue.

  IF l_switchmatrix = rs_c_true.

    l_no_columns = l_rows. .

    l_no_cell_calculation = l_cols. .

  ELSE.

    l_no_columns = l_cols.

    l_no_cell_calculation = l_cols.

  ENDIF.

  LOOP AT l_t_cell_data

       ASSIGNING -value.

      ENDIF.

    ENDIF.

  ENDLOOP.

  CALL METHOD convert_to_igs_data

    EXPORTING

      i_no_columns          = l_no_columns

      i_no_cell_calculation = l_no_cell_calculation

      i_t_axis_data_rows    = l_t_axis_data_rows

      i_t_axis_data_columns = l_t_axis_data_columns

      i_t_cell_data         = l_t_cell_data

      i_t_axis_chars        = l_t_axis_chars

      i_t_axis_info         = l_t_axis_info

    IMPORTING

      e_t_igs_data          = o_t_chart_data

      e_t_labels_groupid    = o_t_labels_groupid

      e_t_labels_category   = o_t_labels_category

      e_t_chart_extensions  = o_t_chart_extensions

      e_t_extensions        = o_t_extensions

      e_t_extensions_tmp    = o_t_extensions_tmp.

  • Ensure CAT is before SER

  SORT o_t_extensions_tmp BY token.

  l_token_reset = rs_c_false.

  l_token_count = 1.

  • Reorder token counter

  LOOP AT o_t_extensions_tmp

       ASSIGNING method RENDER_HTML.

  DATA:

      L_STRING                          TYPE  STRING,

      L_STYLE                           TYPE  STRING,

      L_T_PARAMETERS                    TYPE  RRXW3_S_QUERY,

      L_CONTENT_TYPE                    TYPE  W3PARAM-CONT_TYPE,

      L_CONTENT_LENGTH                  TYPE  W3PARAM-CONT_LEN,

      L_T_CONTENT                       TYPE  W3MIMETABTYPE,

      L_T_IMAGEMAP_HTML                 TYPE  W3HTMLTABTYPE,

      L_IMAGEMAP_HTML                   TYPE  STRING,

      L_MSG_TEXT                        TYPE  RS_CHAR72,

      L_URL                             TYPE  STRING,

      L_R_PARAMETER                     TYPE  REF TO CL_RSR_PARAMETER,

      L_BLOB_LEN                        TYPE  I,

      L_PARAMVALUE                      TYPE  RSRPARAMETERVALUE,

      L_GENERATE_LINKS                  TYPE  RS_BOOL,

      L_S_MIME_INFO                     TYPE  RSZW_S_MIME_INFO,

      L_MIME_PATH                       TYPE  STRING,

      L_MIME_NAME                       TYPE  STRING,

      L_S_RAISE                         TYPE  RS_S_RAISE,

      L_LEGEND_POSITION                 TYPE  STRING,

      L_CHART_MODIFIED                  TYPE  RS_BOOL,

      L_XML_CHART_TYPE                  TYPE  RSZWCHARTTYPE,

      L_PORTAL_CACHE_TAG_EXTENSION      TYPE  STRING,         

      L_NO_CATEGORIES                   TYPE  I,               

      L_NO_SERIES                       TYPE  I,               

      L_NO_CELLS                        TYPE  I,               

      L_COUNT1                          TYPE  I,               

      L_COUNT2                          TYPE  I,               

      L_CHART_CONTAINS_TOO_MANY_DATA    TYPE  RS_BOOL,         

      L_IGS_TITLE                       TYPE  GFWCUVAC,        

      L_TITLE_STRING                    TYPE  STRING,          

      L_CHART_DATA_EMPTY                TYPE  RS_BOOL,         

      L_VALUE_TEXT                      TYPE  CHAR80,          

      L_CUDIM_STRING                    TYPE  STRING,          

      L_T_CELL_DATA_TMP                 TYPE  RSRDS_T_CELL,    

      L_IGS_SUB_TITLE                   TYPE  GFWCUVAC,        

      L_SUB_TITLE_STRING                TYPE  STRING,          

      L_DATA_TABLE                      TYPE  C,               

      L_XAXISNAME                    TYPE  STRING,          

      L_YAXISNAME                    TYPE  STRING,          

      L_S_PARAM                      TYPE /KAIWA/BWEF_S_PARAM,

      L_ITEM_OFFSET                     TYPE  STRING.         

  • Initialization

      IF O_T_CHART_DATA IS INITIAL.

        CONCATENATE ‘<p’ L_STYLE ‘>chart contains no data</p>’ INTO e_html.

        L_CHART_DATA_EMPTY = RS_C_TRUE.

      ENDIF.

      IF L_CHART_DATA_EMPTY = RS_C_FALSE.

  •       Chart title

        CLEAR L_TITLE_STRING.

        L_TITLE_STRING = N_R_ATTRIBUTE->GET( I_ID = ‘TITLE’ ).

        IF L_TITLE_STRING IS NOT INITIAL.

          CALL METHOD CL_RSR_WWW_RENDERER=>REPLACE_SAP_BW_TEXT

            CHANGING

              C_STRING = L_TITLE_STRING.

          L_IGS_TITLE = L_TITLE_STRING.

        ENDIF.

  •       X-axis title

        CLEAR L_TITLE_STRING.

        L_TITLE_STRING = N_R_ATTRIBUTE->GET( I_ID = ‘TITLE_CATEGORIES’ ).

        IF L_TITLE_STRING IS NOT INITIAL.

          CALL METHOD CL_RSR_WWW_RENDERER=>REPLACE_SAP_BW_TEXT

            CHANGING

              C_STRING = L_TITLE_STRING.

          L_IGS_TITLE = L_TITLE_STRING.

        ENDIF.

  •       Y-axis title

        CLEAR L_TITLE_STRING.

        L_TITLE_STRING = N_R_ATTRIBUTE->GET( I_ID = ‘TITLE_VALUES’ ).

        IF L_TITLE_STRING IS NOT INITIAL.

          CALL METHOD CL_RSR_WWW_RENDERER=>REPLACE_SAP_BW_TEXT

            CHANGING

              C_STRING = L_TITLE_STRING.

          L_IGS_TITLE = L_TITLE_STRING.

        ENDIF.

  •       Secondary X-axis title

        CLEAR L_TITLE_STRING.

        L_TITLE_STRING = N_R_ATTRIBUTE->GET( I_ID = ‘TITLE_SEC_CATEGORIES’ ).

        IF L_TITLE_STRING IS NOT INITIAL.

          CALL METHOD CL_RSR_WWW_RENDERER=>REPLACE_SAP_BW_TEXT

            CHANGING

              C_STRING = L_TITLE_STRING.

          L_IGS_TITLE = L_TITLE_STRING.

        ENDIF.

  •       Secondary Y-axis title

        CLEAR L_TITLE_STRING.

        L_TITLE_STRING = N_R_ATTRIBUTE->GET( I_ID = ‘TITLE_SEC_VALUES’).

        IF L_TITLE_STRING IS NOT INITIAL.

          CALL METHOD CL_RSR_WWW_RENDERER=>REPLACE_SAP_BW_TEXT

            CHANGING

              C_STRING = L_TITLE_STRING.

          L_IGS_TITLE = L_TITLE_STRING.

        ENDIF.

        CLEAR L_SUB_TITLE_STRING.

        L_SUB_TITLE_STRING = N_R_ATTRIBUTE->GET( I_ID = ‘SUB_TITLE’ ).

        IF L_SUB_TITLE_STRING IS NOT INITIAL.

          CALL METHOD CL_RSR_WWW_RENDERER=>REPLACE_SAP_BW_TEXT

            CHANGING

              C_STRING = L_SUB_TITLE_STRING.

          L_IGS_SUB_TITLE = L_SUB_TITLE_STRING.

        ENDIF.

        ENDIF.

        CLEAR L_T_IMAGEMAP_HTML.

        L_CHART_CONTAINS_TOO_MANY_DATA = RS_C_FALSE.

        DESCRIBE TABLE O_T_LABELS_GROUPID LINES L_NO_SERIES.

        DESCRIBE TABLE O_T_LABELS_CATEGORY LINES L_NO_CATEGORIES.

        IF L_CHART_CONTAINS_TOO_MANY_DATA = RS_C_FALSE.

          DATA : HOCHKOMMA2(2) TYPE X VALUE ’27’.

          DATA: HOCHKOMMA(1) TYPE C.

          DATA L_XML TYPE STRING.

          CLEAR P_T_CONV_PARS.

          HOCHKOMMA = CL_ABAP_CONV_IN_CE=>UCCP( ‘0027’ ).

          CALL METHOD ME->GET_DATA_XML

            EXPORTING

              I_HOCHKOMMA = HOCHKOMMA

            IMPORTING

              E_XML       = L_XML.

          CLEAR e_html.

          CLEAR P_IMAGESTRING.

          DATA L_WIDTH TYPE STRING.

          DATA L_CHART_TYPE TYPE STRING.

          DATA L_SCRIPT TYPE STRING.

          DATA L_HEIGHT TYPE STRING.

          L_WIDTH = N_R_ATTRIBUTE->GET( I_ID = ‘WIDTH’ ).

          L_CHART_TYPE = N_R_ATTRIBUTE->GET( I_ID = ‘CHART_TYPE’ ).

          L_HEIGHT = N_R_ATTRIBUTE->GET( I_ID = ‘HEIGHT’ ).

          L_S_PARAM-NAME = ‘WIDTH’.

          L_S_PARAM-VALUE = L_WIDTH.

          APPEND L_S_PARAM TO P_T_CONV_PARS.

          L_S_PARAM-NAME = ‘HEIGHT’.

          L_S_PARAM-VALUE = L_HEIGHT.

          APPEND L_S_PARAM TO P_T_CONV_PARS.

          ” Check Drill Down Texts

          DATA L_IOBJNM TYPE RSD_IOBJNM.

          READ TABLE P_T_DRILL_PATH INTO L_IOBJNM INDEX P_LEVEL.

          DATA L_S_IOBJ TYPE RSD_S_IOBJ.

          IF SY-SUBRC = 0.

            CALL FUNCTION ‘RSD_IOBJ_GET’

              EXPORTING

                I_IOBJNM         = L_IOBJNM

              IMPORTING

                E_S_IOBJ         = L_S_IOBJ

              EXCEPTIONS

                IOBJ_NOT_FOUND   = 1

                ILLEGAL_INPUT    = 2

                BCT_COMP_INVALID = 3

                OTHERS           = 4.

          ELSE.

          IF P_SETID IS INITIAL.

  • Build Javascript

            CONCATENATE

                ” INTO L_SCRIPT.
ELSE.
SELECT SINGLE CHARTFILE FROM /KAIWA/CHSET INTO L_CHART_TYPE WHERE SETID = P_SETID.

CONCATENATE
” INTO L_SCRIPT.

          ENDIF.

  • bugfix Version 1.2′ Incident &2008001

REPLACE all OCCURRENCES OF ‘%’ in l_script with ‘%25’.

REPLACE all OCCURRENCES OF ‘&’ in l_script with ‘%26’.

  • Build Div

          CONCATENATE ‘


‘IBS Solution Flash Chart


L_SCRIPT
INTO e_html.
L_STRING = N_NAME.

DATA: L_PAGE TYPE STRING,
L_REQUEST TYPE STRING.

L_PAGE = 1. “N_R_PAGE->N_PAGENO.
L_REQUEST = 1. ” N_R_PAGE->N_REQUESTNO.

          CONDENSE L_PAGE NO-GAPS.

          CONDENSE L_REQUEST NO-GAPS.

          CONCATENATE ‘!|height=|REQUEST_NO= L_REQUEST

  •                      |LANGUAGE=E& &CMD=GET_ITEM_MIME& & |ITEM= N_NAME |Width=|src=|PAGENO=

                      L_PAGE !’

              INTO P_IMAGESTRING.

          P_BACKUP_OUTPUT = e_html.

          DATA L_ANI TYPE STRING.

          DATA L_ANI2 TYPE STRING.

          CONCATENATE ‘animation=’ C_HOCHKOMMA ‘1’ C_HOCHKOMMA INTO L_ANI.

          CONCATENATE ‘animation=’ C_HOCHKOMMA ‘0’ C_HOCHKOMMA INTO L_ANI2.

          REPLACE ALL OCCURRENCES OF L_ANI IN P_BACKUP_OUTPUT WITH L_ANI2.

          IF SY-SUBRC

To report this post you need to login first.

8 Comments

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

  1. Former Member
    Hi Kai

    Thanks for the blog,
    We upgraded to SP14 just a few days ago and I found out that option.

    I was using “table interface” in 3.5 and it was totaly different.

    How can I format the result table in the current version, like adding a background color to a cell etc.?

    I would also like to know how can I debug the CLASS and view it’s content during runtime?

    Thanks

    Shlomi

    (0) 
    1. Former Member Post author
      Hi Shlomi,

      this CUstom Extension is no replacement of the table interface in 3.x. The intend is even more to visualize new elements or read content dynamically from ABAP according to a specific navigation State.

      in 7.0 is currently no replacement of the ABAP Modify class. with SPS 15 some predefined Table modifications were shipped. This allows to display document in cells, or change the Column width. But there is no interface to change the Layout of the analysis grid with your own coding.

      Best regards,
      kai

      (0) 
  2. Former Member
    Hello Kai,

    I know that you invested a lot of expertise for this thing. Would you be as kind as to share your implemented JavaScript Chart Class? We realized that functionality only using JavaScript. Bit this way is much nicer.

    Bye

    (0) 
    1. Former Member Post author
      Hi Alexander,

      we bought a OEM license of Fusioncharts. They offer predefined Flash charts with Javascript integration. We created a framework together with a designer in VB.NEt, and customizing XML generations in ABAP. With that framework we only need to transform BI Data in ABAP to XML and render such kind of Flash Items in BI 3.x and BI 7.0.
      It would be much to complex to publish all the Coding here. Also the Transformation of BI 7.0 Data was quite complicated.

      But may you are interested in system access to a demo system to see it in action.
      Just send me a mail to kai.wachter@ibs-solution.de.

      best regards,
      Kai

      (0) 
  3. Former Member
    Hi Kai,

    thanks for the blog!

    I would be very grateful if you could share the logic for one type and method you are using (inside SET_CHART_DATA method):
    data l_r_inst type ref to /KAIWA/bwef_cl_Easy_usage.
    CALL METHOD l_r_inst->CONVERT_BICS_TO_3X_VIEW
      EXPORTING
        I_XML                = i_xml
       IMPORTING
        E_T_AXIS_DATA_COLUMN = l_t_axis_data_columns
        E_T_AXIS_DATA_ROWS   = l_t_axis_data_rows
        E_T_CELL_DATA        = l_t_cell_data
        E_T_AXIS_CHARS       = l_t_axis_chars
        E_T_AXIS_INFO        = l_t_axis_info
      EXCEPTIONS
        LOCKALREADYRELEASED  = 1
        NOLOGSYSFOUND        = 2
        others               = 3
            .

    Would it be possible to get it from you? ๐Ÿ™‚

    Or at least if you know any hint to get the contents (values of key figures etc.) of the xml in this ABAP class implementing the interface IF_BICS_CONS_WEBITEM_CUST_EXIT?

    Kind regards,
    Hubert

    (0) 
  4. Former Member
    Hi

    Is it possible to alter the output of an analysis item using this method?

    I have implemented this class, and am able to update the XML according to my requirements, but that doesn’t seem to update the analysis item.

    Cheers,
    Andrew

    (0) 

Leave a Reply