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

Error: WA cannot be converted to the line type of Internal table

Hello I have been working on a simple ALV Grid Program.

But to my surprise,I have been getting an error
"WA_FCAT CANNOT BE CONVERTED TO THE LINE TYPE OF IT_FCAT"

Here is the Code:

*&---------------------------------------------------------------------*

*& Report ZALV_REPORT *

*& *

*&---------------------------------------------------------------------*

*& *

*& *

*&---------------------------------------------------------------------*

INCLUDE ZALV_REPORT_TOP . " global Data

* INCLUDE ZALV_REPORT_O01 . " PBO-Modules *

* INCLUDE ZALV_REPORT_I01 . " PAI-Modules *

INCLUDE ZALV_REPORT_F01 . " FORM-Routines *

INITIALIZATION.

AT SELECTION-SCREEN.

START-OF-SELECTION.

perform f_get_data.

END-OF-SELECTION.

if not it_vbak is initial.

perform f_fieldcat_alv.

endif.

*&---------------------------------------------------------------------*

*& Include ZALV_REPORT_TOP Report ZAL*

*& *

*&---------------------------------------------------------------------*

REPORT ZALV_REPORT.

type-pools: slis.

data: gs_vbak type vbak.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

SELECT-OPTIONS: S_VBELN FOR GS_VBAK-VBELN.

SELECTION-SCREEN END OF BLOCK B1.

TYPES: begin of ty_vbak,

VBELN type VBELN_VA,

ERDAT type ERDAT,

ERZET type ERZET,

ERNAM type ERNAM,

ANGDT type ANGDT_V,

BNDDT type BNDDT,

AUDAT type AUDAT,

VBTYP type VBTYP,

TRVOG type TRVOG,

AUART type AUART,

AUGRU type AUGRU,

end of ty_vbak.

DATA: it_vbak type table of ty_vbak,

wa_vbak type ty_vbak,

it_fcat type standard table of slis_t_fieldcat_alv,

wa_fcat type slis_fieldcat_alv.

*&---------------------------------------------------------------------*

*& Include ZALV_REPORT_F01 *

*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*& Form f_get_data

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM f_get_data .

refresh : it_vbak.

clear : it_vbak.

if not s_vbeln is initial.

SELECT VBELN

ERDAT

ERZET

ERNAM

ANGDT

BNDDT

AUDAT

VBTYP

TRVOG

AUART

AUGRU

FROM VBAK INTO TABLE IT_VBAK

WHERE VBELN IN S_VBELN.

ELSE.

SELECT VBELN

ERDAT

ERZET

ERNAM

ANGDT

BNDDT

AUDAT

VBTYP

TRVOG

AUART

AUGRU

FROM VBAK INTO TABLE IT_VBAK

UP TO 100 ROWS.

endif.

ENDFORM. " f_get_data

*&---------------------------------------------------------------------*

*& Form f_fieldcat_alv

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM f_fieldcat_alv .

refresh: it_fcat.

clear: wa_fcat.

wa_fcat-row_pos = '1'.

wa_fcat-col_pos = '1'.

wa_fcat-fieldname = 'VBELN'.

wa_fcat-tabname = 'it_fcat'.

wa_fcat-seltext_m = 'Sales Order'.

append wa_fcat to it_fcat.

clear : wa_fcat.

ENDFORM. " f_fieldcat_alv

I tried checking everything in data declaration but I did not find any fault..

I Do not know what is wrong with the code.

Please help.Thank you in advance.

sc1.png (16.9 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Jan 14, 2016 at 06:20 AM

    Hi Ashim,

    The error was in Fieldcat declaration. You should declared the internal table

    it_fcat type slis_t_fieldcat_alv,

    wa_fcat type slis_fieldcat_alv.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 14, 2016 at 06:20 AM

    Hi,

    it_fcat type standard table of slis_t_fieldcat_alv,


    It should be it_fcat type slis_t_fieldcat_alv


    Regards,

    Taiyeb

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 14, 2016 at 06:23 AM

    Hi Ashim,

    please declare correctly.

    i.e

    it_fcat type slis_t_fieldcat_alv,

    wa_fcat type slis_fieldcat_alv.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 14, 2016 at 07:33 AM

    So you declared it_fcat as a table of tables. Use either

    it_fcat type slis_t_fieldcat_alv,

    or

    it_fcat type standard table of slis_fieldcat_alv,

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2016 at 09:55 PM

    Thanks.It worked.

    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.