Application Development and Automation 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: 
Read only

ALV Grid Displaying Problem

Former Member
0 Likes
3,256

I am using a simple Itab to load into my ALV display. The container is showing its screenname I've given it. But the ALV grid will not display. The Screens are activated and I'm using the proper structure with my Itab. Any Ideas??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,978

Hi,

Can you post the code?

I guess there is some problem in the initialisation of custom container.

Regards,

Tanveer

<b>Please marh helpful answers</b>

35 REPLIES 35
Read only

Former Member
0 Likes
2,979

Hi,

Can you post the code?

I guess there is some problem in the initialisation of custom container.

Regards,

Tanveer

<b>Please marh helpful answers</b>

Read only

0 Likes
2,978

The component names in my structure are in all capitals.

Read only

0 Likes
2,978

*&----


*

*& Report ZTESTINCENTIVES

*&

*&----


*

*&

*&

*&----


*

REPORT ztestincentives.

DATA: incent_itab TYPE STANDARD TABLE OF ztestincstructure,

wa_incent LIKE LINE OF incent_itab.

Data: hold_data LIKE /bic/azinccred00.

DATA: ok_code LIKE sy-ucomm,

save_ok LIKE sy-ucomm,

g_container TYPE scrfname VALUE 'Incentives ALV',

g_grid TYPE REF TO cl_gui_alv_grid,

gs_layout TYPE lvc_s_layo,

g_custom_container TYPE REF TO cl_gui_custom_container.

CALL SCREEN 100.

*&----


*

*& Module PBO OUTPUT

*&----


*

  • text

*----


*

MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

SET TITLEBAR 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = 'g_container'.

CREATE OBJECT g_grid

EXPORTING

i_parent = g_custom_container.

*§1.Set status of all cells to editable using the layout structure.

gs_layout-edit = 'X'.

*Get data from table and place into structure.

SELECT * FROM /bic/azinccred00 INTO hold_data

WHERE bill_item = '000001'.

MOVE-CORRESPONDING hold_data TO wa_incent.

APPEND wa_incent TO incent_itab.

ENDSELECT.

CALL METHOD g_grid->set_table_for_first_display

EXPORTING

i_structure_name = 'ztestincstructure'

is_layout = gs_layout

CHANGING

it_outtab = incent_itab.

*§2.Use SET_READY_FOR_INPUT to allow editing initially.

  • (state "editable and ready for input").

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

ENDIF.

ENDMODULE. " PBO OUTPUT

*&----


*

*& Module PAI INPUT

*&----


*

  • text

*----


*

MODULE pai INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'SWITCH'.

PERFORM switch_edit_mode.

WHEN OTHERS.

  • do nothing

ENDCASE.

ENDMODULE. " PAI INPUT

*&----


*

*& Form exit_program

*&----


*

FORM exit_program .

LEAVE PROGRAM.

ENDFORM. " exit_program

*&----


*

*& Form switch_edit_mode

*&----


*

FORM switch_edit_mode .

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.

IF g_grid->is_ready_for_input( ) EQ 0.

*§4.Use SET_READY_FOR_INPUT to switch between the substates.

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

ELSE.

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 0.

ENDIF.

ENDFORM. " switch_edit_mode

Read only

0 Likes
2,978

*&----


*

*& Report ZTESTINCENTIVES

*&

*&----


*

*&

*&

*&----


*

REPORT ztestincentives.

DATA: incent_itab TYPE STANDARD TABLE OF ztestincstructure,

wa_incent LIKE LINE OF incent_itab.

Data: hold_data LIKE /bic/azinccred00.

DATA: ok_code LIKE sy-ucomm,

save_ok LIKE sy-ucomm,

g_container TYPE scrfname VALUE 'Incentives ALV',

g_grid TYPE REF TO cl_gui_alv_grid,

gs_layout TYPE lvc_s_layo,

g_custom_container TYPE REF TO cl_gui_custom_container.

CALL SCREEN 100.

*&----


*

*& Module PBO OUTPUT

*&----


*

  • text

*----


*

MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

SET TITLEBAR 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = 'g_container'.

CREATE OBJECT g_grid

EXPORTING

i_parent = g_custom_container.

*§1.Set status of all cells to editable using the layout structure.

gs_layout-edit = 'X'.

*Get data from table and place into structure.

SELECT * FROM /bic/azinccred00 INTO hold_data

WHERE bill_item = '000001'.

MOVE-CORRESPONDING hold_data TO wa_incent.

APPEND wa_incent TO incent_itab.

ENDSELECT.

CALL METHOD g_grid->set_table_for_first_display

EXPORTING

i_structure_name = 'ztestincstructure'

is_layout = gs_layout

CHANGING

it_outtab = incent_itab.

*§2.Use SET_READY_FOR_INPUT to allow editing initially.

  • (state "editable and ready for input").

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

ENDIF.

ENDMODULE. " PBO OUTPUT

*&----


*

*& Module PAI INPUT

*&----


*

  • text

*----


*

MODULE pai INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'SWITCH'.

PERFORM switch_edit_mode.

WHEN OTHERS.

  • do nothing

ENDCASE.

ENDMODULE. " PAI INPUT

*&----


*

*& Form exit_program

*&----


*

FORM exit_program .

LEAVE PROGRAM.

ENDFORM. " exit_program

*&----


*

*& Form switch_edit_mode

*&----


*

FORM switch_edit_mode .

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.

IF g_grid->is_ready_for_input( ) EQ 0.

*§4.Use SET_READY_FOR_INPUT to switch between the substates.

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

ELSE.

CALL METHOD g_grid->set_ready_for_input

EXPORTING

i_ready_for_input = 0.

ENDIF.

ENDFORM. " switch_edit_mode

Read only

0 Likes
2,978

hi ,

Instead of

CREATE OBJECT g_custom_container

EXPORTING container_name = 'g_container'.

use

CREATE OBJECT g_custom_container

EXPORTING container_name = <b>'G_CONTAINER'</b>.

Regards,

Vara

Read only

0 Likes
2,978

Hi,

I tried the uppercase container_name, did not work, any other ideas would be greatly appreciated!

Thanks.

Ryan

Read only

0 Likes
2,978

Ryan,

Please re-clarify your expected output. Are you expecting titles in the ALV grid?

Read only

0 Likes
2,978

My actual ALV Grid(rows/columns) is not displaying, I see only the container name at the top of the screen. I have my GUI Status and GUI Title are named MAIN100, My screen is 0100. Everything is activated. Any thoughts? Thanks

Read only

0 Likes
2,978

In the actual screen itself (in Screen Painter), is the Custom Container named 'G_CONTAINER' ? It needs to be (with your code example).

Read only

0 Likes
2,978

Also - G_CONTAINER must be in CAPS in your CREATE OBJECT statement.

Read only

0 Likes
2,978

Not sure if this makes a difference or not, but try adding brackets to the itab name also.




CALL METHOD g_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ztestincstructure'
is_layout = gs_layout
CHANGING
it_outtab = <b>incent_itab[].</b>

Regards,

Rich Heilman

Read only

0 Likes
2,978

Are you seeing column headings?

Regards,

Rich Heilman

Read only

0 Likes
2,978

The brackets did not help, no column headings either, just seeing a blank screen with the title (Incentives Display)

Read only

0 Likes
2,978

How about making the structure name upper case. Do you see the ALV buttons in the screen?

CALL METHOD g_grid->set_table_for_first_display
EXPORTING
<b>i_structure_name = 'ztestincstructure'</b>
is_layout = gs_layout
CHANGING
it_outtab = incent_itab[].

Regard,

Rich Heilman

Read only

0 Likes
2,978

Ryan,

Also - make sure that your STRUCTURE name is in CAPS in the set_table statement.

Also - remove the data declaration of g_container.

Is your custom container called "G_CONTAINER" as menetioned above?

Read only

0 Likes
2,978

HI,

Your program should work, if you do the following changes,..

First of all remember that whenever you choose the specify the screen field name in the program, it should always be in CAPITAL Letters.

1st Change

So, Instead of

g_container TYPE scrfname VALUE 'Incentives ALV',

use

g_container TYPE scrfname VALUE <b>'INCENTIVES ALV'</b>,

(avoid using spaces in the name)

2nd change

instread of

CREATE OBJECT g_custom_container

EXPORTING container_name = 'g_container'.

use

CREATE OBJECT g_custom_container

EXPORTING container_name = <b>g_container</b>.

Regards,

Vara

Read only

0 Likes
2,978

Rich,

Good thought !! That would cause an empty screen.

Read only

0 Likes
2,978

John, it definitly did in my case, i had to change this in my screen flow logic due to his module names. I assumed that it was ok in his screen logic though.

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,978

I got your program working just by capitalizing the container name. No other changes required. Plus, as mentioned, there is no need for the G_CONTAINER data statement.

CREATE OBJECT g_custom_container
          EXPORTING
                container_name = <b>'G_CONTAINER'</b>.

Regards,

Rich Heilman

Read only

0 Likes
2,978

When I capitalize the container name, I'm still getting no display.. Thanks for all of your help!

Read only

0 Likes
2,978

Ryan,

Is your custom container called "G_CONTAINER" as menetioned above?

This is ESSENTIAL to making the ALV Grid appear !!!

Read only

0 Likes
2,978

As john said, the container defined in the screen itself, but be name as G_CONTAINER, please check this.

Regards,

Rich Heilman

Read only

0 Likes
2,978

Go into Screen Painter (SE51) for screen 100, click on the Custom Container object. What name appears in the upper left of the screen as the Object name. It MUST be G_CONTAINER in your example.

Read only

Former Member
0 Likes
2,978

What have you called the grid space in your screen. If it is not G_CONTAINER, then you must call what you have stated in screen painter and have the same name as the name of the variable in your data declarartion.

Read only

0 Likes
2,978

Just another guess, make sure that your screen flow logic looks like this.



process before output.

  <b>module pbo.</b>

process after input.

  <b>module pai.</b>

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,978

Ryan,

To that point, set a breakpoint at one of the CREATE OBJECT statements. Are you stopping on those statements? Watch the ABAP error handler...

Read only

0 Likes
2,978

Thanks for everyones help, I will rewards points for sure! I will try these ideas! Thanks again.

Read only

0 Likes
2,978

I'm sure its the empty space being shown, but I'm not seeing the custom container button in se51..

Read only

0 Likes
2,978

In SE51, you must click on the "Custom Control" object in the left hand box. Drag it over to the screen space and place it on the screen. Give it the object name of G_CONTAINER.

Now compile and execute.

Read only

0 Likes
2,978

Works great, thanks everyone!

Read only

0 Likes
2,978

So what was the problem, you never created the control on the screen in screen painter?

Regards,

Rich Heilman

Read only

0 Likes
2,978

Yes, I did not create the control on the screen. That was all. Good learning experience though. Thanks again!

Read only

0 Likes
2,978

Ryan,

The actual G_CONTAINER screen object IS the container for the ALV Grid object.

The Custom Control (G_CONTAINER) must exist as a physical entity on the screen; and the ALV Grid object reference must be bound to the Custom Control using the CREATE OBJECT (as you are doing now).

Glad it works for you now.

Read only

0 Likes
2,978

.......Banging head against wall.........

.....this really hurts..........

Regards,

Rich Heilman

Read only

0 Likes
2,978