cancel
Showing results for 
Search instead for 
Did you mean: 

ALV GRID

Former Member
0 Kudos

HI ALL,

i using ALV grid to display my out, my sequence is as follows,

i have a <b>Button X</b> on tab page when i click on X i display a screen where i have some selection criteria when user enters a value and clicks on display button it shows the output in ALV .

I am able to show the output and when user make changes i am able to save it in my dbase.

Problem: when i click a back button on my screen it goes on to the tabpage but again i click <b>Button X</b> and go to the screen i get the old data displayed on the screen, which is not required.

How can i refresh avoid that?

Regards.<b></b>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Azee,

Use the CLEAR stmt to clear the internal table.

Clear:ITAB_HR_301[].

Place this stmt at the end of PAI.

This removes the content from tthe Internal Table. So

the Grid will contains no data.

Thanks

Kam

Message was edited by: Kam

Former Member
0 Kudos

Hi kam,

i used clear statement under the function code of back button but still it is not working

As here.

WHEN 'BACK'.

clear itab_hr_301[].

LEAVE TO SCREEN 0100.

Former Member
0 Kudos

Azee,

In the screen 100, initialize the FLAG.

why????

I think it executes the SET_TABLE_.... function again when u click the BUTTUN X. So CONTROL goes into the loop(Ring : ie from 100 to screen 200 then back to 100 and clicking again the element X in Screen 100 calls the PBO of Screen 200...)

In PBO of screen 100, set the Falg

(Eg code NOREPEAT = ' ')

After the SET_TABLe... stmt, make the flag to contain X.

(Eg Code NOREPEAT = 'X'.)

In the Screen 200 PBO, check if the NOREPEAT flag.

IF NOREPEAT = 'X'.

CLEAR itab_hr_301[].

else.

call method SET_TABLE........

ENDIF.

I feel this should avoid the problem.

Check out..

Thanks

Kam

Message was edited by: Kam

Former Member
0 Kudos

Hi kam,

Thanks for suggestion,i have solved my probelm by uing refresh_table_display by putting it in PBO of the screen 200 coz every time system executes PBO after executing PAI where i need to refreash the grid .

I would surely like to reward u for this guidence.

Regards.

Answers (2)

Answers (2)

Former Member
0 Kudos

You have to update your internal table either when the SAVE button is pressed or you need to always refresh and reselect data into your internal table at the begining of the tab page.

Can you post your user command logic so that a more accurate answer can be give?

Former Member
0 Kudos

Hi Srinivas,

Here i go with my logic

SH_HR is function code of my show button and after that i display my grid with output.

WHEN 'SH_HR'.

CREATE OBJECT go_cc_hr_301

EXPORTING

container_name = 'CC_HR'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

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 go_grid_hr_301

exporting

i_parent = go_cc_hr_301

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.

PERFORM FILL_HR.

ENDCASE.

ENDMODULE. " USER_COMMAND_0301 INPUT

&----


*& Form FILL_HR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form FILL_HR.

CLEAR ITAB_HR_301[].

SELECT * FROM ztable INTo TABLE ITAB_HR_301

WHERE PERNR EQ xx-PERNR.

<b>Here i fill my field catalog</b>

perform fill_fldcat_hr changing gt_fldcat_hr_301.

CREATE OBJECT OR_HR_301 .

SET HANDLER OR_HR_301->TB_301 FOR go_grid_hr_301.

SET HANDLER OR_HR_301->USR_CMD_301 FOR GO_GRID_HR_301.

CALL METHOD go_grid_hr_301->set_table_for_first_display

EXPORTING

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

I_DEFAULT = 'X'

  • IS_LAYOUT =

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

CHANGING

it_outtab = ITAB_HR_301[]

IT_FIELDCATALOG = GT_FLDCAT_HR_301

  • 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.

endform. " FILL_HR

<b></b>

Former Member
0 Kudos

Since you just made the changes to the database and reading them again, you will not get them without bypassing the buffer.

So add BYPASSING BUFFER statement to your SELECT statement. Also, add a COMMIT AND WAIT statement after your database updates.

Former Member
0 Kudos

Hi Srinivas,

i have'nt used bypass buffer,could u pass any example select quiries with it !

Former Member
0 Kudos

Azee,

Use the method <b>refresh_table_display</b> present in the clas <b>cl_gui_alv_grid</b> to refresh the data present in the internal table and the Screen.

Thanks

Kam

Note: Allot points for all helpful postings