12-19-2011 4:19 AM
Hellow freinds,
I am also have same issue i make one GUI status , the process of screen as follow
Screen 100 -
> this User Slection screen, Here user start to make input and one Push button 'Display" when user click this Display the Programme Goes to Screen--101
Screen 101------> this is the result screen here ALV grid Display shows the result,
Now user click the Back Button (Standard Tool Bar) , then he see the first screen means screen 100 (Input screen)
Now user changes the value and again click Display for result ,so the problem is User can not see the correct result after pressing back , ALV shows the old result below is my code where i exporting the filed catalog.
PERFORM get_fieldcatalog.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = layout
is_variant = variant
i_save = 'U'
i_structure_name = 'I_ALV2'
CHANGING
it_outtab = i_alv2[]
it_fieldcatalog = fieldcat[].
Plz give me some suggestion how to solve this issue.
12-19-2011 4:32 AM
Hi Neha,
In screen 101 at PBO maintain MODULE STATUS_0001.
In that create a status starting with Z in SET PF-STATUS 'ZSTATUS'.
Double click on it Zstatus in Function Keys toolbar give any name on pressing back button Eg: BACK.
In PAI write the code as follows.
If sy-ucomm = 'BACK'.
leave to screen 0.
endif.
If you want to refresh the ALV container use this code.
DATA : CONT type ref to cl_gui_alv_grid.
IF NOT CONT IS INITIAL.
CALL METHOD CONT->FREE.
CLEAR: CONT.
ENDIF.
CREATE OBJECT CONT
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT GRID
EXPORTING
I_PARENT = CONT.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = IT_KNA1
IT_FIELDCATALOG = IT_FCAT.
Place the above code before calling the screen 101 from 100.
Hope this is useful.
Regards,
G.Aditya
Edited by: Aditya.G on Dec 19, 2011 10:03 AM
Edited by: Aditya.G on Dec 19, 2011 10:25 AM
12-19-2011 5:04 AM
Hii Adity,
Thanks for replay i did as per you told but result is same see below is my code plz help me through this code , Its really thanks for helping .
DATA : CONT type ref to cl_gui_alv_grid.
This All Process
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'WCNT'.
ENDMODULE.
MODULE status_0101 OUTPUT.
DATA: fd TYPE string.
DATA: variant TYPE disvariant.
DATA: repid TYPE sy-repid.
repid = sy-repid.
variant-report = sy-repid.
variant-username = sy-uname. layout-zebra = 'X'.
layout-edit_mode = 'X'. CHECK alv_container IS INITIAL.
CREATE OBJECT alv_container
EXPORTING repid = repid
dynnr = sy-dynnr
side = alv_container->dock_at_left
extension = 1500.
CREATE OBJECT alv_grid
EXPORTING
i_parent = alv_container.
* append 'PRIN' to current_scr-excl.
* ALV Specific. Data selection.
* Populate Field Catalog
PERFORM get_fieldcatalog.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = layout
is_variant = variant
* i_save = 'U'
i_structure_name = 'I_ALV2'
CHANGING
it_outtab = i_alv2[]
it_fieldcatalog = fieldcat[].
* PERFORM get_data.
* ztecerti-jobno = jobno.
* ztecerti-rating = pono.
ENDMODULE.
MODULE USER_COMMAND_0101 INPUT.
If sy-ucomm = 'BACK'.
IF CONT IS INITIAL.
CALL METHOD CONT->FREE.
CLEAR: CONT.
ENDIF.
call screen 100.
endif.
ENDMODULE.
MODULE USER_COMMAND_0100 INPUT.
CASE sy-ucomm.
WHEN 'DISPLAY'.
DATA wa TYPE ztecerti.
"Insert new row to transparant table.
wa-jobno = jobno.
wa-pono = pono .
* wa-ZTESTDEAQw = ZTESTDEAQw.
WHEN 'BACK'.
LEAVE.
ENDCASE.
if pono >= jobno.
MESSAGE s000(38) WITH 'Check Date Entries.!'.
Leave screen.
endif.
PERFORM get_data.
clear sy-ucomm.
ENDIF.
CALL SCREEN 101.
ENDMODULE.
12-19-2011 5:38 AM
CONTAINER_NAME does not exist if i create the CONT object
below is code
CREATE OBJECT alv_container
EXPORTING repid = repid
dynnr = sy-dynnr
side = alv_container->dock_at_left
extension = 1500.
IF NOT CONT IS INITIAL.
CALL METHOD CONT->FREE.
CLEAR: CONT.
ENDIF.
CREATE OBJECT CONT
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT alv_grid
EXPORTING
i_parent = alv_container.
* i_parent = CONT.
* append 'PRIN' to current_scr-excl.
* ALV Specific. Data selection.
* Populate Field Catalog
PERFORM get_fieldcatalog.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = layout
is_variant = variant
* i_save = 'U'
i_structure_name = 'I_ALV2'
CHANGING
it_outtab = i_alv2[]
it_fieldcatalog = fieldcat[].
12-19-2011 9:34 AM
Hi Neha,
Here am sending the code which I did and working properly place the same code in your editor.
In top include place the below code.
TYPES: BEGIN OF TY_KNA1,
KUNNR TYPE KNA1-KUNNR,
NAME1 TYPE KNA1-NAME1,
ORT01 TYPE KNA1-ORT01,
END OF TY_KNA1.
DATA : IT_KNA1 TYPE TABLE OF TY_KNA1." WITH HEADER LINE.
DATA : CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
GRID TYPE REF TO CL_GUI_ALV_GRID.
Create a screen 1000.
In layout editor create an input field and place submit button . Here submit button FTCODE is 'SUBMIT' and a custom container with name 'CONTAINER'.
By passing value and pressing submit button below code will trigger .
Place the code as it is with your customized table or standard table in place of tables which i used in the code.
MODULE FETCH.
MODULE FIELD.
MODULE READ.
MODULE FETCH OUTPUT.
IF SY-UCOMM = 'SUBMIT'.
SELECT * FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE IT_KNA1 WHERE KUNNR = KNA1-KUNNR.
ENDIF.
ENDMODULE.
MODULE FIELD OUTPUT.
CLEAR: WA_FCAT,IT_FCAT.
WA_FCAT-FIELDNAME = 'KUNNR'.
WA_FCAT-TABNAME = 'KNA1'.
WA_FCAT-COL_POS = '1'.
WA_FCAT-REPTEXT = 'CUSTOMER NUMBER'.
WA_FCAT-OUTPUTLEN = '16'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'NAME1'.
WA_FCAT-TABNAME = 'KNA1'.
WA_FCAT-COL_POS = '2'.
WA_FCAT-REPTEXT = 'CUSTOMER NAME'.
WA_FCAT-OUTPUTLEN = '36'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-FIELDNAME = 'ORT01'.
WA_FCAT-TABNAME = 'KNA1'.
WA_FCAT-COL_POS = '3'.
WA_FCAT-REPTEXT = 'CITY'.
WA_FCAT-OUTPUTLEN = '36'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
ENDMODULE. " FIELD OUTPUT
MODULE READ OUTPUT.
IF IT_KNA1 IS NOT INITIAL.
IF NOT CONT IS INITIAL.
CALL METHOD CONT->FREE.
CLEAR: CONT.
ENDIF.
CREATE OBJECT CONT
EXPORTING
CONTAINER_NAME = 'CONTAINER'.(Name of the container which is created in Layout)
CREATE OBJECT GRID
EXPORTING
I_PARENT = CONT.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = IT_KNA1
IT_FIELDCATALOG = IT_FCAT.
ENDIF.
ENDMODULE. " READ OUTPUT
Hope with the above code your problem will be resolved if not yet all working revert me back with your problem.
Regards,
G.Aditya
Edited by: Aditya.G on Dec 19, 2011 3:04 PM
12-19-2011 4:44 AM
Hello friend,
Free the container by using the method Cont_name->free.
After that create the new container as you are doing for the first time and then display the contents. Because what the problem is that the new container is having the values but the old container values are not refreshed so it still in the memory and over rides the new container values. Its because of this issue only.
Just check this also in back use this code
WHEN 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
which removes the screen entirely from the process so the screen will also be loaded again.
If still the problem exists revert to me.
Thanks,
Sri Hari
12-19-2011 5:57 AM
Hi Neha,
Try using this statement.
grid->refresh_table_display( ).
This may help you.
12-19-2011 6:11 AM
Hi Manjunatha
I tried it already but resualt is same plz see my above programme code ,Thanks for help.
12-19-2011 7:10 AM
Hi Neha,
Somethin is missing in refreshing data. Check example programs provided BCALV_EDIT_01, 02 ..
First check after editing the data in ALV whether it is updated in Internal table or not in debug mode.
Then when returnig back to the screen check data of internal table.
Then check your PBO Logic.
Try like this..
MODULE pbo OUTPUT.
IF g_container IS INITIAL.
CREATE OBJECT ..
...CREATE OBJECT g_grid
...
else.
call method g_grid->refresh_table_display.
endif.
12-20-2011 4:17 AM