Skip to Content
avatar image
Former Member

Error in ALV

Hi Experts,

I'm trying to display an internal table in ALV list display.

I'm using the Field catalog merge with internal table. But the field catalog is not built.please help me on this.

This is my code:

REPORT zvprin24.

TABLES: vbrk,

t5nk9.

TYPE-POOLS slis.

DATA fcat TYPE slis_t_fieldcat_alv.

DATA afield TYPE slis_fieldcat_alv.

DATA i_repid LIKE sy-repid.

TYPES: BEGIN OF ty_vbrk,

vbeln TYPE vbrk-vbeln,

END OF ty_vbrk.

DATA : BEGIN OF s_ret_par,

doc_no LIKE vbrk-vbeln,

msg_type LIKE t5nk9-type,

mess LIKE t5nk9-message,

END OF s_ret_par.

DATA: t_ret_par LIKE STANDARD TABLE OF s_ret_par WITH HEADER LINE.

DATA: t_vbrk TYPE STANDARD TABLE OF ty_vbrk WITH HEADER LINE.

DATA: t_return LIKE STANDARD TABLE OF bapireturn1 WITH HEADER LINE,

t_success TYPE STANDARD TABLE OF bapivbrksuccess WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

SELECT-OPTIONS: s_doc FOR vbrk-vbeln.

PARAMETERS:p_trun TYPE bapivbrktestrun-testrun,

p_comm TYPE bapi_ncomt,

p_bdat TYPE bf_datm1eb.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

i_repid = sy-repid.

SELECT vbeln FROM vbrk

INTO TABLE t_vbrk

WHERE vbeln IN s_doc.

IF sy-subrc EQ 0.

LOOP AT t_vbrk.

CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'

EXPORTING

billingdocument = t_vbrk-vbeln

testrun = p_trun

no_commit = p_comm

billingdate = p_bdat

TABLES

return = t_return

success = t_success.

IF t_success[] IS NOT INITIAL.

MOVE t_vbrk-vbeln TO t_ret_par-doc_no.

MOVE 'S' TO t_ret_par-msg_type.

MOVE text-000 TO t_ret_par-mess.

ELSE.

MOVE t_vbrk-vbeln TO t_ret_par-doc_no.

MOVE 'E' TO t_ret_par-msg_type.

MOVE text-001 TO t_ret_par-mess.

ENDIF.

APPEND t_ret_par.

ENDLOOP.

ENDIF.

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'T_RET_PAR'

I_INCLNAME = i_repid

CHANGING

ct_fieldcat = fcat

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

  • IF t_ret_par[] IS NOT INITIAL.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = i_repid

it_fieldcat = fcat

TABLES

t_outtab = t_ret_par

EXCEPTIONS

program_error = 1

OTHERS = 2.

  • ENDIF.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 07:09 AM

    Change the definition of internal table T_RET_PAR as below:

    DATA : BEGIN OF t_ret_par OCCURS 1, 
    doc_no LIKE vbrk-vbeln,
    msg_type LIKE t5nk9-type,
    mess LIKE t5nk9-message,
    END OF t_ret_par.

    Please mark points if the solution was useful.

    Regards,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      The problem is that the function module REUSE_FIELDCATALOG_MERGE expects the definition of the table along with the structure at the same location.

      <b>Please mark points.</b>

      Regards,

      Manoj

  • avatar image
    Former Member
    Aug 20, 2007 at 07:15 AM

    hi,

    Declare the final internal table like this.

    DATA : BEGIN OF t_ret_par OCCURS 0,

    doc_no LIKE vbrk-vbeln,

    msg_type LIKE t5nk9-type,

    mess LIKE t5nk9-message,

    END OF t_ret_par.

    Regards,

    Nagaraj

    Add comment
    10|10000 characters needed characters exceeded