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

Spool for program.

Former Member
0 Likes
778

Hi all,

I have a called program A. This is run in background. I am creating spool for this.

I am calling another program B from the program A using the statement :

<b>submit B using selection-set 'VARIANT' and return.</b>

The called program B may also generate messages and errors, but how can i see these results in spool. Ideally i would like to get the spool number of this called program B and print that number on the spool for program A. Is this possible.

Please help me.. it is urgent....

Thanks

Pranati.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
749

Hi,

Yes, you can run the Program in the background also. This Program is A, and you need to submit B program ..

REPORT A.
*Example Code (Retrieving list from memory)
DATA  BEGIN OF itab_list OCCURS 0.
        INCLUDE STRUCTURE abaplist.
DATA  END OF itab_list.
 
DATA: BEGIN OF vlist OCCURS 0,
        filler1(01)   TYPE c,
        field1(06)    TYPE c,
        filler(08)    TYPE c,
        field2(10)    TYPE c,
        filler3(01)   TYPE c,
        field3(10)    TYPE c,
        filler4(01)   TYPE c,
        field4(3)     TYPE c,
        filler5(02)   TYPE c,
        field5(15)    TYPE c,
        filler6(02)   TYPE c,
        field6(30)    TYPE c,
        filler7(43)   TYPE c,
        field7(10)    TYPE c,
      END OF vlist.
 
SUBMIT B EXPORTING LIST TO MEMORY.
 
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = itab_list
  EXCEPTIONS
    not_found  = 4
    OTHERS     = 8.
 
CALL FUNCTION 'LIST_TO_ASCI'
  EXPORTING
    list_index         = -1
  TABLES
    listasci           = vlist
    listobject         = itab_list
  EXCEPTIONS
    empty_list         = 1
    list_index_invalid = 2
    OTHERS             = 3.
 
IF sy-subrc NE '0'.
  WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
ENDIF.

Regards

Sudheer

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
749

You might be able to use the system variable SY-SPONO.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
749

HEllo,

The system variable <b>SY-SPONO</b>

If useful reward.

Vasanth

Read only

Former Member
0 Likes
749

Hi,

I do not know whether you catch the Spool no in the A program, but you can catch the output of the B program in the A, look at the sample program here

*Example Code (Retrieving list from memory)
DATA  BEGIN OF itab_list OCCURS 0.
        INCLUDE STRUCTURE abaplist.
DATA  END OF itab_list.

DATA: BEGIN OF vlist OCCURS 0,
        filler1(01)   TYPE c,
        field1(06)    TYPE c,
        filler(08)    TYPE c,
        field2(10)    TYPE c,
        filler3(01)   TYPE c,
        field3(10)    TYPE c,
        filler4(01)   TYPE c,
        field4(3)     TYPE c,
        filler5(02)   TYPE c,
        field5(15)    TYPE c,
        filler6(02)   TYPE c,
        field6(30)    TYPE c,
        filler7(43)   TYPE c,
        field7(10)    TYPE c,
      END OF vlist.

SUBMIT zreport EXPORTING LIST TO MEMORY.

CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = itab_list
  EXCEPTIONS
    not_found  = 4
    OTHERS     = 8.

CALL FUNCTION 'LIST_TO_ASCI'
  EXPORTING
    list_index         = -1
  TABLES
    listasci           = vlist
    listobject         = itab_list
  EXCEPTIONS
    empty_list         = 1
    list_index_invalid = 2
    OTHERS             = 3.

IF sy-subrc NE '0'.
  WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
ENDIF.

Regards

Sudheer

Read only

0 Likes
749

Hi Sudheer,

Is this possible even if we run Program A in background..?Also do i write the code you said in Program A or B?

Thanks

Pranati

Read only

Former Member
0 Likes
749

Hi pranati,

use i A

DATA: SPOOL_NR like SY-SPONO.

  • Spoolnumber of the Spool wich you created.

SPOOL_NR = SY-SPONO.

EXPORT SPOOL_NR TO MEMORY ID 'SPOOL_NR'.

use in B

DATA: SPOOL_NR like SY-SPONO.

IMPORT SPOOL_NR TO MEMORY ID 'SPOOL_NR'.

Hope it helps,

regards, Dieter

Read only

Former Member
0 Likes
750

Hi,

Yes, you can run the Program in the background also. This Program is A, and you need to submit B program ..

REPORT A.
*Example Code (Retrieving list from memory)
DATA  BEGIN OF itab_list OCCURS 0.
        INCLUDE STRUCTURE abaplist.
DATA  END OF itab_list.
 
DATA: BEGIN OF vlist OCCURS 0,
        filler1(01)   TYPE c,
        field1(06)    TYPE c,
        filler(08)    TYPE c,
        field2(10)    TYPE c,
        filler3(01)   TYPE c,
        field3(10)    TYPE c,
        filler4(01)   TYPE c,
        field4(3)     TYPE c,
        filler5(02)   TYPE c,
        field5(15)    TYPE c,
        filler6(02)   TYPE c,
        field6(30)    TYPE c,
        filler7(43)   TYPE c,
        field7(10)    TYPE c,
      END OF vlist.
 
SUBMIT B EXPORTING LIST TO MEMORY.
 
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = itab_list
  EXCEPTIONS
    not_found  = 4
    OTHERS     = 8.
 
CALL FUNCTION 'LIST_TO_ASCI'
  EXPORTING
    list_index         = -1
  TABLES
    listasci           = vlist
    listobject         = itab_list
  EXCEPTIONS
    empty_list         = 1
    list_index_invalid = 2
    OTHERS             = 3.
 
IF sy-subrc NE '0'.
  WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
ENDIF.

Regards

Sudheer

Read only

0 Likes
749

Hi Sudheer,

Thank You very much. It is just perfect !!

Thanks

Pranati.