Alv Grid - back button
Hi,
My programs output displays an ALV Grid. Am selecting multiple rows on the grid through multi select button and with the help of a button on tool bar i could delete the rows selected in ALV grid. But when i pressed on back button which is present in the Standard tool bar it is not going to selection screen. it is displaying the sceen which is before deletion of the records that is previous screen is displayed insted of selection screen.
I need to display selection screen when i press back button in the standard tool bar it should not show previous screen it has to show first screen that is selection screen.
Thnaks
<<removed_by_moderator>>
Edited by: Vijay Babu Dudla on Feb 23, 2009 9:38 AM
hi
try this,
when 'BACK'.
leave to screen scrnnum.
scrnnum - screen number of your selection screen. you can find your screen num by clicking system->status menu in your selection screen.
feel free to revert back if you still have doubts.
regards
mano
Similar Messages
-
Hi ,
How to remove the standard buttons on the WD4A alv grid like View (Std. View) , Print Version , Export , Filter , Settings.
Thanks,
KumarHow did u solved ?
-
Alv grid push button functionality
Hi all,
I have a push button as one of the fields in fieldcatalog.i am using class cl_gui_alv_grid .
I want that when that push button is clicked then some action should take place.
How can i get user action on clicking that Push button.
please reply soon with some sample code
regards,
kushagraHi,
Reference:http://www.erpgenie.com/sap/abap/controls/alvgrid.htm
Note that this example uses table ZSFLIGHT. The table is equivalent to the table SFLIGHT.
Steps:
Create an executable program (Report)
Create a screen (100) and place a custom container named ALV_CONTAINER on the screen
Create a Pushbutton. Give it the text Exit and the functioncode EXIT
REPORT sapmz_hf_alv_grid .
TABLES: zsflight.
G L O B A L I N T E R N A L T A B L E S
DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_sflight LIKE sflight.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
CHANGING it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid
Reward points if helpful.
Regards,
Ramya -
How can I call functionality of ALV Grid by event of button outside grid?
Hello,
How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
Best regards,
Josef Motlhi Motl,
these are steps to create a button in ALV and trigger an event from it..
1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'NEWALVSTATUS'.
endform.
You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
2.You have to do the following to process the new button click.
i_callback_user_command = 'USER_COMMAND'
form user_command using i_ucomm like sy-ucomm
is_selfield type slis_selfield.
case i_ucomm.
3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status. Then look for the standard pf status. Copy this to Z range and then add your new button.
reward points if helpful
regards
satesh -
Hi Experts,
I m looking for some abap sample programs to build a program with tabs.
In any tab you have a table (ALV GRID ) with buttons to move up/down the selected row.1.Table maintanence generateor is used to maintain the table .
If u want to allow others to create new entries u have to maintain the table.Which will have all the changes to the table.so that the users can get the newly activated table to go for further process..
2.
To edit the grid value u have to set the fieldcate.
WA_FIELDCAT-EDIT = ''X'.
3.
Table control s used for the changes then and there and user friendly
ALV is for Sort layoput changes and can download to wordformat etc... -
Hi experts,
I need to run one of my zprograms as a batch job (ie in background) and have it fax the report - which is an ALV grid - to a list of fax numbers. I can do this in foreground using standard ALV Grid function button 'Mail Recipient' so I debugged and found function module SO_DYNP_OBJECT_SEND but I don't think I can use this. I have set up email functionality using SO_NEW_DOCUMENT_ATT_SEND_API1 and I know I can use this for faxing a "written" report but can I use it for an ALV Grid?
Could anybody please steer me in the right direction of which function module to use and how to populate the parameters?
Thanks
BrigitteHi Buddy ! clue for you -
1 .Firstly run the report & take list in memory (Submit <reportname>) using selection-set <variant> exporting list to memory and return
2. Then Import the list from memory & store in table (FM: List_From_Memory)
3. FM: List_To_Txt (result in listtxt)
4. Compress data (FM:Table_Compress)
5. itab_output <= listtxt
6. itab_packing-objtp = TXT
itab_packing-file_ext = TXT
itab_packing-transf_bin = 'X'
"wihtout header
itab_packing-head_start = 1.
itab_packing-head_num = 0.
"Mail Contents
itab_packing-body_start = 1.
itab_packing-body_num = No. of lines in report
itab_packing-objdes = subject
itab_packing-objlen = lines * 255.
7. FM : SO_OBJECT_SEND
exporting
object_hd_change = E ABAP Reports <subject>
object_type = obj_typ
OUTBOX_FLAG = 'X'
originator = <sy-uname>
originator_type = U
importing
sent_to_all =
tables
objcont = <mail content>
receivers = itab_recievers
packing_list = itab_packing
att_cont = itab_output
Commit Work
OR one worth link you can also surf :
http://www.sap-img.com/abap/sending-mail-with-attachment-report-in-background.htm
Warm Regards,
N. Singh -
Problem with ALV Grid Display screen Back Button
Dear Friends ,
I have an ALV Grid Display,Here am facing a problem for my 'Back' button,i haven't defined any PF Status and is using the standard one.But after the Display when i press Back Button a blank Screen is appearing n then again i have to press back button to go to my Selection Screen.
Please Suggest if i have to take care of something else.
I want my Selection Screen when i press Back on my Display Screen.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Thanks and Regards,
AshwiniHi Vijay ,
No i dont have any write statement in my proggram.
Here it is
REPORT ZRMMPD01A NO STANDARD PAGE HEADING.
TABLES : EQUI,SER03,MKPF,OBJK.
TYPE-POOLS : SLIS.
DATA IT_EQUI LIKE EQUI OCCURS 0 WITH HEADER LINE.
DATA IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE..
DATA IT_SER03 LIKE SER03 OCCURS 0 WITH HEADER LINE.
DATA IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE .
DATA : BEGIN OF IT_DISPLAY OCCURS 0,
MATNR LIKE EQUI-MATNR,
SERNR LIKE EQUI-SERNR,
BWART LIKE SER03-BWART,
WERK LIKE SER03-WERK,
CHARGE LIKE SER03-CHARGE,
LAGERORT LIKE SER03-LAGERORT,
MBLNR LIKE SER03-MBLNR,
MJAHR LIKE SER03-MJAHR,
ZEILE LIKE SER03-ZEILE,
BUDAT LIKE MKPF-BUDAT,
BKTXT LIKE MKPF-BKTXT,
USNAM LIKE MKPF-USNAM,
XBLNR LIKE MKPF-XBLNR,
END OF IT_DISPLAY.
DATA : WA_DISPLAY LIKE IT_DISPLAY.
DATA IT_FINAL LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
DATA IT_TEMP LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA :I_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_EVENTS TYPE SLIS_T_EVENT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_MATNR FOR EQUI-MATNR MATCHCODE OBJECT MCD,"OBLIGATORY
S_SERNR FOR EQUI-SERNR, "MATCHCODE OBJECT MCD OBLIGATORY
S_MBLNR FOR SER03-MBLNR MATCHCODE OBJECT MCD,
S_BWART FOR SER03-BWART MATCHCODE OBJECT MCD,
S_WERK FOR SER03-WERK MATCHCODE OBJECT MCD,
S_LAGET FOR SER03-LAGERORT MATCHCODE OBJECT MCD,
S_BUDAT FOR MKPF-BUDAT MATCHCODE OBJECT MCD,
S_XBLNR FOR MKPF-XBLNR MATCHCODE OBJECT MCD.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X',
R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
START-OF-SELECTION.
*Fetch Data.
PERFORM GET_DATA.
*Fill Display Fields.
PERFORM FILL_TABLE.
*Segregate data according to radio button selection.
PERFORM SELECT_CONDITION.
*Fill The Feild catalog.
PERFORM FIELD_CATALOG.
*Display Output.
PERFORM OUTPUT_DISPLAY..
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA.
SELECT * FROM EQUI INTO TABLE IT_EQUI
WHERE MATNR IN S_MATNR
AND SERNR IN S_SERNR.
SELECT * FROM OBJK INTO TABLE IT_OBJK
FOR ALL ENTRIES IN IT_EQUI
WHERE EQUNR = IT_EQUI-EQUNR.
SELECT * FROM SER03 INTO TABLE IT_SER03
FOR ALL ENTRIES IN IT_OBJK
WHERE OBKNR = IT_OBJK-OBKNR
AND MBLNR IN S_MBLNR
AND BWART IN S_BWART
AND WERK IN S_WERK
AND LAGERORT IN S_LAGET.
SELECT * FROM MKPF INTO TABLE IT_MKPF
FOR ALL ENTRIES IN IT_SER03
WHERE MBLNR = IT_SER03-MBLNR
AND BUDAT IN S_BUDAT
AND XBLNR IN S_XBLNR.
ENDFORM. " GET_DATA
*& Form FILL_TABLE
text
--> p1 text
<-- p2 text
FORM FILL_TABLE.
LOOP AT IT_EQUI.
LOOP AT IT_OBJK.
IF IT_OBJK-EQUNR <> IT_EQUI-EQUNR.
SKIP.
ELSE.
READ TABLE IT_SER03 WITH KEY OBKNR = IT_OBJK-OBKNR.
IF SY-SUBRC = 0.
WA_DISPLAY-MATNR = IT_EQUI-MATNR.
WA_DISPLAY-SERNR = IT_EQUI-SERNR.
WA_DISPLAY-BWART = IT_SER03-BWART.
WA_DISPLAY-WERK = IT_SER03-WERK.
WA_DISPLAY-CHARGE = IT_SER03-CHARGE.
WA_DISPLAY-LAGERORT = IT_SER03-LAGERORT.
WA_DISPLAY-MBLNR = IT_SER03-MBLNR.
WA_DISPLAY-MJAHR = IT_SER03-MJAHR.
WA_DISPLAY-ZEILE = IT_SER03-ZEILE.
READ TABLE IT_MKPF WITH KEY MBLNR = IT_SER03-MBLNR.
IF SY-SUBRC = 0.
WA_DISPLAY-BUDAT = IT_MKPF-BUDAT.
WA_DISPLAY-BKTXT = IT_MKPF-BKTXT.
WA_DISPLAY-USNAM = IT_MKPF-USNAM.
WA_DISPLAY-XBLNR = IT_MKPF-XBLNR.
ENDIF.
ENDIF.
ENDIF.
IF NOT WA_DISPLAY IS INITIAL.
APPEND WA_DISPLAY TO IT_DISPLAY.
CLEAR WA_DISPLAY.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " FILL_TABLE
*& Form FIELD_CATALOG
text
--> p1 text
<-- p2 text
FORM FIELD_CATALOG.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MATNR'.
FIELDCAT-SELTEXT_M = 'Material Number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'SERNR'.
FIELDCAT-SELTEXT_M = 'Serial number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MBLNR'.
FIELDCAT-SELTEXT_L = 'Number of material document'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BWART'.
FIELDCAT-SELTEXT_M = 'Movement type'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'WERK'.
FIELDCAT-SELTEXT_M = 'Plant'.
FIELDCAT-OUTPUTLEN = 5.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'CHARGE'.
FIELDCAT-SELTEXT_M = 'Batch number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'LAGERORT'.
FIELDCAT-SELTEXT_M = 'Storage Location'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MJAHR'.
FIELDCAT-SELTEXT_M = 'Material doc. year'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'ZEILE'.
FIELDCAT-SELTEXT_L = 'Item in material document'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BUDAT'.
FIELDCAT-SELTEXT_L = 'Posting date in the document'.
FIELDCAT-OUTPUTLEN = 10.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BKTXT'.
FIELDCAT-SELTEXT_L = 'Document header text'.
FIELDCAT-OUTPUTLEN = 25.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'USNAM'.
FIELDCAT-SELTEXT_M = 'User name'.
FIELDCAT-OUTPUTLEN = 15.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'XBLNR'.
FIELDCAT-SELTEXT_L = 'Reference document number'.
FIELDCAT-OUTPUTLEN = 25.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
ENDFORM. " FIELD_CATALOG
*& Form DISPLAY_OUTPUT
text
--> p1 text
<-- p2 text
FORM OUTPUT_DISPLAY.
IF R1 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_DISPLAY
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH IT_DISPLAY.
CLEAR IT_DISPLAY.
ELSEIF R2 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH IT_DISPLAY.
CLEAR IT_DISPLAY.
ENDIF.
ENDFORM. " DISPLAY_OUTPUT
*& Form SELECT_CONDITION
text
--> p1 text
<-- p2 text
FORM SELECT_CONDITION.
IF R2 = 'X'.
CLEAR WA_DISPLAY.
SORT IT_DISPLAY BY MATNR SERNR MBLNR ZEILE.
DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
LOOP AT IT_DISPLAY WHERE ZEILE = '0002'.
READ TABLE IT_DISPLAY WITH KEY MATNR = IT_DISPLAY-MATNR
SERNR = IT_DISPLAY-SERNR ZEILE = '0001'.
IF SY-SUBRC = 0.
DELETE IT_DISPLAY.
ENDIF.
ENDLOOP.
SORT IT_DISPLAY BY MATNR SERNR BWART MBLNR.
DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
LOOP AT IT_DISPLAY.
IF WA_DISPLAY IS INITIAL.
WA_DISPLAY = IT_DISPLAY.
ENDIF.
LOOP AT IT_DISPLAY WHERE MATNR = WA_DISPLAY-MATNR
AND SERNR = WA_DISPLAY-SERNR.
IF IT_DISPLAY-BUDAT > WA_DISPLAY-BUDAT.
WA_DISPLAY = IT_DISPLAY.
ELSE.
DELETE IT_DISPLAY.
ENDIF.
ENDLOOP.
APPEND WA_DISPLAY TO IT_TEMP.
CLEAR WA_DISPLAY.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM IT_TEMP.
IF NOT IT_TEMP[] IS INITIAL.
IT_FINAL[] = IT_TEMP[].
ENDIF.
ENDIF.
ENDFORM. " SELECT_CONDITION
Regards,
Ashwini -
Back button issue in ALV Grid(Factory method)
Hi All,
I have displayed a report using factory method(CL_SALV_TABLE).In that i have added buttons in application bar too.So when clicking on refresh button ALV should display again with latest number of records,that is working fine but when clicking on back button it should go to selection screen instead of that it is going a step back and displaying previous list of grid and then back and then selection screen.
Can any one help me how to directly go to input selection screen instead of going step back...
Regards,
RamHI,
Use this syntax (CALL SELECTION-SCREEN 1000)...Try this one
regards,
balaji -
Back from ALV Grid with multiple refresh
I have a report that from a selection screen shows an editable ALV Grid, and after I save it, it will refresh the grid.
My problem is when I hit the BACK button it returns to the "previous grid" instead of the selection screen
I am using the following:
WHEN 'BACK_C'.
LEAVE to SCREEN '0'.
How can I force it to go back to the selection screen?
sidenote: I have tried using call
selection-screen '1000'
but it adds a new problem as in the selection screen hitting back will return to the grid and I can never exit the report.Neither solution works.
If it helps, I'm refreshing the grid with:
DATA : ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
CALL METHOD ref_grid->refresh_table_display( ).
It seems when I refresh the grid it generates a completely independent grid screen and there's no way to skip them all and return to the selection screen. -
Problem displaying drill down STANDARD ALV for a particular record after pressing back button
I have a simple interactive ALV grid report. NOT 'OO'. It display correctly on initial execution. AT the moment, 6 records. I want it to work such that if i click record '1', a drill-down version of that ALV with only that one record clicked is displayed. This currently occurs correctly. The problem arises when i click the back button and want to click on a new record, say in the 2nd row..this new 2nd row record is not displayed. The first one is displayed again. I tried clearing and fiddling around but then the last record is displayed. I have used the 'ID' field as a 'hotspot' getting picked up by sy-tabindex. Maybe it could be that i shouldn't loop and use a work area e.g in my select statement. i'm not so sure i've looked around, and tried a few things. I can't get it right yet. My code is below:
*& Report ZALV
REPORT ZALV.
TABLES: ZCONTACT.
TYPE-POOLS: slis. "slis contains all of the ALV data types.
TYPES: BEGIN OF ty_zcontact.
INCLUDE STRUCTURE zcontact.
TYPES: icon TYPE char4, "field holding traffic light value- adding a column to internal table to hold the traffic light
END OF ty_zcontact.
DATA: "fieldcatALOG TYPE slis_t_fieldcat_alv WITH HEADER LINE,
it_zcontact TYPE TABLE OF ty_zcontact,"declares an internal table of type ZCONTACT
wa_zcontact TYPE ty_zcontact,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid,
g_variant TYPE disvariant,
gx_variant TYPE disvariant,
g_save TYPE c VALUE 'X',
it_fieldcat TYPE slis_t_fieldcat_alv,"declares field catalog table of line type alv
wa_fieldcat TYPE slis_fieldcat_alv, "declares the work area of the field catalog
it_list_top_of_page TYPE slis_t_listheader.
DATA: it_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv.
DATA: V_FIELD(30) TYPE C,
V_VALUE(10) TYPE C.
"izontact TYPE TABLE OF zcontact.
"i_logo TYPE OT.
"ls_layout TYPE slis_layout_alv.
**Selection Screen details
*SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
*PARAMETERS: variant like disvariant-variant.
*SELECTION-SCREEN END OF BLOCK B1.
SELECT-OPTIONS:
age FOR wa_zcontact-age,
lastnme FOR wa_zcontact-lastname.
**Getting default variant
* AT SELECTION-SCREEN ON age.
* SELECT SINGLE age FROM zcontact INTO wa_zcontact-age WHERE age = age.
* IF sy-subrc NE 0.
* MESSAGE:'That age does not exist mate, Please enter another age' TYPE 'E'.
* ENDIF.
INITIALIZATION.
*gx_variant-report = sy-repid.
*CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
*EXPORTING
* I_SAVE = G_SAVE
* CHANGING
* CS_VARIANT = GX_VARIANT
* EXCEPTIONS
* NOT_FOUND = 2.
*IF SY-SUBRC = 0.
* VARIANT = GX_VARIANT-VARIANT.
* ENDIF.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_FIELDCATALOG.
PERFORM DISPLAY_ALV_REPORT.
PERFORM top_of_page.
"g_repid = sy-repid.
*Fetch data from the database
FORM DATA_RETRIEVAL.
SELECT * FROM zcontact INTO TABLE it_zcontact WHERE age IN age AND lastname IN lastnme.
"assigning traffic light colour to each row based on a condition
* IF wa_zcontact-age GE 65.
* wa_zcontact-icon = 1. "Red Traffic Light
* ELSEIF wa_zcontact-age BETWEEN 40 AND 64.
* wa_zcontact-icon = 2. "Yellow traffic light
* ELSE.
* wa_zcontact-icon = 3." Green traffic light
* ENDIF.
* MODIFY it_zcontact FROM wa_zcontact TRANSPORTING icon.
* CLEAR wa_zcontact.
ENDFORM.
FORM BUILD_FIELDCATALOG.
*Build field catalog
wa_fieldcat-fieldname = 'ID'.
"wa_fieldcat-seltext_m = 'The Contact ID'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LASTNAME'.
"wa_fieldcat-seltext_m = 'Contact Lastname'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'FIRSTNAME'.
"wa_fieldcat-seltext_m = 'Contact Firstname'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'DOB'.
"wa_fieldcat-seltext_m = 'Date Of Birth'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'TEL'.
"wa_fieldcat-seltext_m = 'Telephone Number'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ADDRESS'.
"wa_fieldcat-seltext_m = 'The Address'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'OCCUPATION'.
"wa_fieldcat-seltext_m = 'The Occupation'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'WEIGHT'.
"wa_fieldcat-seltext_m = 'WEIGHT'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AGE'.
"wa_fieldcat-seltext_m = 'AGE OF THE CONTACT'.
wa_fieldcat-do_sum = 'X'. "Display column total
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'SALARY'.
"wa_fieldcat-seltext_m = 'SALARY'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
gd_layout-lights_fieldname = 'ICON'.
ENDFORM.
FORM DISPLAY_ALV_REPORT.
gd_repid = sy-repid.
*Pass data and field catalog to ALV function module to display ALV list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ZCONTACT'
i_save = 'X'
is_variant = g_variant
is_layout = gd_layout
TABLES
t_outtab = it_zcontact
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.
FORM top_of_page.
*ALV Header declarations
DATA: it_listheader TYPE slis_t_listheader,
wa_listheader TYPE slis_listheader,
t_line like wa_listheader-info,
ld_lines TYPE I,
ld_linesc(10) TYPE C.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Contact Details'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = sy-repid.
wa_listheader-key = 'Program Name:'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = sy-uname.
wa_listheader-key = 'User Name:'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-key = 'Run Date :'.
CONCATENATE sy-datum+6(2)
sy-datum+4(2)
sy-datum(4)
INTO wa_listheader-info
SEPARATED BY '/'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-key = 'Time :'.
CONCATENATE sy-uzeit(2)
sy-uzeit+2(2)
sy-uzeit+4(2)
INTO wa_listheader-info
SEPARATED BY ':'.
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader
i_logo = 'KLOGO'.
ENDFORM. "top_of_page
*& Form sub_user_command
FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
P_SELTAB TYPE SLIS_SELFIELD.
CASE P_UCOMM.
WHEN '&IC1'.
CASE p_seltab-fieldname.
WHEN 'ID'.
READ TABLE it_zcontact INTO wa_zcontact INDEX p_seltab-tabindex.
PERFORM DATA_RETRIEVAL1.
PERFORM BUILD_FIELDCATALOG1.
PERFORM SECOND_GRID.
ENDCASE.
ENDCASE.
ENDFORM. "
FORM DATA_RETRIEVAL1.
SELECT * FROM zcontact INTO TABLE it_zcontact WHERE id EQ wa_zcontact-id.
ENDFORM.
FORM BUILD_FIELDCATALOG1.
*Build field catalog
CLEAR: wa_fieldcat, it_fieldcat.
wa_fieldcat-fieldname = 'ID'.
"wa_fieldcat-seltext_m = 'The Contact ID'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LASTNAME'.
"wa_fieldcat-seltext_m = 'Contact Lastname'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'FIRSTNAME'.
"wa_fieldcat-seltext_m = 'Contact Firstname'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM.
FORM SECOND_GRID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
i_structure_name = 'ZCONTACT'
i_callback_user_command = 'USER_COMMAND'
TABLES
T_OUTTAB = IT_ZCONTACT.
ENDFORM.Hi Ten Mariga,
I wonder why the second select Query is needed at all instead you can use
---> Not Needed
FORM DATA_RETRIEVAL1.
SELECT * FROM zcontact INTO TABLE it_zcontact WHERE id EQ wa_zcontact-id.
ENDFORM.
----> Instead you can do
READ TABLE it_zcontact INTO wa_zcontact INDEX p_seltab-tabindex.
Append wa_zcontact to Second_table.
And you can use the Second_table to display the second ALV. The second Select Query will affect the performance too.
Cheers,
Krishnakumar B. -
Hi ,
I want to display a ALV Grid layout output and on that I want to insert a button on the application bar .When I click on it I should call a screen and dispaly that out on that screen .
Prg :
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZL_NAV'
I_CALLBACK_PF_STATUS_SET = 'ZL_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
i_structure_name = 'ZLT_MARKET_VALUE'
is_layout = gs_layout
i_save = g_save
IT_FIELDCAT =
IT_EVENTS =
TABLES
t_outtab = i_market_value
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
Iam settingthe pf status as 'ZL_PF_STATUS' and writing the sub routine for the same.
form 'ZL_PF_STATUS'
set pf-status = 'NAVDISP' .
endform .
But iam getting a dump that there are one actual parameter and zero formal parameters .
Help in this regard
Bye
Santosh ..Hello!
Take this code:
Regards
Ilhan
TYPE-POOLS: col, icon.
DATA:
BEGIN OF wa_sflight.
INCLUDE TYPE sflight.
DATA: color(4),
light, "graphical indicator for booking status
it_field_colors TYPE lvc_t_scol, "for cell highlighting
changes_possible TYPE icon-id,
END OF wa_sflight,
it_sflight LIKE TABLE OF wa_sflight.
DATA:
ok_code LIKE sy-ucomm.
DATA:
alv TYPE REF TO cl_gui_alv_grid,
cont TYPE REF TO cl_gui_custom_container.
DATA: my_variant TYPE disvariant,
my_print TYPE lvc_s_prnt.
DATA:
wa_layout TYPE lvc_s_layo,
wa_field_color LIKE LINE OF wa_sflight-it_field_colors.
DATA:
it_field_cat TYPE lvc_t_fcat,
wa_field_cat LIKE LINE OF it_field_cat.
DATA:
bookings_total TYPE i,
bookings_total_c(10),
message_text(60).
DATA: row TYPE i.
DATA: it_row_no TYPE lvc_t_roid,
wa_row_no LIKE LINE OF it_row_no,
it_lines type i.
DATA: BEGIN OF wa_sel_flights,
mandt TYPE sy-mandt,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF wa_sel_flights,
it_sel_flights LIKE TABLE OF wa_sel_flights.
SELECT-OPTIONS: so_car FOR wa_sflight-carrid,
so_con FOR wa_sflight-connid.
SELECTION-SCREEN SKIP.
PARAMETERS: pa_lv TYPE disvariant-variant.
********************** CLASS **************************
CLASS: lcl_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_doubleclick
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING es_row_no,
print_top
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
print_tol
FOR EVENT print_top_of_list OF cl_gui_alv_grid,
on_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object,
on_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
on_context_menu_request
FOR EVENT context_menu_request OF cl_gui_alv_grid
IMPORTING e_object.
ENDCLASS. "lcl_handler DEFINITION
CLASS: lcl_handler IMPLEMENTATION.
METHOD on_doubleclick.
READ TABLE it_sflight INTO wa_sflight INDEX es_row_no-row_id.
IF sy-subrc NE 0.
MESSAGE i075(bc408).
EXIT.
ENDIF.
bookings_total = wa_sflight-seatsocc + wa_sflight-seatsocc_b +
wa_sflight-seatsocc_f.
bookings_total_c = bookings_total.
CONCATENATE 'Total number of bookings:'(m01)
bookings_total_c
INTO message_text.
MESSAGE message_text TYPE 'I'.
ENDMETHOD. "on_doubleclick
METHOD print_top.
DATA: pos TYPE i.
FORMAT COLOR COL_HEADING.
WRITE: / sy-datum.
pos = sy-linsz / 2 - 3. " length of pagno: 6 chars
WRITE AT pos sy-pagno.
pos = sy-linsz - 11. " length of username: 12 chars
WRITE: AT pos sy-uname.
ULINE.
ENDMETHOD. "print_top
METHOD print_tol.
DATA: wa_so_car LIKE LINE OF so_car,
wa_so_con LIKE LINE OF so_con.
CONSTANTS: end TYPE i VALUE 20.
FORMAT COLOR COL_HEADING.
WRITE: / 'Select options'(000), AT end space. "#EC *
SKIP.
WRITE: / 'Airlines'(001), AT end space. "#EC *
ULINE AT /(end).
FORMAT COLOR COL_NORMAL.
LOOP AT so_car INTO wa_so_car.
WRITE: / wa_so_car-sign,
wa_so_car-option,
wa_so_car-low,
wa_so_car-high.
ENDLOOP.
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: / 'Connections'(002), AT end space . "#EC *
ULINE AT /(end).
FORMAT COLOR COL_NORMAL.
LOOP AT so_con INTO wa_so_con.
WRITE: / wa_so_con-sign,
wa_so_con-option,
wa_so_con-low NO-ZERO,
wa_so_con-high NO-ZERO.
ENDLOOP.
SKIP.
ENDMETHOD. "print_tol
METHOD on_toolbar.
DATA l_wa_button TYPE stb_button.
l_wa_button-butn_type = 3.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
CLEAR l_wa_button.
l_wa_button-function = 'AENDERN'.
l_wa_button-icon = ICON_MC_CONTENTINDICATOR.
l_wa_button-quickinfo = 'FLÜGE ANZEIGEN'. "#EC *
l_wa_button-butn_type = 0.
l_wa_button-text = 'ÄNDERN FLÜGE'.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
* Create button "Display bookings"
CLEAR l_wa_button.
l_wa_button-function = 'ANZEGEN'.
l_wa_button-icon = ICON_FLIGHT.
l_wa_button-quickinfo =
'FLÜGE ANZEIGEN'. "#EC *
l_wa_button-butn_type = 0.
l_wa_button-text = 'ANZEIGEN FLÜGE'.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
ENDMETHOD. "on_toolbar
* Ereignisbehandlung *
METHOD on_user_command.
CASE e_ucomm.
WHEN 'AENDERN'.
message 'Was möchten Sie ändern ?' type 'I'.
WHEN 'ANZEGEN '.
message 'Was möchten Sie denn anzeigen ?' type 'I'.
ENDCASE.
ENDMETHOD. "on_user_command
METHOD on_context_menu_request.
DATA:
column_info TYPE lvc_s_col.
CALL METHOD alv->get_current_cell
IMPORTING
e_row = row
es_col_id = column_info.
CASE column_info-fieldname.
WHEN 'CARRID'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'CARRIER_INFO'
text = 'Carrier info'(me1). "#EC *
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
ENDCLASS. "lcl_handler IMPLEMENTATION
********************** ENDCLASS ***********************
*ABAP events
START-OF-SELECTION.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight
WHERE carrid IN so_car
AND connid IN so_con.
LOOP AT it_sflight INTO wa_sflight.
CLEAR: wa_sflight-it_field_colors.
* set indicator for flights of current month
* Fluege des laufenden Monats hervorheben
IF wa_sflight-fldate(6) = sy-datum(6).
CONCATENATE 'C' col_negative '01' INTO wa_sflight-color.
ENDIF.
* set icon for bookings status
* Ikone für Buchungsstatus belegen
IF wa_sflight-seatsocc = 0.
wa_sflight-light = 1.
ELSEIF wa_sflight-seatsocc < 50.
wa_sflight-light = 2.
ELSE.
wa_sflight-light = 3.
ENDIF.
* highlight specific aircraft
* besonderen Flugzeugtyp hervorheben
IF wa_sflight-planetype = '747-400'.
wa_field_color-fname = 'PLANETYPE'.
wa_field_color-color-col = col_positive.
wa_field_color-color-int = 1.
wa_field_color-color-inv = 0.
APPEND wa_field_color TO wa_sflight-it_field_colors.
ENDIF.
* set indicator for flights in the past
* Ikone setzen für Flüge in der Vergangenheit
IF wa_sflight-fldate < sy-datum.
wa_sflight-changes_possible = icon_space.
ELSE.
wa_sflight-changes_possible = icon_okay.
ENDIF.
MODIFY it_sflight
FROM wa_sflight
TRANSPORTING color light it_field_colors changes_possible.
ENDLOOP.
CALL SCREEN 100.
*PBO modules
MODULE status_0100 OUTPUT.
SET PF-STATUS 'DYN'.
SET TITLEBAR 'T1'.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE clear_ok_code OUTPUT.
CLEAR ok_code.
ENDMODULE. " clear_ok_code OUTPUT
MODULE create_and_transfer OUTPUT.
CHECK cont IS INITIAL.
CREATE OBJECT cont
EXPORTING
container_name = 'MY_CONTROL_AREA'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 AND sy-batch IS INITIAL.
MESSAGE a010(bc408).
ENDIF.
CREATE OBJECT alv
EXPORTING
i_parent = cont
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 AND sy-batch IS INITIAL.
MESSAGE a010(bc408).
ENDIF.
* register event handlers
SET HANDLER:
lcl_handler=>on_toolbar FOR alv,
lcl_handler=>on_user_command FOR alv,
lcl_handler=>on_doubleclick FOR alv,
lcl_handler=>print_top FOR alv,
lcl_handler=>print_tol FOR alv,
lcl_handler=>on_context_menu_request FOR alv.
my_variant-report = sy-cprog.
IF NOT pa_lv IS INITIAL.
my_variant-variant = pa_lv.
ENDIF.
my_print-prntlstinf = 'X'.
my_print-grpchgedit = 'X'.
*define layout
wa_layout-grid_title = 'Flights'(h01). "#EC *
wa_layout-no_hgridln = 'X'.
wa_layout-no_vgridln = 'X'.
*field that contains information on row color
wa_layout-info_fname = 'COLOR'.
*internal table that contains information on cell color
wa_layout-ctab_fname = 'IT_FIELD_COLORS'.
*field that contains information on exception (indicator)
wa_layout-excp_fname = 'LIGHT'.
*multiple row and column selection
wa_layout-sel_mode = 'A'.
*fill field catalog
wa_field_cat-fieldname = 'SEATSOCC'.
wa_field_cat-do_sum = 'X'.
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'PAYMENTSUM'.
wa_field_cat-no_out = 'X'.
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'LIGHT'.
wa_field_cat-coltext = 'Utilization'(h02). "#EC *
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'CHANGES_POSSIBLE'.
wa_field_cat-col_pos = 5.
wa_field_cat-coltext = 'Changes possible'(h03). "#EC *
wa_field_cat-tooltip = 'Are changes possible?'(t01). "#EC *
APPEND wa_field_cat TO it_field_cat.
CALL METHOD alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_variant = my_variant
i_save = 'A'
is_layout = wa_layout
is_print = my_print
CHANGING
it_outtab = it_sflight
it_fieldcatalog = it_field_cat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE a012(bc408).
ENDIF.
ENDMODULE. " create_and_transfer OUTPUT
*PAI modules
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
PERFORM free.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*Form routines
FORM free.
CALL METHOD: alv->free,
cont->free.
FREE: alv,
cont.
ENDFORM. " free -
Problem in Back Button in ALV report
Hi Team,
I have created a report which has a selection screen. Based on the input I am showing an ALV OO grid in my custom screen 0100. Now In the system toolbar on my 0100 screen I have enabled back, up and exit button. On click of which I am wrting 'LEAVE TO SCREEN 0. '
But it doesn't take me to the selection screen. Rather it throws me out of the transaction. Can anybody
suggest me a command so that when I click on back button it will take to the selection screen.
Thanks,
MainakHi,
Go through given program it is very usefull for you,
***Correct your program as follows...
PROGRAM rsolett1 MESSAGE-ID sy.
TYPE-POOLS: slis.
data: repid like sy-repid.
DATA: w_fieldcat TYPE slis_fieldcat_alv,
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: w_listheader TYPE slis_listheader,
t_listheader TYPE slis_t_listheader.
DATA: BEGIN OF t_output OCCURS 0,
slno TYPE char10,
name TYPE char10,
lino TYPE char10,
prof TYPE char10,
addr TYPE char10,
fanm TYPE char10,
plbu TYPE char10,
END OF t_output.
w_fieldcat-col_pos = 1.
w_fieldcat-fieldname = 'SLNO'.
w_fieldcat-seltext_m = 'SERIAL NUMBER'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 2.
w_fieldcat-fieldname = 'NAME'.
w_fieldcat-seltext_m = 'NAME'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 3.
w_fieldcat-fieldname = 'LINO'.
w_fieldcat-seltext_m = 'LICENCE NUMBER'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 4.
w_fieldcat-fieldname = 'PROF'.
w_fieldcat-seltext_m = 'PROFESSION'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 5.
w_fieldcat-fieldname = 'ADDR'.
w_fieldcat-seltext_m = 'ADDRESS'.
w_fieldcat-do_sum = 'X'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 6.
w_fieldcat-fieldname = 'FANM'.
w_fieldcat-seltext_m = 'FATHER NAME'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-col_pos = 7.
w_fieldcat-fieldname = 'PLBU'.
w_fieldcat-seltext_m = 'PLACE OF BUSSINESS'.
APPEND w_fieldcat TO t_fieldcat.
CLEAR w_fieldcat.
*PUPULATING TOP-OF-PAGE.
w_listheader-typ = 'H'.
w_listheader-info = 'FORMA'.
APPEND w_listheader TO t_listheader.
CLEAR w_listheader.
repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = ' '
i_callback_top_of_page = 'SUB_TOP_OF_PAGE'
it_fieldcat = t_fieldcat
i_default = 'X'
TABLES
t_outtab = t_output.
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZPFSTATUS'.
ENDFORM.
Edited by: Ganesh Modhave on Aug 12, 2008 1:06 PM
Thanks&Regards,
Naresh kumar -
I made my first attempt to use OO programing in ABAP and created an ALV Grid using CL_GUI_ALV_GRID. I have excluded toolbar buttons without a problem, but now I would like to add a button and code my own reaction to its ok_code. Can anyone tell me how to do this? Please keep in mind I am very new to ABAP Objects.
Hi Jason,
Have you had a look at the example program BCALV_GRID_05 ?
The program demonstrates exactly what you are intending to do.
Please get back with any specific doubts you may encounter.
Regards,
Anand MAndalika. -
Problem with back button in alv o/p
Hi guys,
I am using Grid display to display a data. but when i am clicking on back button on o/p the o/p is displaying duplicate records for the first o/p. i,e it is displaying multiple records, again clicking on back it displaying extended o/p with more duplicate data...Hi
Check did u refreshed the internal that u displayed.
And also check grid control is initial or not
Data: g_cust_container TYPE REF TO cl_gui_custom_container,
g_cust_grid TYPE REF TO cl_gui_alv_grid.
**Create Container ALV Grid
IF g_cust_grid IS INITIAL.
Create Control Container for Grid
CREATE OBJECT g_cust_container
EXPORTING
container_name = g_container.
IF sy-subrc <> 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = sy-repid
txt2 = sy-subrc
txt1 = text-m02. "The control could not be created.
ENDIF.
CREATE OBJECT g_cust_grid
EXPORTING
i_parent = g_cust_container.
ENDIF.
CALL METHOD g_cust_grid->refresh_table_display.
Regards,
Raghu. -
ALV problems, trying to click Back button, Filtering, download (Excel)
Hi
When I try to click Back button, Filtering or download (Excel) on ALV grid this dumps appear:
Runtime Error MOVE_TO_LIT_NOTALLOWED_NODATA
Error analysis
The program tried to assign a new value to the field "<L_BOX>" even though
it is protected against changes.
The following objects are protected:
- Character or numeric literals
- Constants (CONSTANTS)
- Parameters of the category IMPORTING REFERENCE for functions
and methods
- Untyped field symbols to which a field has not yet been assigned
using ASSIGN
- TABLES parameters if the corresponding actual parameter is protected
against changes
- USING reference parameters and CHANGING parameters for FORMs if
the actual parameter for this is protected against changes
- Field symbols if the field assigned using ASSIGN or ASSIGNING
is protected against changes
- External write accesses to READ-ONLY attributes
- Key components of lines in internal tables of the type HASHED or
SORTED TABLE
SORTED TABLE.
Line SourceCde
681 * set/unset <box> of all items
682 if l_ucomm eq '&SAL' or l_ucomm eq '&ALL'.
683 if l_ucomm eq '&SAL'.
684 loop at t_outtab.
685 l_tabix = l_tabix + 1.
->>> <l_box> = ' '.
687 modify t_outtab index l_tabix.
688 endloop.
689 endif.
690 if l_ucomm eq '&ALL'.
691 loop at t_outtab.
692 l_tabix = l_tabix + 1.
693 <l_box> = 'X'.
694 modify t_outtab index l_tabix.
695 endloop.
696 endif.
What I must check on my ALV settings:
ch_alv_layout-zebra = 'X'.
ch_alv_layout-box_fieldname = 'SELE'.
ch_alv_layout-box_tabname = v_nametab.
ch_alv_layout-reprep = 'X'.
ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
ch_alv_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = ch_alv_layout
it_fieldcat = ch_alv_fieldcat
it_sort = ch_alv_sortinfo
i_save = 'X'
it_events = ch_slis_event
TABLES
t_outtab = p_control
EXCEPTIONS
program_error = 1
OTHERS = 2.
Thanks in advance.ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
ch_alv_layout-colwidth_optimize = 'X'.
try commenting the above values.and also check the Fieldcatlog.
Check the issue similar issue was resolve by checking catalog and layout:
[ALV Issue solution|Re: Problem when export ALV.]
Regards,
Gurpreet
Maybe you are looking for
-
Cannot see home sharing via iTunes 10.6.3 on Windows 8
Good morning! I have the latest version of iTunes installed on two iMacs, as well as on a PC running Windows 8 Consumer Preview. I am able to turn on home sharing on all three systems. The two iMacs can see each other's music libraries and playlists,
-
Edited photos from iPhone to Mac appear original
When I transfer photos which I edited from my iphone (6) to mac (yosemite), iPhoto (version 9.6) does not see edited photos, only originals. How can I transfer edited photos? MacBook Pro (Retina, 13-inch, Late 2013)
-
Reports for changes in Sales Orders
is there any report where i can find the changes that were done in a sales order#. even changes in qty with exact figures
-
Error Code -3 when installing qt with iTunes 6.0
Any ideas? and uninstalling and reinstalling qt alone before intalling itunes causes an error too.
-
Can't edit Opacity Map in CC Particle World After Effects CS6
For some reason I can click the and adjust the Opacity Map in CC Particle World. Normally and I click i nthe box and adjust the curves, but nothings working right now. This has never happened so I dont know if this is a glitch or if I inderectly chan