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: 

Print alv report directly to spool from a badi method

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

0 Kudos

Hi !

Thank you for your answer.

Actually , My code is working ...

I had error in some other place.

Thanks ,

Nitzan S.

0 Kudos

can you please send the detailed information, how you created spool using ALV ?

Thnx