ALV object model examples
Dear All
Can anybody tell me, where will i find the examples for ALV report using object model (two-dimensional table).
Thanks
ravi
Hi Ravindra,
Transaction DWDM, Under grid controls...
Also check out all report programs that contain BCALV_GRID*
BCALV_GRID_DEMO being the simple one..
CL_GUI_ALV_GRID is the class, you can find some sample programs by doing a where used list on it as well..
Sri
Message was edited by: Srikanth Pinnamaneni
Similar Messages
-
ALV object model - List download
H Experts,
I have used ALV object model to list display.
Also i have used class CL_ALV_COLUMNS_TABLE and its method set_long_text to set the column heading.
Now if i execute this report, long text is displayed properly in column heading.
But when i download this report output in spreadsheet, short text is displayed in column heading which is taken from the data element in DDIC.
Example:
I have declaed a column of type ABWTG.
I have set leng text as 'TEST'.
When i execute the report, column heading is displayed "TEST', which is as expected.
But when i download this report in spreadsheet, column heading is displayed as 'NUMBER' in spread sheet. While downloading column heading is taken from the data element for field ABWTG. But i want the long text 'TEST' to be displayed when the report output is downloaded.
Please suggest how to do it.
RegardsHi,
As per my understanding , it is displaying in excel based on ur ddic_output_length field.
only becoz of that field it will show the same header.
IF u will change the value at run time for this field then u will not get that issue,
I m also searching on the same issue.
Thanks
Rahul -
ALV Object Model - Merged Cells
Hi all
When utilizing ALV Object Model, how do I display cells as merged when they have the same content?
Can someone help me out?
Thank you very much!Hello Yun
In dialog cells are merged automatically as soon as you sort the column containing repeated values.
Thus, when you call method SET_TABLE_FOR_FIRST_DISPLAY you should additionally provide parameter IT_SORT with the appropriate entries.
For example, you want to sort your ALV list according to COL_A (1st) and COL_B (2nd):
ls_sort-spos = 1.
ls_sort-fieldname = 'COL_A'.
ls_sort-up = 'X'. " sort ascending
append ls_sort to lt_sort.
ls_sort-spos = 2.
ls_sort-fieldname = 'COL_B'.
ls_sort-up = 'X'. " sort ascending
append ls_sort to lt_sort.
Regards
Uwe -
Editable field in ALV Object Model
Hi Guys,
I'm using method cl_salv_table=>factory to display an ALV (Object Model) in my report.
I want to "open up" one field for user entries, in other words make one column of my table editable.
I assumed to find the respective methods in class cl_salv_table, cl_salv_columns_table or cl_salv_display_settings, so far without getting anywhere.
I know about the field-catalogue and the method set_ready_for_input in class CL_GUI_ALV_GRID - it's not working once you're in the object model.
Any ideas how to do that?
Thank you!
With best regards,
AndreasHi Guys,
I'm using method cl_salv_table=>factory to display an ALV (Object Model) in my report.
I want to "open up" one field for user entries, in other words make one column of my table editable.
I assumed to find the respective methods in class cl_salv_table, cl_salv_columns_table or cl_salv_display_settings, so far without getting anywhere.
I know about the field-catalogue and the method set_ready_for_input in class CL_GUI_ALV_GRID - it's not working once you're in the object model.
Any ideas how to do that?
Thank you!
With best regards,
Andreas -
END_OF_PAGE in ALV Object model
Dear all,
I am using ALV Object model, but the END_OF_PAGE is not triggering. I have pasted the sample code below. Let me know how to get END_OF_PAGE in ALV OM.
REPORT ztest_rr.
DATA : it_sflight TYPE TABLE OF sflight.
DATA : gr_sflight TYPE REF TO cl_salv_table,
gr_content TYPE REF TO cl_salv_form_element,
gr_sorts TYPE REF TO cl_salv_sorts,
gr_events TYPE REF TO cl_salv_events,
gr_print TYPE REF TO cl_salv_print.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_top_of_page FOR EVENT
top_of_page OF cl_salv_events
IMPORTING
page
table_index
r_top_of_page,
handle_end_of_page FOR EVENT
end_of_page OF cl_salv_events
IMPORTING
page
r_end_of_page.
ENDCLASS. "lcl_eventhandler DEFINITION
DATA : gr_handler TYPE REF TO lcl_eventhandler.
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_top_of_page.
PERFORM create_alv_form_content_top
USING page
table_index
CHANGING gr_content.
r_top_of_page->set_content( gr_content ).
ENDMETHOD. "handle_top_of_page
METHOD handle_end_of_page.
PERFORM create_alv_form_content_eop
USING page
CHANGING gr_content.
r_end_of_page->set_content( gr_content ).
ENDMETHOD. "handle_end_of_page
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT *
FROM sflight
INTO TABLE it_sflight.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>true
r_container =
container_name =
IMPORTING
r_salv_table = gr_sflight
CHANGING
t_table = it_sflight
CATCH cx_salv_msg .
ENDTRY.
CALL METHOD gr_sflight->get_sorts
RECEIVING
value = gr_sorts.
CALL METHOD gr_sorts->set_group_active
EXPORTING
value = if_salv_c_bool_sap=>true.
TRY.
CALL METHOD gr_sorts->add_sort
EXPORTING
columnname = 'CARRID'
position =
sequence = IF_SALV_C_SORT=>SORT_UP
subtotal = IF_SALV_C_BOOL_SAP=>FALSE
group = if_salv_c_sort=>group_with_newpage
obligatory = IF_SALV_C_BOOL_SAP=>FALSE
receiving
value =
CATCH cx_salv_not_found .
CATCH cx_salv_existing .
CATCH cx_salv_data_error .
ENDTRY.
CALL METHOD gr_sflight->get_event
RECEIVING
value = gr_events.
CALL METHOD gr_sflight->get_print
RECEIVING
value = gr_print.
CALL METHOD gr_print->set_reserve_lines
EXPORTING
value = 5.
CREATE OBJECT gr_handler.
SET HANDLER gr_handler->handle_top_of_page FOR gr_events.
SET HANDLER gr_handler->handle_end_of_page FOR gr_events.
CALL METHOD gr_sflight->display
*& Form CREATE_ALV_FORM_CONTENT_TOP
text
-->P_PAGE text
-->P_TABLE_INDEX text
<--P_GR_CONTENT text
FORM create_alv_form_content_top USING l_page
l_table_index
CHANGING lr_content.
WRITE 'HAI'.
ENDFORM. " CREATE_ALV_FORM_CONTENT_TOP
*& Form CREATE_ALV_FORM_CONTENT_EOP
text
-->P_PAGE text
<--P_GR_CONTENT text
FORM create_alv_form_content_eop USING l_page
CHANGING lr_content.
WRITE 'BYE'.
ENDFORM. " CREATE_ALV_FORM_CONTENT_EOPDear all,
I am using ALV Object model, but the END_OF_PAGE is not triggering. I have pasted the sample code below. Let me know how to get END_OF_PAGE in ALV OM.
REPORT ztest_rr.
DATA : it_sflight TYPE TABLE OF sflight.
DATA : gr_sflight TYPE REF TO cl_salv_table,
gr_content TYPE REF TO cl_salv_form_element,
gr_sorts TYPE REF TO cl_salv_sorts,
gr_events TYPE REF TO cl_salv_events,
gr_print TYPE REF TO cl_salv_print.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_top_of_page FOR EVENT
top_of_page OF cl_salv_events
IMPORTING
page
table_index
r_top_of_page,
handle_end_of_page FOR EVENT
end_of_page OF cl_salv_events
IMPORTING
page
r_end_of_page.
ENDCLASS. "lcl_eventhandler DEFINITION
DATA : gr_handler TYPE REF TO lcl_eventhandler.
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_top_of_page.
PERFORM create_alv_form_content_top
USING page
table_index
CHANGING gr_content.
r_top_of_page->set_content( gr_content ).
ENDMETHOD. "handle_top_of_page
METHOD handle_end_of_page.
PERFORM create_alv_form_content_eop
USING page
CHANGING gr_content.
r_end_of_page->set_content( gr_content ).
ENDMETHOD. "handle_end_of_page
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT *
FROM sflight
INTO TABLE it_sflight.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>true
r_container =
container_name =
IMPORTING
r_salv_table = gr_sflight
CHANGING
t_table = it_sflight
CATCH cx_salv_msg .
ENDTRY.
CALL METHOD gr_sflight->get_sorts
RECEIVING
value = gr_sorts.
CALL METHOD gr_sorts->set_group_active
EXPORTING
value = if_salv_c_bool_sap=>true.
TRY.
CALL METHOD gr_sorts->add_sort
EXPORTING
columnname = 'CARRID'
position =
sequence = IF_SALV_C_SORT=>SORT_UP
subtotal = IF_SALV_C_BOOL_SAP=>FALSE
group = if_salv_c_sort=>group_with_newpage
obligatory = IF_SALV_C_BOOL_SAP=>FALSE
receiving
value =
CATCH cx_salv_not_found .
CATCH cx_salv_existing .
CATCH cx_salv_data_error .
ENDTRY.
CALL METHOD gr_sflight->get_event
RECEIVING
value = gr_events.
CALL METHOD gr_sflight->get_print
RECEIVING
value = gr_print.
CALL METHOD gr_print->set_reserve_lines
EXPORTING
value = 5.
CREATE OBJECT gr_handler.
SET HANDLER gr_handler->handle_top_of_page FOR gr_events.
SET HANDLER gr_handler->handle_end_of_page FOR gr_events.
CALL METHOD gr_sflight->display
*& Form CREATE_ALV_FORM_CONTENT_TOP
text
-->P_PAGE text
-->P_TABLE_INDEX text
<--P_GR_CONTENT text
FORM create_alv_form_content_top USING l_page
l_table_index
CHANGING lr_content.
WRITE 'HAI'.
ENDFORM. " CREATE_ALV_FORM_CONTENT_TOP
*& Form CREATE_ALV_FORM_CONTENT_EOP
text
-->P_PAGE text
<--P_GR_CONTENT text
FORM create_alv_form_content_eop USING l_page
CHANGING lr_content.
WRITE 'BYE'.
ENDFORM. " CREATE_ALV_FORM_CONTENT_EOP -
Hi,
Does anyone know how to create a context menu (right click on line or field) in the new ALV object model (class CL_SALV_TABLE)?
Thanks in advance
Keld Gregersen
PS: In the past we could use event CONTEXT_MENU_REQUEST in class CL_GUI_ALV_GRID, so it must be possibleI don't think there's "any such animal" in the new class. I'm not 100% certain however but the new class is only useful for fairly simple display only type grids.
There's no edit capability either.
I'd stick with cl_gui_alv_grid until there's some decent extra functionality in the cl_salv_table class.
It's fine for quick "bog standard" displays as it doesn't need a field catalog or any screens to be created by the user or developer - but you pay a price for that in limited fnctionality.
Cheers
jimbo -
Questions about ALV object model
Hi,
for a new report i´m planing to use the "new" ALV object model to create the ALV list. Now I´ve got two questions concerning this topic:
- is it possible to switch the ALV into the edit mode like it´s possible if the "old" CL_GUI_ALV_GRID class
is used?
- how I can encolor specific cells?
I couldn´t find any hints or demo programms for these questions
Regards,
Andyit is not possible to Edit the ALV using Object Model.
For coloring...check this code.
DATA: alv TYPE REF TO cl_salv_table.
TYPES: BEGIN OF ty_tab,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
color TYPE lvc_t_scol,
END OF ty_tab.
DATA: wt_color TYPE lvc_t_scol,
wa_color TYPE lvc_s_scol,
w_color TYPE lvc_s_colo.
DATA: wa_flight TYPE ty_tab.
DATA: column_tab TYPE REF TO cl_salv_columns_table,
column TYPE REF TO cl_salv_column_table.
DATA: column_ref TYPE salv_t_column_ref,
wa LIKE LINE OF column_ref.
DATA: it_flight TYPE STANDARD TABLE OF ty_tab.
SELECT carrid connid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 10 ROWS.
w_color-col = 4.
w_color-int = 0.
w_color-inv = 0.
LOOP AT it_flight INTO wa_flight.
w_color-col = 4.
wa_color-fname = 'CARRID'.
wa_color-color = w_color.
APPEND wa_color TO wt_color.
w_color-col = 6.
wa_color-fname = 'CONNID'.
wa_color-color = w_color.
APPEND wa_color TO wt_color.
wa_flight-color = wt_color.
MODIFY it_flight FROM wa_flight.
ENDLOOP.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = it_flight
"get all the columns
column_tab = alv->get_columns( ).
column_tab->set_color_column( value = 'COLOR' ).
column_ref = column_tab->get( ).
"loop each column
LOOP AT column_ref INTO wa.
"Conditionally set the column type as key or non key
IF wa-columnname = 'CARRID'.
column ?= wa-r_column.
column->set_key( abap_true ).
ENDIF.
ENDLOOP.
alv->display( ). -
Client side object model examples in sharepoint 2010
Hi,
I wanted to learn client side object model in share point 2010.Please provide some urls with examples.
Regards,
PraveenHi Praveen,
here is your links to start with ....explained with examples. :)
http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-Introduction
http://zimmergren.net/technical/sp-2010-getting-started-with-the-client-object-model-in-sharepoint-2010
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply. -
Client side object model examples
Hi,
I wanted to learn more about client object model with examples.Can u please share some important urls to learn client object model with examples.
Regards,
PraveenRefer to the following articles, hope it helps
http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
http://msdn.microsoft.com/en-us/library/ee857094(v=office.14).aspx
http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-Introduction
--Cheers -
Alv object model and cl_salv_hierseq_level
I have used the cl_salv_hierseq_level to enable expand and collapse on an instance of cl_salv_hierseq_table.
The function to show the detail lines works until the grid table is refreshed from the database. I have tried using the set_items_expanded method again after the refresh to no avail.
Can anyone provide information on how to use the class and methods after some grid processing to keep expand and collapse enabled?There are no replies to this question; but I have noticed the expand/collapse works after process and refresh now.
-
Message in Status Bar while using ALV Objects
Hi All,
If we use ALV in objects (Build in class and methods for ALV),is it possible to display a error message using Message statement in Status bar.
Thanks in advance.Hi,
Yes, it is possible. You can do it using the ALV Object Model (ALV OO methods) within an event handler method. For example, the event "added_function of cl_salv_events" can be used and you can add code similar to the following code within the event handler method:
CASE e_salv_function.
WHEN 'XYZ'.
MESSAGE w001(00) WITH 'Message text goes here...'.
ENDCASE.
The warning message will either show up as a popup or in the status bar depending on your user settings. Of course, you can also use other message types (e.g. I, E, S) or other message techniques besides the message statement.
Best Regards,
Jamie -
Logo in Object Model ALV ?
Hi Experts
I have a small doubt in object model alv...
Is there any chance to create logo in alv using OBJECT MODEL (CL_SALV_TABLE)..
Regards,
VamsiHey, check this example code:
METHOD alv_set_header.
DATA: lv_grid TYPE REF TO cl_salv_form_layout_grid, "Header Layout
lv_label TYPE REF TO cl_salv_form_label, "Label
lv_logo TYPE REF TO cl_salv_form_layout_logo, "Logo
lv_text TYPE REF TO cl_salv_form_text. "Text
CREATE OBJECT lv_grid.
lv_label = lv_grid->create_label(
text = 'Execution Date:'(008)
row = 1
column = 1 ).
lv_text = lv_grid->create_text(
text = sy-datum
row = 1
column = 2 ).
lv_label = lv_grid->create_label(
text = 'Execution Time:'(009)
row = 2
column = 1 ).
lv_text = lv_grid->create_text(
text = sy-uzeit
row = 2
column = 2 ).
lv_label = lv_grid->create_label(
text = 'Responsible:'(010)
row = 3
column = 1 ).
lv_text = lv_grid->create_text(
text = sy-uname
row = 3
column = 2 ).
lv_grid->add_row( ).
lv_grid->add_row( ).
lv_grid->add_row( ).
lv_label = lv_grid->create_label(
text = 'Total Records:'(011)
row = 5
column = 1 ).
lv_text = lv_grid->create_text(
text = me->mv_total
row = 5
column = 2 ).
lv_label->set_label_for( lv_text ).
CREATE OBJECT lv_logo.
lv_logo->set_left_content( lv_grid ).
lv_logo->set_right_logo( 'CUSTOMER_LOGO' ) .
me->mo_salv_table->set_top_of_list( lv_logo ).
ENDMETHOD. "alv_set_header -
Trying to use Web LCID property to get the List name in client object Model
Hi ,
I am trying to change the "Personal Documents" list NoCrawl property under MySite using SharePoint Client Object Model. As we use web.Lists.GetByTitle("Personal
Documents"); method to get the list,but here problem is :for different language List name is in their language.So I tried to use LCID property of the WEB and
have taken key-value pair (PersonalSiteOnet_List_PersonalDocuments) from the resource file for that language from 14 hive.
Example:I have selected Spanish language .there are so many LCID for Spanish language but Microsoft has given only one language pack for Spanish.
Then,My Question is that
"All LCID for Spanish language are using same Spanish language pack dictionary file OR something else"
Hi,
According to your post, my understanding is that your requirement is getting list in different language.
Here are two ways for your reference:
1. We can use getById method instead, so that we can avoid the language issue.
2. We can use an array to store the different list name in different language in you JavaScript code, then use the code snippet below to get the list:
var userLcid =_spPageContextInfo.currentLanguage;
var localizedStrings = {
ListName: {
_1033: "EnglishName",
_3082: "SpanishName"
var listName=localizedStrings.ListName["_" + userLcid];
var list=web.Lists.getByTitle(listName);
More information:
http://msdn.microsoft.com/en-us/library/hh670609.aspx
http://wellytonian.com/2012/11/language-packs-sharepoint-2010/
Best Regards
Dennis Guo
TechNet Community Support -
Hi Guys,
Is there any way to retrieve current logged-in user's Manager name in the console application.
As I don't have access to the server where SharePoint 2010 is installed so I wanted to access through client object model.
arun singhUnfortunately, you can't use CSOM to do this in SharePoint 2010 (you can in SharePoint 2013!), but you CAN use the User Profile Service .asmx web service to accomplish this. You need to call the
GetUserProfileByName method exposed
in the http://<yourServerName>/_vti_bin/UserProfileService.asmx web service. Pass in the user name for the current user and Manager will be one of the properties that is returned.
Here is a link to a blog post with example code.
Please mark my reply as helpful (the up arrow) if it was useful to you and please mark it an answer (the check box) if it answered your question! Thank you!
Danny Jessee | MCPD - SharePoint Developer 2010 | MCTS - SharePoint 2010, Configuring
Blog: http://dannyjessee.com/blog | Twitter: @dannyjessee -
Business Object Modeler Question
Hi Experts,
I'm new to CE and currently trying to figure out what can I do with it?
Assume that I'm planning to create an application to follow activities that our consultants doing.
For this, we're planning to use Local Portal Database to store datas.
When I checked, "Business Object Modeler" is a tool which helps to create business objects and generates tables behind and access services automatically.
Then generating a Web Service for this BO and then using the WS with VC and WD4J is a great asset for us.
But, my questions?
1. Is this a right approach for such scenario?
2. I've created a sample BO and generated WS and tried to use with VC. Create, Delete, Reand and Update Operations can be made available for WebService, but I'm unable to add FindAll or FindByMultiple Parameter operations to Web Service?
Any idea for Q1 and answer for Q2 will be appreciated.
RegardsHi,
Yes, You have to arite the code.Actually, Application services are the place where you will wrtie your business logic.
In th application service operations you have to call the business object operations.
For architechturel guidelines you can go [through thii doc|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00caf8bd-487a-2a10-36a9-93d840309310].
answer to second question:
You can't change the code in the BO operations. What ever you want, you have to do it in the application servcies only.
Create an application service operation say:
operation(). Create a input/output data structures.
Exapmle: OperationResponce operation(OperationRequest).
Yuor lists add to the OperationRequest datatype. Similarly for OperationResponce also. In this case you don,t have any issues.Actually this is the standered for Web Services.
[This document|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0d97ec6-5de0-2a10-a5b3-b5926075566c], you can use as an example
[CE 7.1 Tuorial Center.|https://www.sdn.sap.com/irj/sdn/nw-development?rid=/webcontent/uuid/903c2cdb-98d6-2a10-84b7-ab22535de11a]
Reward Points, If you feel it is useful.
Sampath
Maybe you are looking for
-
Hi Experts, Is there any way to hide only the completed work items items and keep only the active workitem open in UWL? And does the workitem in cancelled or submitted status appear in UWL? any input will be highly appreciated. regards, amit bagati
-
IPad Mini iOs 8.1: STOP ASKING ME TO LOG IN TO THE ITUNES STORE!!!
Keeps asking me on the iPad, not on my other iOS devices.
-
How to create playlist of party shuffle from CD?
I had moved all my gigabytes of songs into a DVD to free up some space. How do i create playlist of party shuffle from the DVD? I guess the answer is NO. Any workaround?
-
Hi. I would like to know if it's possible to have two database in different versions (9i and 10g) in the same nodes. In this case, I suppose that I have to install the tow clusterware, one for 9i and another one for 10g, haven't I? Thanks!
-
Unhappy newbie. Many thousands of Mac users across the nation depend on Quicktime, Real, and Windows Media to playback "legacy files" as well as files that remain in widespread use, especially midi files. From what I have read, these are no longer ac