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: 

alv with method set table for first display

Former Member
0 Kudos

I'm trying to make an alv report using OO programming. I've already made it using the function module 'reuse_alv_list_display' and it's working propperly so my database query it's exactly the same, but whe I veryfy the sintax, the next error message appears:'gt_output is not type compatible with formal parameter it_outtab'. I don't know what's going on, because I think I've declared my parameters properly, anyway this is my source code:

DATA: grid TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container.

TYPES: BEGIN OF st_output,

tplnr LIKE viaufkst-tplnr,

pltxt LIKE iflo-pltxt,

acpos LIKE pmco-acpos,

END OF st_output.

DATA:gt_output TYPE STANDARD TABLE OF st_output WITH HEADER LINE.

SELECT-OPTIONS:TPLNR FOR gt_output-tplnr.

START-OF-SELECTION.

CALL SCREEN 1000.

*&----


*

*& Module STATUS_1000 OUTPUT

*&----


*

  • text

*----


*

*creo q para hacerlo con objetos hay que definir 1º la vista, y despues

*hacer el select sobre ella, en lugar de hacer los joins en el select

*la vista que definamos se utiliza como tipo de tabla para gt_output.

MODULE STATUS_1000 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING

CONTAINER_NAME = 'CCCONTAINER'.

CREATE OBJECT grid

EXPORTING

I_PARENT = g_custom_container.

ENDIF.

SELECT VTPLNR IPLTXT P~ACPOS

INTO CORRESPONDING FIELDS OF TABLE gt_output

FROM VIAUFKST AS V

INNER JOIN IFLO AS I

ON VTPLNR = ITPLNR

INNER JOIN PMCO AS P

ON VOBJNR = POBJNR

WHERE V~TPLNR IN TPLNR.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'st_output'

CHANGING IT_OUTTAB = gt_output.

ENDMODULE. " STATUS_1000 OUTPUT

Thanks everybody, this is a really good way to learn about ABAP programming.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

U haven't to use internal table with header line, so or you define it without headerline

<b>DATA:gt_output TYPE STANDARD TABLE OF st_output.

  • WITH HEADER LINE. <----------------------------</b>

or you transfer only the data:

<b>*CALL METHOD grid->set_table_for_first_display

*EXPORTING I_STRUCTURE_NAME = 'st_output'

*CHANGING IT_OUTTAB = gt_output.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'ST_OUTPUT'

CHANGING IT_OUTTAB = GT_OUTPUT[].</b>

Max

8 REPLIES 8

Former Member
0 Kudos

Hi

U haven't to use internal table with header line, so or you define it without headerline

<b>DATA:gt_output TYPE STANDARD TABLE OF st_output.

  • WITH HEADER LINE. <----------------------------</b>

or you transfer only the data:

<b>*CALL METHOD grid->set_table_for_first_display

*EXPORTING I_STRUCTURE_NAME = 'st_output'

*CHANGING IT_OUTTAB = gt_output.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'ST_OUTPUT'

CHANGING IT_OUTTAB = GT_OUTPUT[].</b>

Max

Former Member
0 Kudos

In ALV OOPS.You cannot use a header line with internal table.So you have to declare your table like this :

data :

gt_output type standard table of st_output .

Former Member
0 Kudos

HI,

Look at the below example programs:-

BCALV_EDIT_01

BCALV_EDIT_02

BCALV_EDIT_03

BCALV_EDIT_04

BCALV_EDIT_05

BCALV_EDIT_06

BCALV_EDIT_07

BCALV_EDIT_08

Regards

Sudheer

Former Member
0 Kudos

Hello,

You have created the table gt_output[] with header line.

So while passing it it should be passed as gt_output[] and not as gt_output.

Correct this, it will work.

Regs,

Venkat Ramanan N

Former Member
0 Kudos

OK THANKS EVERYBODY!!!

Now would anybody mind to explain me what i'm doing when I write gt_output[]? what's the difference between gt_output and gt_output[]? I'm sorry but i've just started with ABAP.

Thanks!!

0 Kudos

hi,

gt_output[] - > content of an internal tabel

gt_output - > only the header.

rgds

anver

if hlped mark points

0 Kudos

gt_output[] is referring the whole table content. you will see it clearly at debugging mode.

0 Kudos

hi,

adding to the above.

for you knowledge, chk this ex.

chk this.

DATA: begin of int_table occurs 0,

field1 like table-field1,

field2 like table-field2,

end of int_table.

here an internal table with work area is created.

int_table[] - > content or body of int_table.

int_table - > work area.

rgds

anver

if hlped mark points