‎2007 Mar 02 2:33 PM
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 .
‎2007 Mar 02 2:39 PM
Hi,
the screen is not getting refreshed.so, use commit work for this.
Regards,
Sreevani
‎2007 Mar 02 2:40 PM
Hi Ariana,
click on the refresh button in grid to get the updated results
‎2007 Mar 02 2:40 PM
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
‎2007 Mar 02 2:41 PM
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
‎2007 Mar 02 3:23 PM
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.
‎2007 Mar 02 3:27 PM
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>
‎2007 Mar 02 3:29 PM
Hello,
This statement should inserted afetr U make the changes to TABLe or before select statment.<b>COMMIT WORK AND WAIT</b>
Vasanth
‎2007 Mar 02 3:40 PM
‎2007 Mar 02 4:04 PM
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
‎2007 Mar 02 4:07 PM
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...
‎2007 Mar 02 4:25 PM
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
‎2007 Mar 02 6:09 PM
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
‎2007 Mar 05 11:17 AM
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 .