Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

LIST_TO_ASCI

former_member217316
Contributor
0 Kudos

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 REPLIES 10

Sandra_Rossi
Active Contributor

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.

0 Kudos

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 Kudos

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 Kudos

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 Kudos

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.

Even your code is not working in my system.

NTeunckens
Active Contributor
0 Kudos

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/

amansrivastava
Explorer
0 Kudos

i have same issue, did ur issue resolve? please share ur solution

former_member27
Community Manager
Community Manager
0 Kudos

Hi amansrivastava,

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time please note that:

You are adding a comment to an old post that is not likely to get an answer.

I suggest starting a new question and following these guidelines:

I recommend that you familiarize yourself with: https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.

For example, you can:

- outline what steps you took to find answers (and why they weren't helpful)

- share screenshots of what you've seen/done

- make sure you've applied the appropriate tags

- use a more descriptive subject line

The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html

Regards,

Dedi

Regards,
Dedi Metser

amansrivastava
Explorer
0 Kudos

I created a variant in the standard program(with less fields so i can get fields i want) and passed in submit statement instead of passing parameters.