Application Development and Automation 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: 
Read only

Alternative for function SAVE_LIST

Clemenss
Active Contributor
0 Likes
1,721

Hi friends,

I used function SAVE_LIST to get the current list object with all WRITE output of my program. Then I use FUNCTION 'WWW_HTML_FROM_LISTOBJECT' and send the content as mail.

Now we observed that in background processing only the last page is sent. OK, the documentation of SAVE_LIST states clearly that it is not suitable for background processing.

Is there any Alternative? I am looking for something that always works - regardless of background or online processing.

Thanks in advance for any qualified help.

Regards

Clemens

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
1,492

Since the FM SAVE_LIST doesn't work in the Background, you don't have many choices.

You generate the Spool of the list and convert the spool data to HTML. You can use NEW-PAGE PRINT ON and PRINT OFF to generate the Spool. Once the Spool is created, you can get the spool number from SY-SPONO. Use the FM RSPO_RETURN_ABAP_SPOOLJOB to get the data in the List. You may need to find a technique to convert the List to type ABAPLIST type which you can supply to WWW_HTML_FROM_LISTOBJECT.

If you don't find the way to convert the List to List type, check the FM RSPO_RETURN_ABAP_SPOOLJOB. It uses the SUBMIT RSPOLIST EXPORTING to MEMORY and get back the List using the FM LIST_FROM_MEMORY. Once you get the list, use the FM WWW_HTML_FROM_LISTOBJECT to convert to HTML.

Regards,

Naimesh Patel

9 REPLIES 9
Read only

GauthamV
Active Contributor
0 Likes
1,492

Use FM LIST_FROM_MEMORY

Read only

Clemenss
Active Contributor
0 Likes
1,492

Hi Gautham Vangaveti,

can you give a few code lines?

I tried without success (SY-SUBRC = 1).

Regards,

Clemens

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,492

Hello Clemens,

You have to use the FM 'LIST_FROM_MEMORY' in conjunction with:

i. SUBMIT ... EXPORTING LIST TO MEMORY statement

ii. Function module 'LIST_TO_MEMORY' - But this FM uses SAVE_LIST, which might cause a problem!

Using this FM individually will raise the exception NOT_FOUND.

What do you mean by "background" processing - schedule the program as a job in SM36 or SUBMIT it as a BG job?

BR,

Suhas

Read only

GauthamV
Active Contributor
0 Likes
1,492

As Suhas mentioned this can be used along with submit statement.


      SUBMIT  MBMISSFI
      WITH MATERIAL IN MATERIAL
      WITH R_PLANT IN r_plant
      WITH MK_DOC IN mk_doc
      WITH YEAR IN YEAR
      WITH f_reuse = f_reuse
      WITH p_key = p_key
      exporting LIST TO MEMORY
                AND RETURN.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = list_tab
        EXCEPTIONS
          not_found  = 1
          OTHERS     = 2.

      IF sy-subrc = 0.
        CALL FUNCTION 'WRITE_LIST'
          TABLES
            listobject = list_tab.
        CLEAR : LIST_TAB.
        REFRESH : LIST_TAB.
      ENDIF.

Read only

Clemenss
Active Contributor
0 Likes
1,492

Hi,

really disappointing. If I want to send the list output of a report from within the report, I can not submit the report that already created the output.

If you have an answer to my question, then please give it. If not, please remain silent.

All given answers are available using easy forum find or Google. Please do not to assume that I am not able to do this. No answer matches the question.

Regards,

Clemens

Read only

GauthamV
Active Contributor
0 Likes
1,492

-

Read only

naimesh_patel
Active Contributor
0 Likes
1,493

Since the FM SAVE_LIST doesn't work in the Background, you don't have many choices.

You generate the Spool of the list and convert the spool data to HTML. You can use NEW-PAGE PRINT ON and PRINT OFF to generate the Spool. Once the Spool is created, you can get the spool number from SY-SPONO. Use the FM RSPO_RETURN_ABAP_SPOOLJOB to get the data in the List. You may need to find a technique to convert the List to type ABAPLIST type which you can supply to WWW_HTML_FROM_LISTOBJECT.

If you don't find the way to convert the List to List type, check the FM RSPO_RETURN_ABAP_SPOOLJOB. It uses the SUBMIT RSPOLIST EXPORTING to MEMORY and get back the List using the FM LIST_FROM_MEMORY. Once you get the list, use the FM WWW_HTML_FROM_LISTOBJECT to convert to HTML.

Regards,

Naimesh Patel

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,492

Hello Naimesh,

It uses the SUBMIT RSPOLIST EXPORTING to MEMORY and get back the List using the FM LIST_FROM_MEMORY.

Just a small problem in this approach. The programmer has refreshed the memory after importing it, see the use of LIST_FREE_MEMORY

@Clemens:

You can create a custom FM based on similar lines by SUBMIT'ting RSPOLIST & getting the exporting structure as ABAPLIST instead of ASCII format. In this way you can use WWW_HTML_FROM_LISTOBJECT.

BR,

Suhas

PS: You can use the FM WWW_ITAB_TO_HTML, but this FM is obsolete(ABAP Release 711).

Edited by: Suhas Saha on Feb 23, 2012 11:28 AM

Read only

0 Likes
1,492

Suhas mentioned:

Just a small problem in this approach. The programmer has refreshed the memory after importing it, see the use of LIST_FREE_MEMORY

Correct. That's the reason I mentioned to find a way to convert the List to List Object which can be supplied to WWW_HTML_FROM_LISTOBJECT.

I tried to capture the technique in the post [Alternative to SAVE_LIST|http://help-abap.zevolving.com/2012/02/alternative-to-save_list/]

Regards,

Naimesh Patel