Skip to Content
author's profile photo Former Member
Former Member

Print alv report directly to spool from a badi method

Hallo !

I am trying to save a log in spool on converting process

I am doing on Idoc data in Method of Badi implementation

(badi : HRALE00OUTBOUND_IDOC).

The spool request is created but the list there contains

no data.

Here is the code I put in the badi method :

DATA: LS_PRINT TYPE SLIS_PRINT_ALV,

LV_REPID LIKE SY-REPID,

LS_LAYOUT TYPE SLIS_LAYOUT_ALV,

LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

LS_FIELDCAT LIKE LINE OF LT_FIELDCAT.

LV_REPID = SY-REPID.

  • SET LS_LAYOUT :

CLEAR LS_LAYOUT.

  • SET LS_PRINT :

CLEAR LS_PRINT.

LS_PRINT-PRINT = 'N'.

  • SET LT_FIELDCAT :

REFRESH LT_FIELDCAT.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MESSAGE'.

LS_FIELDCAT-SELTEXT_L = 'MES'.

APPEND LS_FIELDCAT TO LT_FIELDCAT.

  • CREATE LOG IN SPOOL :

SY-BATCH = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = LV_REPID

IS_LAYOUT = LS_LAYOUT

IT_FIELDCAT = LT_FIELDCAT[]

I_DEFAULT = 'X'

I_SAVE = 'X'

IS_PRINT = LS_PRINT

TABLES

T_OUTTAB = PT_LOG[]

EXCEPTIONS

PROGRAM_ERROR = 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.

I have to remark that when I call this code in

an ABAP-PI function the log is created successfully in spool.

But here I call it from a method of IDOC Badi exit -

and the list is empty ....

The two cases are in processes that run in batch ...

Maybe ALV function can't be called from a method ?

Maybe I should use Object-Oriented ALV ?

Or maybe I fill the ALV function parameters in a wrong way ?

I really appreciate your help ,

Thanks in advance -

Nitzan S.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 01, 2006 at 09:31 AM

    Hey,

    I am not sure if from the ALV list the SPOOL will be created properly. You said the spool is created but the spool is empty.

    A Work around could be create a classical report with WRITE statements and then SUBMIT that report exporting the list into memory or you can even read the spool then.

    Regards,

    Ravi

    Note :Please mark the helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.