Skip to Content
0
Former Member
Jun 01, 2006 at 09:18 AM

Print alv report directly to spool from a badi method

28 Views

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.