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: 

Unable to get the output

Former Member
0 Kudos

hi ppl, iam new to ooabap. I have coded a small report on ALV.But output is not getting displayed.

REPORT y_oops_alv.

TABLES : mara.

DATA: ls_toolbar TYPE stb_button.

DATA : itab LIKE STANDARD TABLE OF mara.

DATA : con TYPE REF TO cl_gui_custom_container,

e_object TYPE REF TO cl_gui_alv_grid,

grid TYPE REF TO cl_gui_alv_grid.

SELECT * FROM mara INTO TABLE itab .

----


  • MODULE STATUS_8000 OUTPUT

----


*

----


MODULE status_8000 OUTPUT.

SET PF-STATUS 'ZDEV'.

  • SET TITLEBAR 'xxx'.

CREATE OBJECT con

EXPORTING

  • PARENT =

container_name = 'CONT'

  • STYLE =

  • LIFETIME = lifetime_default

  • REPID =

  • DYNNR =

  • NO_AUTODEF_PROGID_DYNNR =

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • CNTL_SYSTEM_ERROR = 2

  • CREATE_ERROR = 3

  • LIFETIME_ERROR = 4

  • LIFETIME_DYNPRO_DYNPRO_LINK = 5

  • others = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT grid

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = con

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

  • EXCEPTIONS

  • ERROR_CNTL_CREATE = 1

  • ERROR_CNTL_INIT = 2

  • ERROR_CNTL_LINK = 3

  • ERROR_DP_CREATE = 4

  • others = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT e_object

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = con

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

  • EXCEPTIONS

  • ERROR_CNTL_CREATE = 1

  • ERROR_CNTL_INIT = 2

  • ERROR_CNTL_LINK = 3

  • ERROR_DP_CREATE = 4

  • others = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL METHOD grid->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

i_structure_name = 'MARA'

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT =

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = itab

  • IT_FIELDCATALOG =

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMODULE. "STATUS_8000 OUTPUT

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

There is no need to have two object reference for the ALV (E_object) and (GRID).

You are first creating the object for the GRID and than using the same parent, you are creating the object E_OBJECT. This might clear the link between GRID and CON. Comment out the portion where you are creating object E_OBJECT.

For reference check: BCALV_GRID_DEMO

Regards,

Naimesh Patel

8 REPLIES 8

naimesh_patel
Active Contributor
0 Kudos

There is no need to have two object reference for the ALV (E_object) and (GRID).

You are first creating the object for the GRID and than using the same parent, you are creating the object E_OBJECT. This might clear the link between GRID and CON. Comment out the portion where you are creating object E_OBJECT.

For reference check: BCALV_GRID_DEMO

Regards,

Naimesh Patel

0 Kudos

hi thank you namesh...

Former Member
0 Kudos

First you need to create a container at se51 for holding data at runtime.

those you alredy created with name of CONT.

after that we need to create grid and in this grid we pass

the container name those we created in object point of view (con)

in this way we provide the link between our program to container.

and finally we call method grid->set_table_for_first_display

and pass the structure name 'MARA' and changing (it_outtab) = itab.

no need to create any thing apart from this.

plz do this i hope you get the output.

best regards:

Mahesh

0 Kudos

hi ppl,

Mahesh could you please elaborate on this.because iam new to this topic.Could you send me steps to create ALV in OOABAP.It would be a lot of helpful to me.Please send me steps instead of links.

0 Kudos

data:it_mara type table of mara,

cont1 type scrfname value 'CONTAINER1',

custom_container1 type ref to cl_gui_custom_container,

grid1 type ref to cl_gui_alv_grid,

set screen 100.

&----


*& Module PBO_100 OUTPUT

&----


module PBO_100 output.

set pf-status 'MAIN100'.

if custom_container1 is initial.

perform select_table_mara.

CREATE OBJECT custom_container1

EXPORTING

  • PARENT =

container_name = cont1

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

others = 6.

CREATE OBJECT grid1

EXPORTING

i_parent = custom_container1

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

others = 5.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'MARA'

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT =

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

  • IR_SALV_ADAPTER =

CHANGING

it_outtab = it_mara

  • IT_FIELDCATALOG =

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

.

endif.

endmodule. " PBO_100 OUTPUT

&----


*& Module PAI_100 INPUT

&----


  • text

----


module PAI_100 input.

case sy-ucomm.

when 'BACK'.

leave to screen 0.

when 'EXIT'.

leave to screen 0.

when 'CANCEL'.

leave to screen 0.

endcase.

clear sy-ucomm.

endmodule. " PAI_100 INPUT

&----


*& Form select_table_mara

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form select_table_mara .

select * from mara into table it_mara up to 20 rows.

endform. " select_table_mara

i hope this is useful for you.

Mahesh

0 Kudos

mahesh, Its showing dump yar.Please send me the documents and steps to create containers in alv using ooabap.Please kindly request you to send me atleast links.It would be a lot privilege to me.

0 Kudos

same code is working in my system correctly. might be you are not creating the container at se51.

just you double click on 100.

set screen 100

system open a module pool screen and click on LAYOUT.

just double click on second last button on left side (when u place the cursor the name is howing custum container) after that u see one image like envalope . just u double click on this image give the name container1 at attribute. and save check activate. came back and there u see MODULE STATUS_1001. and MODULE USER_COMMAND_1001. just uncomment this module and save check activate.

and finally came back to abap code and save check activate.

this should be work (bcoz in my system it is runs perfectly)

0 Kudos

hi mahesh...yes your are right.I have not created container.I created one,But even though its showig blank output dude...:(