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

WRITE_LIST and SPOOL

Former Member
0 Likes
1,575

Hi friends!

I am storing data into memory and then displaying via WRITE_LIST FM, can i store this to spool at background mode.

Any ideas?

Please assist.

Thank you.

10 REPLIES 10
Read only

Former Member
0 Likes
1,311

Instead of Exporting list to memory , You could use JOB

I hope you got the list object from SUBMIT option export list to memory.

But In your case you have to use SUBMIT using Job options.

You need call the submit , inbetween open_job and close_job functions. and you need to pass spool params etc.

Check the SUBMIT using Job options.

Read only

0 Likes
1,311

Thanks.

But SUBMIT/JOBS doesnt suit my requirement.

I have tried that too, therefore now looking to send data to spool.

Read only

Former Member
0 Likes
1,311

U can use function module K_BATCH_REQUEST.

Amitava

Read only

0 Likes
1,311

Could you please tell more about the FM or how do i use that?

Read only

0 Likes
1,311

using this function module u can submit your report in background.....

Amitava

Read only

manubhutani
Active Contributor
0 Likes
1,311

Hi

I am facing the same problem, after using write_list

it is being diaplyed in foreground, but in background, the o/p is not exactly the same

please help

Thanks and Regards

Manu

Read only

manubhutani
Active Contributor
0 Likes
1,311

Hi

I am facing the same problem, after using FM 'LIST_FROM_MEMORY'

i am using 'list_to_ascii', and doing loop on the internal table returned, it is being displayed correctly in foreground

but not in background. Please suggest.

Thanks and Regards

Manu

Read only

Former Member
0 Likes
1,311

Hi Manu,

What I understand is:

1. You have created a Z program.

2. In that Z program, you are using SUBMIT for a standard program and collecting LIST_FROM_MEMORY.

and using other FM's.

You requirement is

a) To schedule the Z program in background

b) The spool of this Z Program should contain SAME output AS THAT OF of the SUBMIT ed program.

3. In that case,

a) After you use LIST_FROM_MEMORY (in Z Program)

b) use WRITE_LIST directly

(No need to use LIST_TO_ASCI or Write statements for sy-batch).

4. I just tried and it works fine - Both in foreground and background.

5. Just copy paste this program and run in FOREGROUND and BACKGROUND

In SM37 (for background), the spool will be SAME as FOREGROUND.




report abc.

*-----------------------------------------------------------
data:lt_listobject type table of abaplist.

*-----------------------------------------------------------
submit RM07MLBS
          with matnr = '3' "<----- Change
          with werks = '1000' "<------ Change
          exporting list to memory and return.

*-----------------------------------------------------------
  call function 'LIST_FROM_MEMORY'
    tables
      listobject = lt_listobject
    exceptions
      not_found  = 1
      others     = 2.

  CALL FUNCTION 'WRITE_LIST'
    TABLES
      listobject = lt_listobject
    EXCEPTIONS
      empty_list = 1
      OTHERS     = 2.
  call function 'LIST_FREE_MEMORY'
    tables

      listobject = lt_listobject.


Regards,

Amit Mittal.

Read only

0 Likes
1,311

Hi Amit

Thanks for the reply. i am using the following code

submit RPUAUD00 with lo_blg eq lo_blg

with sh_blg eq sh_blg

WITH arc_db eq arc_db

with user_sel eq user_sel

with r_tclasa eq r_tclasa

with r_tclasb eq r_tclasb

with r_tclas eq r_tclas

WITH persnr IN range_tab

with infty in infty

with datum in datum

with uname in uname

with def_curr eq def_curr

with expand eq expand

with exp_page eq exp_page

with prnt_sel eq prnt_sel

with out_alv eq out_alv

with ra_time eq ra_time

with ra_pernr eq ra_pernr

with ra_infty eq ra_infty

with ra_uname eq ra_uname

with sy-UCOMM eq ''

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.

ENDIF.

The o/p which is in alv list format is correctly displayed in foreground, but not in background

please help

Thanks and Regards

Manu

Read only

0 Likes
1,311

Hi Manu,

That is because the program RPUAUD00 behaves different in foreground and in background.

In foreground:

It shows header records in alv. Then when we double-click,

It shows detail records, in slightly different format as compared to header.

In background.

It Directly shows all detail records.

If in foreground, on selection screen, if you choose the checkbox "Direct output of Docs", then foreground and background will automatically match.

Hence, the problem is not with abap program - WRITE_LIST.

This works fine with other programs submitted.

Regards,

Amit Mittal.