Skip to Content
0

LIST_TO_ASCI

Jan 09, 2017 at 11:14 AM

114

avatar image

Hi

In a FM code, I am SUBMIT a report with a VARIANT. I pass it to the memory using the FM: LIST_FROM_MEMORY. I get it back into the internal table using the FM: LIST_TO_ASCI.

Now my problem is that I am not getting the last 5-6 columns of the report due to the restriction on the table ASCII_TAB-LINE with only 255 characters.

Now I am not sure if the SUBMIT is passing those restricted no of columns or the problem is happening during the internal table download.

How should I get all my columns in the report.

Thanks in advance.

Harsh

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sandra Rossi Jan 09, 2017 at 11:43 AM
1

How do you declare your internal table? Probably it's defined incorrectly -> Increase the number of characters of its line type to more than 255 characters.

Show 5 Share
10 |10000 characters needed characters left characters exceeded

I did that. But still it is showing the same no of columns.

Is that that while I have SUBMIT the program, it exports only 255 characters? Not sure if you understood this one.

0

I did a test. ABAP 7.31. No issue.

ZPROG1:

REPORT zprog1.
TYPES: BEGIN OF vlist,
  line(4000),
  END OF vlist.
TYPES vlist_tab TYPE TABLE OF vlist.
*
SUBMIT zprog2 AND RETURN EXPORTING LIST TO MEMORY.
*
DATA lt_listobject TYPE table_abaplist.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
  listobject = lt_listobject
  EXCEPTIONS
  not_found  = 1
  OTHERS  = 2.
IF sy-subrc = 0.
  DATA lt_listasci TYPE vlist_tab.
  PERFORM list_to_asci  USING lt_listobject
  CHANGING lt_listasci.
  ASSERT 1 = 1.
ENDIF.
*
FORM list_to_asci
  USING it_listobject TYPE table_abaplist
  CHANGING et_listasci TYPE vlist_tab.
  REFRESH et_listasci.
  CALL FUNCTION 'LIST_TO_ASCI'
  TABLES
  listasci  = et_listasci
  listobject = it_listobject
  EXCEPTIONS
  OTHERS  = 3.
ENDFORM."

ZPROG2:

REPORT zprog2 line-size 600.
write : / sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde,
sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde,
sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde,
sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde,
sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde,
sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde, sy-abcde.
0

Not sure what am I doing incorrect.

TYPES: BEGIN OF ty_ascii,
           line(4000),
         END OF ty_ascii.
  DATA: list_tab TYPE table_abaplist,
        string_tab TYPE list_string_table,
        ascii_tab TYPE TABLE OF ty_ascii,
        wa_ascii LIKE LINE OF ascii_tab,
        obj_doc TYPE REF TO cl_document_bcs,
        attachment TYPE REF TO cl_document_bcs,
        document TYPE REF TO cl_document_bcs,
        recipient TYPE REF TO if_recipient_bcs,
        send_request TYPE REF TO cl_bcs.


  CLASS cl_abap_char_utlities DEFINITION LOAD.


  CONSTANTS: c_tab TYPE c VALUE cl_bcs_convert=>gc_tab,
             c_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf.


  DATA: c_sep TYPE x VALUE '09',
        c_cret TYPE x VALUE '0D'.


  CREATE OBJECT: obj_doc, document.


  IF flag_imp = 'X'.
    SUBMIT zlockbox AND RETURN EXPORTING LIST TO MEMORY USING SELECTION-SET 'TEST'.


    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = list_tab
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ELSE.
      CALL FUNCTION 'LIST_TO_ASCI'
*        EXPORTING
*          WITH_LINE_BREAK    = 'X'
        TABLES
          listasci           = ascii_tab
          listobject         = list_tab
        EXCEPTIONS
          empty_list         = 1
          list_index_invalid = 2
          OTHERS             = 3.

0

Did you first make sure that ZLOCKBOX alone returns lines longer than 255? (which value did you set for line-size?)

Check whether my sample code works on your system; if it doesn't; then there's probably a corrective note, or you should ask SAP support.

0

Even your code is not working in my system.

1
Nic Teunckens Jan 09, 2017 at 02:11 PM
0

Does the Selection-Screen Variant also have an Output-Variant (Layout)? That might be an issue there ...?
Does the report output make use of ALV? If so, what is the result when you SUBMIT the report using "CL_SALV_BS_RUNTIME_INFO"-methods ...

cl_salv_bs_runtime_info=>set(
    EXPORTING display  = abap_false
              metadata = abap_false
              data     = abap_true ).

See : https://blogs.sap.com/2011/07/07/gain-programmatic-access-to-data-of-sapgui-alv-reports/

Share
10 |10000 characters needed characters left characters exceeded