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 display problem

Former Member
0 Likes
1,558

Hy!

I have an database table with users. I do some operations with them:

-add, delete, modify user

After those operations I display the content of the database table with an ALV grid.

The content is not modified according to my operations.

But I checked them by a display with lists and the operations work.

If I leave program and I execute the program again , the ALV display show me the correct content of my past operations.

What might be the problem?

Thank you .

13 REPLIES 13
Read only

Former Member
0 Likes
1,336

Hi,

the screen is not getting refreshed.so, use commit work for this.

Regards,

Sreevani

Read only

Former Member
0 Likes
1,336

Hi Ariana,

click on the refresh button in grid to get the updated results

Read only

Former Member
0 Likes
1,336

Hello,

Check wether the the table is updated. or use <b>COMMIT WORK AND WAIT</b>.

Try this also.

IN the usercommand of ALV

<b>RS_SELFIELD-REFRESH = 'X'.</b>

If useful reward.

Vasanth

Read only

rajasekhar_matukumalli3
Active Participant
0 Likes
1,336

Hi Ariyana,

Based on what u explained, I am assuming 2 problems for your program

1. For displaying the values in the ALV Grid, r u selecing the records from the database table before makign the changes (Add,Delete etc) or after making the changes.

2. If you are selecting records from database table to internal table after making the changes (Add,Delete etc), just try giving a explicit COMMIT WORK and see the result. Though COMMIT WORK is not required explicitly, just give a try.

Hope this solves ur problem.

Enjoy SAP

Rajasekhar

Read only

Former Member
0 Likes
1,336

I tried COMMIT WORK AND WAIT

FORM display_data.

CLEAR itab_adrress.

SELECT * INTO TABLE itab_adrress FROM zadrress.

COMMIT WORK AND WAIT.

CALL SCREEN 900.

ENDFORM. "display_data

MODULE status_0900 OUTPUT.

SET PF-STATUS 'STATUS_900'.

SET TITLEBAR 'TITLE_900'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container.

CREATE OBJECT grid1

EXPORTING i_parent = g_custom_container.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'zadrress'

CHANGING

it_outtab = itab_adrress.

.

ENDIF.

COMMIT WORK AND WAIT.

ENDMODULE. " STATUS_0900 OUTPUT

Not correctly tried ?

Thank you.

Read only

0 Likes
1,336

write this after set_table for first_display

call method grid1->refresh_table_display.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'zadrress'

CHANGING

it_outtab = itab_adrress.

<b>call method grid1->refresh_table_display.</b>

Read only

0 Likes
1,336

Hello,

This statement should inserted afetr U make the changes to TABLe or before select statment.<b>COMMIT WORK AND WAIT</b>

Vasanth

Read only

Former Member
0 Likes
1,336

Not working .

Read only

0 Likes
1,336

Hi,

I could not have saved the modifed values to database. If u saved, Acutually LUV will happen only when u come out of the program.

If u want LUV to be done imm. u should use commit work statemnet after saving the data to the databse.

And dont forgot retrieve data from the DB , when u r redisplying the data. ( I mean u need to display laltest data by fetching from DB)

send the code , still u cannot make it out

REgards

Nagaraju

Read only

0 Likes
1,336

Try calling COMMIT WORK AND WAIT after the DB operations.Have you checked that the internal table you are using to display data is refreshed with data changed in DB?

Maybe you are displaying data that refers to the non-modified table...

Read only

0 Likes
1,336

1. Update DBase

2. Commit Work

3. Select data from DBase again (perform the same data selection when you first populated the ALV)

4. CALL METHOD GRID1->refresh_table_display

Read only

Former Member
0 Likes
1,336

Hi Ariana

Your problem is that you are clearing the head of your table and you don't clear your table. Please Add this line to your code.

FORM display_data.

CLEAR itab_adrress.

<b>REFRESH itab_adrress.</b>

SELECT * INTO TABLE itab_adrress FROM zadrress.

COMMIT WORK AND WAIT.

CALL SCREEN 900.

ENDFORM. "display_data

Read only

Former Member
0 Likes
1,336

MODULE user_command_0900 INPUT.

save_ok = ok_code.

  • to react on oi_custom_events:

CALL METHOD cl_gui_cfw=>dispatch.

CASE save_ok.

WHEN 'BACK'.

CALL SCREEN 300.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'CANCEL'.

CALL SCREEN 300.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'SAVEM'.

INSERT wa_adrress INTO TABLE itab_adrress.

INSERT zadrress FROM TABLE itab_adrress ACCEPTING

DUPLICATE KEYS.

WHEN OTHERS.

LEAVE PROGRAM.

ENDCASE.

CLEAR ok_code.

ENDMODULE. " USER_COMMAND_0900 INPUT

MODULE status_0900 OUTPUT.

SET PF-STATUS 'STATUS_900'.

SET TITLEBAR 'TITLE_900'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container.

CREATE OBJECT grid1

EXPORTING i_parent = g_custom_container.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'zadrress'

CHANGING

it_outtab = itab_adrress.

COMMIT WORK AND WAIT.

CALL METHOD grid1->refresh_table_display.

ENDIF.

ENDMODULE. " STATUS_0900 OUTPUT

FORM display_data.

  • CLEAR itab_adrress.

REFRESH itab_adrress.

UPDATE zadrress.

SELECT * INTO TABLE itab_adrress FROM zadrress.

COMMIT WORK AND WAIT.

CALL SCREEN 900.

ENDFORM. "display_data

Here is the code and the problem is the same . I don't see what I did wrong .