Skip to Content
0
Oct 12 at 06:57 PM

Issue in displaying internal table contents in user decision step of workflow

88 Views

Dear experts,

I have a requirement to show the contents of an internal table in the user-decision step of the work item. This internal table contains CDHDR, CDPOS entries showing the changes made by user in a contract.

In order to show the internal table values I have created a ABAP class-method from which the internal table is passed and used as a multiline container. This is further passed by binding it to the task of the workflow.

In the ABAP class method I have used html tags in order to display the table in the workitem.

But I am facing an issue when the number of entries are more than 8. From 9th row some of the cell values are misaligned and are displayed outside (above or right side) the table.

My code looks like below :

**********************************************************************
***Variables
**********************************************************************
    data : lv_doc_id                   type sofolenti1-doc_id,
           lv_length                   type i,
           lv_zxstring                 type xstring,
           lv_zvar1                    type wsrm_error-wsrm_direction,
           lv_xstr                     type xstring,
           lv_b64string                type string,
           lv_reason_txt               type swcont-value,
           lv_no_att                   type  sy-index,
           lv_document_id              type sofolenti1-doc_id,
           lv_ifs_xml_container        type  xstring,
           lv_ifs_xml_container_schema type  xstring,
           lv_file_name                type swr_filename,
           lv_doc_size                 type i,
           lv_text                     type string,
           lv_tab_lines                type i,
           lv_line_size                type string,
           lv_line_html                type w3_html,
***read change number from cdhdr
           lv_objnr                    type recaobjnr,
           lv_objid                    type cdhdr-objectid,
           lv_rerf                     type rerf,
           lv_lines                    type i,
           lv_out_len                  type i,
           lv_imp_string               type  xstring,
           lv_workitem_id              type swr_struct-workitemid,
           lv_reason_text              type swc_value,
           lv_xstring                  type xstring,
           lv_att_bin                  type xstring,
           lv_string                   type string,
           lv_com_sem                  type xfeld,
           lv_return_code              type sy-subrc,
           lv_lines_ph                 type i,
           lv_counter                  type i,
           lv_final_string             type  xstring.
**********************************************************************
***Structures
**********************************************************************
    types : begin of lty_s_out_tab,
              contract   type recnnumber,
              fname      type fieldname,
              f_old(230) type c, "cdfldvalo,
              f_new(230) type c, "cdfldvaln,
            end of lty_s_out_tab.


**********************************************************************
***Work areas
**********************************************************************
    data : ls_att_header   type swr_att_header,
           ls_out_tab      type lty_s_out_tab,
           ls_att_id       type swr_att_id,
           lwa_cdhdr        type cdhdr,
           lwa_pos_head     type cdred,
           ls_documentdata type sofolenti1,
           ls_binary       type sdokcntbin,
           lwa_output       type w3html,
           lwa_output_temp  type w3html,
           ls_reason       type swr_cont.
**********************************************************************
***Internal tables
**********************************************************************
    data : lt_msg_lines                type sapi_msg_lines,
           lit_cdhdr                    type table of cdhdr,
           lt_pos                      type table of cdshw,
           lt_pos_tmp                  type table of cdshw,
           lit_pos_head_tmp             type table of cdred,
           lit_pos_head                 type table of cdred,
           lt_subcontainer_all_objects type table of swr_cont,
           lt_object_content           type table of solisti1,
           lt_simple_container         type table of swr_cont,
           lt_message_lines            type table of swr_messag,
           lt_message_struct           type table of swr_mstruc,
           lt_out_tab                  type table of lty_s_out_tab,
           lt_solitab                  type soli_tab,
           lt_content_hex              type solix_tab,
           lt_subcontainer_bor_objects type table of swr_cont,
           lt_binary                   type sdokcntbins,
           lt_xstring                  type table of xstring,
           lit_output                   type table of w3html,
           lit_output_temp              type table of w3html,
           lt_contents_hex             type solix_tab.
**********************************************************************
**********************************************************************
    select single objnr rerf from vicncn into (lv_objnr,lv_rerf) where bukrs eq compcode and recnnr eq contract.
    if sy-subrc eq 0 .
      lv_objid = lv_objnr.
    endif.
    call function 'CHANGEDOCUMENT_READ_HEADERS'
      exporting
*       ARCHIVE_HANDLE             = 0
        date_of_change             = sy-datum
        objectclass                = 'RECN_REGC'
        objectid                   = lv_objid
        time_of_change             = '000000'
        username                   = lv_rerf
*       LOCAL_TIME                 = ' '
        time_zone                  = 'UTC'
        date_until                 = '99991231'
        time_until                 = '235959'
*       NOPLUS_ASWILDCARD_INOBJID  = ' '
*       READ_CHANGEDOCU            = ' '
*       I_HOT                      = ' '
      tables
        i_cdhdr                    = lit_cdhdr
      exceptions
        no_position_found          = 1
        wrong_access_to_archive    = 2
        time_zone_conversion_error = 3
        others                     = 4.
    if sy-subrc eq 0 and lit_cdhdr[] is not initial.
      sort lit_cdhdr by udate utime descending.
      clear lv_tab_lines.
      describe table lit_cdhdr lines lv_tab_lines.
      if lv_tab_lines gt 1.
        delete lit_cdhdr from 2.
      endif.


* Implement suitable error handling here
      loop at lit_cdhdr into lwa_cdhdr.
        clear : lit_pos_head_tmp[],lt_pos_tmp.
        call function 'CHANGEDOCUMENT_READ_POSITIONS'
          exporting
*           ARCHIVE_HANDLE          = 0
            changenumber            = lwa_cdhdr-changenr
*           TABLEKEY                = ' '
*           TABLENAME               = ' '
*           TABLEKEY254             = ' '
*           KEYGUID                 = ' '
*           KEYGUID_STR             = ' '
*           I_PREP_UNIT             = 'X'
*           I_HOT                   = ' '
*   IMPORTING
*           HEADER                  =
*           ET_CDRED_STR            =
          tables
            editpos                 = lt_pos_tmp
            editpos_with_header     = lit_pos_head_tmp
          exceptions
            no_position_found       = 1
            wrong_access_to_archive = 2
            others                  = 3.
        if sy-subrc eq 0.
* Implement suitable error handling here


          append lines of lt_pos_tmp to lt_pos.
          append lines of lit_pos_head_tmp to lit_pos_head.
        endif.


        clear lwa_cdhdr.
      endloop.


      ls_out_tab-contract = 'Contract'.
      ls_out_tab-fname = 'Field name'.
      ls_out_tab-f_old = 'Old value'.
      ls_out_tab-f_new = 'New value'.
      append ls_out_tab to lt_out_tab.
      clear ls_out_tab.
      clear lv_lines_ph.




      loop at lit_pos_head into lwa_pos_head.


        at first.
          lwa_output-line = '<html>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<body>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<table border="1">'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<tr>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<th>Field Name</th>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<th>Field Desc</th>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<th>Old Val</th>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '<th>New Val</th>'.
          append lwa_output to lit_output.
          clear: lwa_output.


          lwa_output-line = '</tr>'.
          append lwa_output to lit_output.
          clear: lwa_output.
        endat.


        move-corresponding lwa_pos_head to ls_out_tab.
        ls_out_tab-contract = contract.
        append ls_out_tab to lt_out_tab.


        if lwa_pos_head-fname is not initial and lwa_pos_head-fname ne 'RECNDACTIV'.
***Splitting logic
          lwa_output-line = '<tr>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '<td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = lwa_pos_head-fname .
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '</td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '<td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = lwa_pos_head-ftext.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '</td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '<td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          if lwa_pos_head-f_old is not initial.
            lwa_output-line = lwa_pos_head-f_old.
            append lwa_output to lit_output.
            clear lwa_output .
          endif.


          lwa_output-line = '</td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '<td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          if lwa_pos_head-f_new is not initial.
            lwa_output-line = lwa_pos_head-f_new.
            append lwa_output to lit_output.
            clear lwa_output .
          endif.


          lwa_output-line = '</td>'.
          append lwa_output to lit_output.
          clear lwa_output .


          lwa_output-line = '</tr>'.
          append lwa_output to lit_output.
          clear lwa_output .


        endif.
        clear: lwa_output.


        clear : lwa_pos_head, ls_out_tab.


        at last.
          lwa_output-line = '</table></body></html>'.
          append lwa_output to lit_output.
          clear: lwa_output.
        endat.


      endloop.


lit_output is the table which I am passing to the workflow item as a multiline container

In case of rows more than 8 , some of the cell(values) are misaligned and displayed at the top of the table as shown in the screenshot :

The line type of the output table is w3html(255 char for each cell) .

1.Is there any restriction on the number of rows displayed in a user decision step of work item ?

2. what is the best approach to display a table ? I tried string/xstring but finally found that html is the easiest way but there is an issue as described above.

Please let me know if something is not clear in my question.

Your suggestions are highly appreciated !

Thank you !

Prasanth P