Problem in oops ALV top_of_page
Hi all,
Iam using oops ALV to display by using custom controls.
We need to display selection screen parameters on top of page.
Iam using the method top_of_page and creating the instance in PBO module of the screen as shown.
MODULE status_0600 OUTPUT.
SET PF-STATUS 'PF-001'.
SET TITLEBAR 'ZTITLEBAR_836'.
*Create object of the event class and setting handler for double click
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR cl_alv_grid.
*Create object of the event class and setting handler for top of page
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_top_of_page FOR cl_alv_grid.
*display top of the page
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->display_top_of_page FOR cl_alv_grid.
ENDMODULE. " STATUS_0600 OUTPUT
in method iam writing required details by 'REUSE_ALV_COMMENTARY_WRITE'
it is not showing any affect on the output screen.
Regards,
Anil.
A suggestion can make a difference.
Hi,
To print top of page in oo alv, you can use class cl_dd_document, when you use method TOP_OF_PAGE in class CL_GUI_ALV_GRID
Refer:
Top Of Page in OO ALV
Hope this helps you.
Regards,
Tarun
Similar Messages
-
Problem with OOPS ALv-field editable
hi experts,
I am displaying one report using OOPS ALV. Now i am inserting a line in the output, so some mandatory fields are automatically filled up in the new line, and i am trying to fill new values for the remaining empty fields, So initially they are non-editable in the fieldcatalog.if i click on the 'INSERT LINE' button then only the fields shud be input enabled, how to do this.
Thanks in advance,maybe sample report BCALV_EDIT_04 might help you there.
-
Problem in OOPs ALV using the BOX_FNAME property in LAYOUT
Hello Guys,
I am trying to use the property BOX_FNAME property in the LAYOUT of OOPs ALV, as a CHECKBOX for selecting the records and then processing the selected records.
Also i need to implement the functionality of SELECT/DESELECT ALL.
Below is the code i am using:-
DATA : w_layo TYPE lvc_s_layo. " Layout
w_layo-box_fname = 'MARKE'.
MARKE is a field used in internal table as CHAR01 field.
But know when i select record on display, the internal table field MARKE is not reflected back with the values.
Please suggest if i am missing something.
Thanks in advance.
Regards,
Tarun GambhirSolved by own, using method GET_SELECTED_ROWS of class CL_GUI_ALV_GRID.
Regards,
Tarun -
Problem in OOP ALV-ALV not displaying.
Hi Gurus,
Can we use OOP alv concept in normal executable program or we need to do it in module pool ?
I did an example alv program..but it is not exectuing .
Can anybody tell me the answer ?
Thanks.Hello,
To use OO ALV you need to create a container in module pool. But you can still call it from an executable program. Just create an executable program and use call screen 0100. Now double click on 0100 and create a screen which has a container on it then in the PBO module just caal the methods for the custom container and alv. Upon execution of the program, the alv will be displayed.
Regards,
Sachin -
Radio buttons disabling functionality in OOPS ALV
Hi,
I am facing this peculiar problem in OOPS ALV. the requirement was to have a field and 2 radio buttons in ALV as editable when user clicks on CHANGE mode. but initially the table should be in display mode.
I have used the icons in ALV to provide the radio button functioanlity and its working.. but cant find solution to these 2 issues:
1) how to make radio button display only ?
2) when appending a new row in the ALV, its just appending a row with 4 columns ( 2 of field and 2 of radio button), but it is not able to append icons by default.
KIndly provide help on this. let me know if u need to clarify anything..
Thankx in advance,
Rohan MalikHi Rohan,
Not sure whether I understood your question correctly. I cant visualise your output .
To add icons while appending a new row to the output
First of all you need to have a field icon ( of type icon_d ) in your output table.
While appending the row you have to explicitly right the icon name to that field
l_record-icon = '@#12' something like that which you get from the type pool icons -
In oops-alv how to get quantity.
Hi.. in oops-alv How to get gpqty(gpquantity) for each storage bin and Summerise all the gpqty for matnr,lgpla,werks combination. how to slove above problem in oop-alv. can any one provide solution. regards karthik
Moderator message : Requirement dumping not allowed, search for available information. Discussion locked.
Message was edited by: Vinod KumarAre you using FACTORY Method or SET_TABLE_FOR_FIRST_DISPLAY ..?
Check this http://help.sap.com/saphelp_nw04/helpdata/en/6a/e4eb40c4f8712ae10000000a155106/content.htm
hope this helps... -
OOP ALV report custom control performance problem
HI
how to write OOP ALV report without custom control.. Actually with custom control which taking long time... and time out happens for huge selection of data..
Regards
Roops.timeout is not an alv problem. If you try to display a "huge" amount of data, any display technology will fail. Even sap programs fail, their wise solution is to ask user to restrict data to be displayed. Or reduce database selection time, or display amount. Or propose the user to download data as a spool, or output to a file on server.
Otherwise, read some advices about how to handle timeout in [Note 25528 - Parameter rdisp/max_wprun_time|http://service.sap.com/sap/support/notes/25528].
About your question, if you still want to try, look at [example code with alv class cl_salv_table for simple display|http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm] -
hi,
i have two problems in displaying ALV grid output Using Oops.
1) How to modify the fieldcatalog after we getting a field catalog using general FM.
2) initialy it is displaying 13 fields but there are 63 fields .
eventhough we chage the layout to 63 fields it is displaying only 13 fields , these 13 fields may be different based on our selection but count of displayed fileds are same . how can display 63 fields at a time .Hi,
You can chnage using below code:
loop at gt_fieldcat.
if <gt_fieldcat-field_name> = 'FIELDNAME'.
endif.
modify gt_fieldcat.
clear gt_fieldcat.
endloop.
Make sure that all the field should not have no_out = 'X' and tech = 'X'.
Thanks,
Sriram Ponna. -
Problem with 'PRINT' button in OOPs ALV
Hi All,
I have developed a OOPs based ALV report. When ever we create an ALV we also have to create Menu bar I did that providing fuctionality for 'BACK' and 'CANCEL' buttons in main toolbar. But user wants funtionality for 'SAVE' and 'PRINT'.
How do I do this ? Is there any stadard code which I can paste in PAI and use it. Classic ALVs handle this by default and OOPs doesn't do this it handles only a table level. But in my report I have a header information also. If user uses the standard 'PRINT' button at table level, only table contents are printed not the header information.
Please let me know how to handle 'PRINT' & 'SAVE' button in OOPs ALV.
Thanks in advance.Hi Ravindar,
This programe BCALV_TEST_GRID_PRINT has used the normal class cl_gui_alv_grid where as I have used CL_GUI_ALV_TREE class.
Regards,
Deepthi. -
Problem in raising the event DATA_CHANGED in OOP ALV
Hi experts,
I am currently having trouble in raising the event 'data_changed' in my OOP ALV . The event is triggered everytime I make changes to my editable cells but when it comes to clicking on the save button, it only calls 'data_changed_finished' and bypasses 'data_changed'.
I need to call 'data_changed' before the data is saved to do some verification.
My code is shown below.
CALL METHOD gr_alvgrid->register_edit_event
EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified.
*--functions
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_variant = s_variant
i_save = 'A'
i_default = gc_true
is_layout = gs_layout
it_toolbar_excluding = gt_exclude
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
"raise message
ENDIF.
CREATE OBJECT gr_event.
SET HANDLER gr_event->handle_data_changed FOR gr_alvgrid.
SET HANDLER gr_event->handle_data_changed_finished FOR gr_alvgrid.
CALL METHOD gr_alvgrid->set_toolbar_interactive.
CALL METHOD gr_alvgrid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
In my PAI
CASE ok_code.
WHEN 'SAVE'.
*--->this calls the event 'data_changed_finished' and bypasses 'data_changed'.*
*Check if there's data changed.
CALL METHOD gr_alvgrid->check_changed_data
IMPORTING
e_valid = l_valid.
ENDCASE.
I checked the sap sample program BCALV_EDIT_04 and I don't see any difference except for register_edit_event but I don't think that I can leave this out in my code . Is there any points i'm missing here?
Thanks,
PatrickHi, Spin
do like below,
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
cc_alv TYPE REF TO cl_gui_custom_container.
IF cc_alv IS INITIAL. " USE This Condition
CREATE OBJECT cc_alv
EXPORTING
container_name = 'CC_ALV'.
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = cc_alv.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_variant = s_variant
i_save = 'A'
i_default = gc_true
is_layout = gs_layout
it_toolbar_excluding = gt_exclude
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc = 0.
"raise message
ENDIF.
ENDIF.
Please reply if any Issue,
Thanks and Regard,
Faisal -
Problem while displaying data in spool using oops alv
Hi,
I have created a oops alv, in which iam displaying 2 ALV's on 2 containers..
Iam able to display the data which i need when i execute the program in foreground , But when i execute the program in background iam not able to see the 2nd ALV in the spool....
The ALV displays one below the other.
How i can i correct it..?
VishwaHi,
The container created in ALV will work only in foreground as this is the framework the background cannnot initiate the container object and assign the ALV to the container.
Hence you cannot create the container object and assign the same to the ALV screen in background. Instead you need to use the factory method/ALV FM to display in background mode.
For background ALV processing, don't use OOPS! U can use this fm : REUSE_ALV_GRID_DISPLAY.
You can also refer below threads:
Re: ALV: Foreground Vs Background
Re: OO ALV in background job
Regards
Shiva -
Cell(Row) Selection not display in OOPS ALV
Hi all,
I am not able to get the cell(row) selection in the oops ALV when i called it second time.
I am displaying some information using oops alv in 100 screen. After user action on 100 screen i am calling 200 screen with different information which is also display in oops alv. When i displaying information in second time the cell(row) selection is not getting displayed.
For both ALV the fieldcatelog is different.
Initially i tried using same container but i face same problem, so i am trying to call second alv in new screen.
But problem remain same.
Can anyone help me to solve this problem ?
Regards
Nileshhi,
can u send ur report so dat i can look furhter to it.and help u out -
hi experts,
event double click.
when double click on vbeln it should go to va03 transaction . how would i do that in oops alv.hai,
you can go through code below .
*& Report Z_CLARIFY *
REPORT Z_CLARIFY .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
*The Below Definitions Must.....
DATA:
Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
END_OF_LIST FOR EVENT end_of_list "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
METHOD END_OF_LIST. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = 'SCR100_CUST'.
"this is for top of page
Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
Split the custom_container to two containers and move the reference
to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
"you can set the height of it
Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
Build fieldcat and set editable for date and reason code
edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
Optionally restrict generic functions to 'change only'.
(The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
text
-->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
Only allow to change data not to create new entries (exclude
generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
there are many such examples
goto->se38->type bcalv* and press f4, u can see many examples.
Reward points if helpful.
Thanks and regards
Swetha Singh. -
Perform setting OOP ALV for multiple reports using Field Symbols
Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc) for 2 different reports. this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
*&this report experimental how to print into ONE alv
*&with 2 diffrent structure internal table
REPORT zfiroopalv.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
PARAMETERS r_kpi RADIOBUTTON GROUP mode.
SELECTION-SCREEN END OF BLOCK mode.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-DATA: md_wbs TYPE c LENGTH 1.
METHODS: process,
write.
DATA: mdo_data TYPE REF TO data.
TYPES: BEGIN OF st_wbs,
rsnum TYPE zmeime002a-rsnum,
rspos TYPE zmeime002a-rspos,
a TYPE zmmgitab01-menge,
b TYPE zmeime002a-bdmng,
c TYPE zmeime002a-bdmng,
d TYPE zmeime002a-bdmng,
e TYPE zmeime002a-bdmng,
f TYPE zmmgitab01-menge,
g TYPE zmmgitab01-menge,
END OF st_wbs.
TYPES: BEGIN OF st_kpi,
regio TYPE zmeime002a-regio,
gsber TYPE zmeime002a-gsber,
gtext TYPE zmeime002a-gtext,
x TYPE zmmgitab01-menge,
y TYPE zmmgitab01-menge,
z TYPE zmmgitab01-menge,
END OF st_kpi.
CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
wa_wbs LIKE LINE OF it_wbs.
CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
wa_kpi LIKE LINE OF it_kpi.
PRIVATE SECTION.
DATA: set_display_setting TYPE REF TO cl_salv_table.
DATA: display_settings TYPE REF TO cl_salv_display_settings.
DATA: salv_table TYPE REF TO cl_salv_table.
DATA: error TYPE REF TO cx_root.
DATA: errtext TYPE string.
ENDCLASS.
CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_kpi.
PRIVATE SECTION.
ENDCLASS.
* C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_wbs.
PRIVATE SECTION.
ENDCLASS.
* m.a.i.n. .p.r.o.g.r.a.m.
START-OF-SELECTION.
DATA: o_main TYPE REF TO lcl_main.
DATA: p_wbs TYPE c.
CREATE OBJECT o_main.
CASE 'X'.
WHEN r_wbs.
o_main->md_wbs = 'X'.
WHEN r_kpi.
o_main->md_wbs = ' '.
ENDCASE.
o_main->process( ).
o_main->write( ).
CLASS lcl_main IMPLEMENTATION.
*ENDMETHOD.
METHOD process. " NOTE: public method
DATA: o_main TYPE REF TO lcl_main,
o_wbs TYPE REF TO lcl_wbs,
o_kpi TYPE REF TO lcl_kpi.
CREATE OBJECT: o_wbs,o_kpi.
IF ( me->md_wbs = 'X' ).
CALL METHOD o_wbs->process_wbs( ). " NOTE: private method
GET REFERENCE OF me->it_wbs INTO me->mdo_data.
ELSE.
CALL METHOD o_kpi->process_kpi( ). " NOTE: private method
GET REFERENCE OF me->it_kpi INTO me->mdo_data.
ENDIF.
ENDMETHOD.
METHOD write.
FIELD-SYMBOLS:
<lt_outtab> TYPE table.
ASSIGN me->mdo_data->* TO <lt_outtab>.
cl_salv_table=>factory(
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = salv_table
CHANGING
t_table = <lt_outtab>
salv_table->display( ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_kpi IMPLEMENTATION.
METHOD process_kpi.
*********** run some select statement into it_kpi*******
ENDMETHOD.
ENDCLASS.
CLASS lcl_wbs IMPLEMENTATION.
METHOD process_wbs.
*********** run some select statement into it_wbs*******
ENDMETHOD.
ENDCLASS.Hi,
I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
MODULE USER_COMMAND_9003 INPUT.
CASE OK_CODE.
WHEN 'DETAIL'.
GV_RPT = OK_CODE.
PERFORM F_GET_DETAIL_DATA.
WHEN 'REPORT'.
GV_RPT = OK_CODE.
PERFORM F_GET_REPT_DATA.
ENDCASE.
ENDMODULE. " USER_COMMAND_9003 INPUT
2. Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
MODULE DISPLAY_ALV OUTPUT.
IF GV_RPT EQ 'DETAIL'.
PERFORM F_FIELDCAT_DETAIL.
PERFORM F_LAYOUT_DETAIL.
PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
PERFORM F_DISPLAY_ALV_DETAIL.
ELSEIF GV_RPT EQ 'REPORT'.
PERFORM F_FIELDCAT_REPT.
PERFORM F_LAYOUT_REPT.
PERFORM F_EXCLUDE_TOOLBAR_REPT.
PERFORM F_DISPLAY_ALV_REPT.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
3. Before displaying ALV you need to free the container and ALV.
FORM F_DISPLAY_ALV_DETAIL .
IF GC_CONTAINER_ES IS NOT INITIAL.
CALL METHOD GC_CONTAINER_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_ALV_GRID_ES IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_CONTAINER_TB IS NOT INITIAL.
CALL METHOD GC_CONTAINER_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_ALV_GRID_TB IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT GC_CONTAINER_ES
EXPORTING
CONTAINER_NAME = 'CC_9003'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6.
CREATE OBJECT GC_ALV_GRID_ES
EXPORTING
I_PARENT = GC_CONTAINER_ES
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = GS_LAYOUT_ES
IT_TOOLBAR_EXCLUDING = GT_TOOLBAR_ES
CHANGING
IT_OUTTAB = GT_ES_REPT
IT_FIELDCATALOG = GT_FIELDCAT_ES
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDFORM. " F_DISPLAY_ALV_DETAIL
Similarly define the FORM F_DISPLAY_ALV_REPT.
Hope this will be useful for you. If you have any more queries let me know. -
Displaying dynamic table in OOPS ALV
Hi,
I am creating a dynamic internal table which consists of some fields which are being filled dynamically and some fields which are being filled from a static internal table. I am facing two issues in the development:-
1. The static fields are being populated into the dynamic work area successfully but I am not able to modify the dynamic in ternal table using the work area.
PFB my code:
READ TABLE I_LEVEL1 WITH KEY KSCHL = WA_T681-KSCHL
KOTABNR = WA_T681-KOTABNR.
IF SY-SUBRC EQ 0.
<WA_DYN_TABLE1>-UDATE = I_LEVEL1-UDATE.
<WA_DYN_TABLE1>-UTIME = I_LEVEL1-UTIME.
MOVE-CORRESPONDING <WA_DYN_TABLE1> TO <WA_DYN_TABLE>.
MODIFY <I_DYN_TABLE> FROM <WA_DYN_TABLE> TRANSPORTING UDATE
UTIME.
The dynamic filds of <I_DYN_TABLE> are being populated successfully but the MODIFY statement gives an error.
The specified type has no structure and therefore no component called UDATE.
2. The other problem I am facing is that while displaying output for the same ALV, no column names are being displayed.
I am using OOPS ALV.
PFB my code for the same:
CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = O_TABLE
CHANGING T_TABLE = <I_DYN_TABLE> ).
O_FUNCTIONS = O_TABLE->GET_FUNCTIONS( ).
O_FUNCTIONS->SET_ALL( ABAP_TRUE ).
O_COLUMNS = O_TABLE->GET_COLUMNS( ).
O_COLUMNS->SET_OPTIMIZE( 'X' ).
Please help me regarding the issues.
Thanks.
Edited by: Suhas Saha on Jan 18, 2012 3:11 PMHi Suhas,
Thank you for the reply. The modify problem has been solved.
Regarding the heading issue:
Here is the code for populating the table:-
LOOP AT I_TY_FIELD INTO WA_TY_FIELD.
WA_DYN_IT-FIELDNAME = WA_TY_FIELD-FIELDNAME.
WA_DYN_IT-TABNAME = WA_TY_FIELD-TABNAME.
WA_DYN_IT-DATATYPE = WA_TY_FIELD-DATATYPE.
WA_DYN_IT-INTTYPE = WA_TY_FIELD-INTTYPE.
WA_DYN_IT-INTLEN = WA_TY_FIELD-INTLEN.
WA_DYN_IT-SCRTEXT_M = WA_TY_FIELD-FIELDDESC.
APPEND WA_DYN_IT TO I_DYN_IT.
CLEAR: WA_DYN_IT.
ENDLOOP.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = I_DYN_IT
IMPORTING
EP_TABLE = I_DY_TABLE.
ASSIGN I_DY_TABLE->* TO <I_DYN_TABLE>.
ASSIGN <I_DYN_TABLE> TO <FS_2>.
Create dynamic work area and assign to FS
CREATE DATA I_DY_LINE LIKE LINE OF <I_DYN_TABLE>.
ASSIGN I_DY_LINE->* TO <WA_DYN_TABLE>.
I_TY_FIELD contains all static and dynamic fields.
Is there any field of I_DYN_IT i need to fill I have missed which fills up the column header data?
Maybe you are looking for
-
I'm having Final Cut Pro X interface issues
I am a total n00b to FCP, and I have messed up my version seemingly completely and have no idea how. I am currently taking a class (only a couple classes in) and the layout on the class FCP X is totally different, listing the different drives and eve
-
Automatic Clearing (SAPF124 Program)
Hi friends, I haven't work F.13 (or F13E) transaction. I mainted TF123 table by OB74 transaction. Still it hasn't work. http://img.webme.com/pic/s/sapciyiz/sapf124.jpg http://img.webme.com/pic/s/sapciyiz/sapf124b.jpg Is there deficient customizing? P
-
I already made an accoount, so how can I change it so that I do not have to choose a type of credit card. Cause it does not give me the option of NONE
-
Time Machine won't back up due to a full backup disk.
Recently Time Machine has been saying the backup disk is full and therefore it can't complete the backup. I have two questions: A) Time Machine is supposed to delete old backups to clear space. Why isn't it? B) What is the proper way to delete some o
-
Unable to uninstall Adobe 10.0.1
Hello, I'm currently trying to uninstall silently Adobe 10.0.1 in order to install Adobe 9.4. To do that, i'm using the following : MsiExec.exe /x{AC76BA86-7AD7-1036-7B44-AA1000000001} Unfortunately, i'm getting the following error message (sorry for