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: 

Write itab to spool

Former Member
0 Kudos

Hello,

I am working on a BADI that transfers master recipes from SAP r/3 to APO, In the BADI i actually delete some recipes that are not relevant. In production for troubleshooting of what actually got deleted, i would like to collect the lines i am going to delete in a internal table and write it to spool.

Can i use this

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING DESTINATION = 'LOCL'

COPIES = COUNT

LIST_NAME = 'TEST'

LIST_TEXT = 'Test NEW-PAGE PRINT ON'

IMMEDIATELY = 'X'

RELEASE = 'X'

NEW_LIST_ID = 'X'

EXPIRATION = DAYS

LINE_SIZE = 79

LINE_COUNT = 23

LAYOUT = 'X_PAPER'

SAP_COVER_PAGE = 'X'

RECEIVER = 'SAP*'

DEPARTMENT = 'System'

NO_DIALOG = ' '

IMPORTING OUT_PARAMETERS = PARAMS

VALID = VALID.

IF VALID <> SPACE.

NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.

WRITE / 'First line'.

ENDIF.

2 REPLIES 2

Former Member
0 Kudos

Have a look at this example program.


REPORT ztestaks1 MESSAGE-ID 00 NO STANDARD PAGE HEADING
                               LINE-SIZE 160.


DATA: BEGIN OF i_mara OCCURS 0,
        matnr LIKE mara-matnr.
DATA: END OF i_mara.

DATA: v_dest            LIKE tsp01-rqdest,
      v_handle          LIKE sy-tabix,
      v_spool_id        LIKE tsp01-rqident,
      v_rc              TYPE c,
      v_errmessage(100) TYPE c,
      v_text(70)        TYPE c.

START-OF-SELECTION.

  SELECT matnr FROM mara INTO TABLE i_mara.

  CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'
    EXPORTING
      dest                  = 'LOCL'
*     LAYOUT                =
*     NAME                  =
*     SUFFIX1               =
*     SUFFIX2               =
*     COPIES                =
*     PRIO                  =
*     IMMEDIATE_PRINT       =
*     AUTO_DELETE           =
*     TITLELINE             =
*     RECEIVER              =
*     DIVISION              =
*     AUTHORITY             =
*     POSNAME               =
*     ACTTIME               =
*     LIFETIME              = '8'
*     APPEND                =
*     COVERPAGE             =
*     CODEPAGE              =
*     DOCTYPE               =
    IMPORTING
      handle                = v_handle
      spoolid               = v_spool_id
      rc                    = v_rc
      errmessage            = v_errmessage.

  LOOP AT i_mara.
    v_text = i_mara-matnr.
    CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'
      EXPORTING
        handle                 = v_handle
        text                   = v_text
*       LENGTH                 =
*       CODEPAGE               =
*       TRUNCATE               =
      IMPORTING
        rc               = v_rc
        errmessage       = v_errmessage
      EXCEPTIONS
        handle_not_valid = 1
        OTHERS           = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  ENDLOOP.

  CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'
    EXPORTING
      handle           = v_handle
    IMPORTING
      rc               = v_rc
      errmessage       = v_errmessage
    EXCEPTIONS
      handle_not_valid = 1
      OTHERS           = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Former Member
0 Kudos

Can You please provide us with the BADI name through which you are actually sending the datas from SAP R/3 to APO as you mentioned?