Webdynpro ABAP ALV tutorial - simple update or use changelog ?
I was working through the alv tutorials for webdynpro abap, and while trying to complete the
"Editing ALV in Web Dynpro for ABAP", I got to page 8 of the pdf document where it explains how to do the ONDATACHECK event handler, and it comments out the portion for updating/saving the data (as noted below), and does not explain anything further about the save.
* save data to database
{* update... => only simlate, to not change the flight data model
* content!
Now, I am new to webdynpro abap, and don't know if I am supposed to utlize the changelog for this, or if a simple update will work.
Any Ideas ?
Thank you for your answer - I am guessing from your response that a method would need to be built - similar to one which I found in the SWDP_DEMO_TUTORIALS for a webdynpro called WDT_TABLE (see below) - where a check of the table changes would need to be made before an update to the table - rather than a simple one line update statement placed at that point in the code.
METHOD save_changes.
DATA: table_node TYPE REF TO if_wd_context_node,
read_sbook TYPE
if_componentcontroller=>elements_sbook_node,
aux_read_sbook TYPE
if_componentcontroller=>elements_sbook_node,
wa_read_sbook TYPE LINE OF
if_componentcontroller=>elements_sbook_node,
context TYPE REF TO if_wd_context,
change_line TYPE LINE OF wdr_context_change_list,
changes TYPE wdr_context_change_list,
aux_changes TYPE wdr_context_change,
lv_change_tab_size TYPE sy-tfill,
aux_string TYPE string,
lv_node_size TYPE sy-tfill,
aux_div TYPE int4,
aux_index TYPE i,
l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager,
text TYPE string,
it_int TYPE STANDARD TABLE OF i WITH KEY table_line.
* check whether context has changed
context = wd_context->get_context( ).
changes = context->get_context_change_log( ).
LOOP AT changes INTO aux_changes.
IF aux_changes-change_kind = 'A' AND aux_changes-node_name = 'SBOOK_NODE'.
INSERT aux_changes INTO TABLE wd_this->sbook_delta.
ENDIF.
ENDLOOP.
* get the complete context in 'read_sbook' table
table_node = wd_context->get_child_node( name = 'MY_BOOKING_NODE' ).
table_node = table_node->get_child_node( name = 'SBOOK_NODE' ).
table_node->get_static_attributes_table( IMPORTING table = read_sbook
* get the size of table and changes
DESCRIBE TABLE read_sbook LINES lv_node_size.
LOOP AT wd_this->sbook_delta INTO change_line.
APPEND change_line-element_index TO it_int.
ENDLOOP.
SORT it_int.
DELETE ADJACENT DUPLICATES FROM it_int.
DESCRIBE TABLE it_int LINES lv_change_tab_size.
* get message manager
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
* decide which way to update databse
IF lv_change_tab_size <> 0.
aux_div = lv_node_size / lv_change_tab_size.
IF aux_div <= 3.
* write complete table to database
lv_change_tab_size = lv_node_size.
CL_WDT_FLIGHT_MODEL=>write_sbook_complete( read_sbook ).
ELSE.
* write only the changed records to database
LOOP AT it_int INTO aux_index.
READ TABLE read_sbook INDEX aux_index INTO wa_read_sbook.
APPEND wa_read_sbook TO aux_read_sbook.
ENDLOOP.
CL_WDT_FLIGHT_MODEL=>write_sbook_records_changed( aux_read_sbook )
ENDIF.
REFRESH wd_this->sbook_delta.
REFRESH it_int.
wd_this->sbook_changed = abap_false.
* report message
aux_string = lv_change_tab_size .
IF lv_change_tab_size = 1.
CONCATENATE aux_string 'record written to database' INTO text.
ELSE.
CONCATENATE aux_string 'records written to database' INTO text.
ENDIF.
CALL METHOD l_message_manager->report_success
EXPORTING
message_text = text.
ELSE.
* report message
CALL METHOD l_message_manager->report_success
EXPORTING
message_text = 'there are no changes to be written to database'.
ENDIF.
ENDMETHOD.
Similar Messages
-
How to upload file in webdynpro abap alv
Hello Friends,
how to upload file in webdynpro abap alv
Regards
Narendra
Moderator message: please search for available information, post in correct "Web Dynpro ABAP" forum if still required.
Edited by: Thomas Zloch on Jun 6, 2011 11:55 AMHi Narendra,
You ahve to search before posting. This discussed many times.
You need to use file upload ui element to upload data. and display in alv.
Please go thorugh this..
http://wiki.sdn.sap.com/wiki/display/WDABAP/UploadandDownloadfilesinWebdynproABAP
Re: Upload .xls file in WDABAP
http://forums.sdn.sap.com/click.jspa?searchID=72307893&messageID=5425671
Cheers,
Kris. -
Webdynpro abap ALV export to excel with images problem
Hello experts,
I'm having problems with standard excel export functionality in webdynpro abap ALV.
In my table i have images taken from content server (employee photos) linked with URL to a table_cell Image, when i export the table to excel using standard function the images is showed as a broken picture with the following text:
"The linked image cannot displayed. The file may have been moved, or deleted. Verify that the link points to the correct file and location."
I'm running on sap basis 7.02 SP13 and implemented the notes 1975765 and 1985288 but not resolved this issue.
Do you have any ideas?
Thank you.Hi Jorge,
Are you able to download the ICONs from alv table? try to use some icon source '~Icon/Add' and check out if you can download it to excel successfully.
FYR:
Regards,
Rama -
Webdynpro ABAP - ALV how can i display Total of Column
Hi friends,
Webdynpro ABAP - ALV how can i display Total of Columns.
Please tell me any metod is there or any solution.
Thanks,
Kumar.Hi
You can take help of following code snippet to create totals for a particular column
Data: lr_function_settings TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_column type salv_wd_t_column_ref,
ls_column type salv_wd_s_column_ref.
Data: lr_field_amnt type REF TO CL_SALV_WD_FIELD.
* get reference of ALV component
lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
* get function settings
lr_function_settings ?= wd_this->alv_config_table.
* display columns in correct order
lr_column_settings ?= wd_this->alv_config_table.
lt_column = lr_column_settings->get_columns( ).
loop at lt_column into ls_column.
CASE ls_column-id.
when 'AMOUNT'
* aggregate field
CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD
EXPORTING
FIELDNAME = 'AMOUNT'
RECEIVING
VALUE = lr_field_amnt.
* create aggregate rule as total
CALL METHOD LR_FIELD_AMNT->IF_SALV_WD_AGGR~CREATE_AGGR_RULE
EXPORTING
AGGREGATION_TYPE = IF_SALV_WD_C_AGGREGATION=>AGGRTYPE_TOTAL
RECEIVING
VALUE = lv_aggr_rule.
endcase.
Regards
Manas DUa -
How to disable Print button on WebDynpro ABAP ALV
In WebDynpro ABAP, a standard menu appears around the ALV, that has a PRINT button and an EXPORT button.
Is there anyway to disable those buttons????
Thanks
JohnHi John,
Check the interface if_salv_wd_std_functions. It contains methods which are used to hide the standard ALV toolbar buttons.
Also refer : Removing "print version" button in alv
How to hide Print and Filter option from dynamic ALV -
Webdynpro ABAP -- ALV Layout setting
Dear all,
In my development with ALV in Webdynpro ABAP, I want to save the ALV layout via Setting. but it seems that the layout only can be saved as user-specific, is it any possible to use it as the gobal one?
Please kindly provide me some hints. Thanks in Advance.
Best Regards,Hi,
Yes you can make it global in administrative level.
1.In SE80 ,Double click on the name of your Web Dynpro Application .
2.Select Web Dynpro Application Menu .
3.Select Test->-> Execute in Administrative Mode from the menu.
Your application opens in administrative mode .
Go to the ALV settings make the changes and save it as some variant.
This layout will be default and global to all the users.
Regards
John Paul -
Webdynpro ABAP ALV in SAP ECC6 - EHP4: To disable Column Selection
Hi All,
We are using SAP ECC6 EHP4 and for Webdynpro ABAP application, after each column a vertical white line is appearing, and I need to hide this..
SAP suggested us to disable COLUMN SELECTION I have tried the below code but still I am not able to get this done..
Can you please suggest the appropriate method to achieve the same.
Code:
* show tab COLUMN SELECTION in Settings page
CALL METHOD wd_this->alv_conf_table->if_salv_wd_std_functions~set_column_selection_allowed
EXPORTING value = ABAP_false..
here alv_conf_table refers to CL_SALV_WD_CONFIG_TABLE.
Thanks in advance.
Thanks
Srinivas
Edited by: Srinivas Manchi on Apr 22, 2010 11:35 AM
Edited by: Srinivas Manchi on Apr 22, 2010 1:06 PMYou have to disable the DDic binding on the column before your override text will show up:
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data l_salv_wd_table type ref to iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv( ).
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data l_column type ref to cl_salv_wd_column.
l_column = l_table->if_salv_wd_column_settings~get_column( 'POSTING_DATE' ).
data l_header type ref to cl_salv_wd_column_header.
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_text( `Posting Date` ). -
Webdynpro abap-method for saving updated values in new database table
Hi Experts,
I am creating an ALV application in weddynpro abap where i have given update button to update fields & save button to save values in mastertable,but whenever i am updating & saving ,it will overwrit previous values. For this,I need to create a separate method to save the updated values of the fields in a new database table.
Looking forward for solutions.
Thank You!becuase of the below statement u r getting the error
insert into ZTAB_CS_ISSSAL values Item_Dates.
u declared the field Item_Dates as Stru_Issuesal-DATES
and u were trying to inesrting the record in the table ZTAB_CS_ISSSAL with the field Item_Dates
the error is related to the compatible.
so declare work area for updating the table should be of type ZTAB_CS_ISSSAL. -
Setting the column labels in webdynpro abap alv report
Hello,
Right now I have programmed an ALV report. The selection criterion and the display of the report all work.
However, there is an issue with the labels of columns in the ALV report. The report takes the field names of the structure I am using in the ALV report as the labels of the report. I have been trying to play around with the ALV class model to see if something will change the labels of the fields but to no avail. Would you guys know of some code or way to change the labels of the columns in the ALV report.
Thank you for your help in advance.
Sumit.
Here is some of the code I tried but does no work in the wdInit() method. It does not change the label. Any suggestions???
METHOD wddoinit .
* instantiate used component from wizard
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
* call a method in the used component from wizard
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
DATA: lr_field TYPE REF TO cl_salv_wd_field.
lr_field = lo_value->if_salv_wd_field_settings~get_field( 'CUSTOMER_NUMBER' ).
* change the label of the report.
DATA: lr_CUSTOMER_NUMBER TYPE REF TO cl_salv_wd_column.
CALL METHOD lo_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'CUSTOMER_NUMBER' receiving value = LR_CUSTOMER_NUMBER.
* SET THE LABEL OF THE COLUMN
DATA: HR_CUSTOMER_NUMBER TYPE REF TO CL_SALV_WD_COLUMN_HEADER.
CALL METHOD lr_customer_number->get_header
receiving
value = HR_CUSTOMER_NUMBER.
***** set the text of the column
CALL METHOD hr_customer_number->set_text
EXPORTING
value = 'Customer1 Number1'.
ENDMETHOD.You have to disable the DDic binding on the column before your override text will show up:
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data l_salv_wd_table type ref to iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv( ).
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data l_column type ref to cl_salv_wd_column.
l_column = l_table->if_salv_wd_column_settings~get_column( 'POSTING_DATE' ).
data l_header type ref to cl_salv_wd_column_header.
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_text( `Posting Date` ). -
Hi,
I put a tooltip on every cell of my ALV Table.
I used this code:
DATA: lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = lv_name_day.
lr_input_field->set_tooltip_fieldname( lv_name_desc ).
Unfortunately my tooltip is not long enough. The shown tooltip text is only about 20 chars long.
When I try the tooltip on a "normal" InputField, the text can be longer.
Do you have any idea what to do?
Thanks a lot!
LucieHi,
I just do the same things, what it is work for me. I think the problem is not about the length of tooltip, but the length of your field name ( lv_name_desc ).
Just check the length of your field name that you used as tooltip. Maybe the length of your tooltip field just around 20 characters.
Regards,
$=====$
Are you newbie? Check this out: [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] -
WebDynpro ABAP ALV table not refreshed
Hi everyone,
I've got a master table which displays a list of items. On lead selection a query is executed and the result is displayed in a table below the first table (like a master-detail pattern).
This all works all right when the detail view is a standard webdynpro table.
However when I replace the standard table with an ALV table this is not refreshed.
I've also tried to invalidate the node in the even handler "on lead selection" and I've also coded
lo_interfacecontroller->refresh( in = lv_refresh_in ).
but to no avail.
Any ideas?Hi,
Keep your invalidate method at the end the particular action or method.
DATA LO_ND_<Context Node> TYPE REF TO IF_WD_CONTEXT_NODE.
navigate from <CONTEXT> to <CTX_VN_ITEM_DET> via lead selection
LO_ND_<Context Node> = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_<Context Node> ).
LO_ND_<Context Node>->INVALIDATE( ).
Regards,
Monishankar C -
Double click functionality in Webdynpro ABAP ALV
Hello!
I have web dynpro application with ALV Table.
I need to reproduce the standard R/3 functionality: after the double clicking on the table row the new window with content of that row's fields should appear in the form layout .
For example, such functionality we have in the RSDMD transaction.
So I have two questions:
1. How to catch double click in the alv table of the Web dynpro application;
2. How to represent information from the alv table row in the form layout?
Could you please help me?
Thanks,
MariyaHi Maria,
Say suppose I am displaying the information from SFLIGHT in an ALV format & when I click on any 1 row's CARRID I would like to fetch the corresponding BOOKING details for that particular combination of CARRID, CONNID & FLDATE then I can proceed as follows:
1) Make the CARRID cell of your ALV to appear as an LinkToAction
2) Create an event handler for the ON_CLICK event of the ALV & within this event handler fetch the information about the row's CARRID, CONNID & FLDATE. Call a popup window and display the corresponding information in this row.
Below is the code to make your CARRID field as an LinkToAction:
METHOD wddomodifyview .
wd_this->build_alv( ).
ENDMETHOD.
METHOD build_alv .
DATA:
lr_alv_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_config TYPE REF TO cl_salv_wd_config_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref,
lr_link TYPE REF TO cl_salv_wd_uie_link_to_action,
lr_checkbox TYPE REF TO cl_salv_wd_uie_checkbox,
lr_image TYPE REF TO cl_salv_wd_uie_image.
FIELD-SYMBOLS
<fs_column> LIKE LINE OF lt_columns.
* Instantiate the ALV Component
lr_alv_usage = wd_this->wd_cpuse_alv( ).
IF lr_alv_usage->has_active_component( ) IS INITIAL.
lr_alv_usage->create_component( ).
ENDIF.
* Get reference to model
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_config = lr_if_controller->get_model( ).
* Set the UI elements.
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
LOOP AT lt_columns ASSIGNING <fs_column>.
if <fs_column>-id = 'CARRID'.
CREATE OBJECT lr_link.
lr_link->set_text_fieldname( <fs_column>-id ).
<fs_column>-r_column->set_cell_editor( lr_link ).
ENDif.
ENDLOOP.
ENDMETHOD. -
Webdynpro ABAP & JAVA step by step example
hi experts,
i am new in webdynpro. i want to learn webdynpro so any one plz help me how to create,how to install,connect,and how to execute plz send any documents for webdynpro ABAP & JAVA step by step examples with screen shots.it's really helpful for my carrier.
thanks and regards,
sapbbm.Hi Bala,
Go through the below link,
https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
Here u can find 6 tutorial applications on Webdynpro Abap with step by step procedure, Using this u can start of with Webdynpro from the basics.
Along with this u can find good documentation in,
http://help.sap.com/saphelp_erp2005/helpdata/en/f6/501b42b5815133e10000000a155106/frameset.htm
Hope this helps,
Regards,
Sachidanand.B -
Calling a webservice from webdynpro ABAP.
Hi,
Anybody have doc/material with screenshots on calling a webservice from webdynpro ABAP (In WAS 7.0 version using service calls ) with clear steps ?
Thanks in advance. Ponts will not be a constraint for right answers
Praveen
Edited by: Praveen kumar Kadi on Feb 23, 2009 11:19 AMHi Praveen,
1st Step : configure Logical Port
http://help.sap.com/saphelp_nw70/helpdata/EN/16/285d32996b25428dc2eedf2b0eadd8/frameset.htm
2nd Step : Generate Proxy Object
http://help.sap.com/saphelp_nw70/helpdata/EN/16/285d32996b25428dc2eedf2b0eadd8/frameset.htm
3rd Step : Instantiating the proxy object & calling the methods exposed by webservice
data: sys_exception type ref to cx_ai_system_fault,
sys_exception2 type ref to cx_ai_application_fault,
client_proxy type ref to zco_myesa, "MY PROXY CLASS
lv_ret_code type int4,
lv_input type zsend_email_input,
lv_response type zsend_email_response.
data: lv_from type string,
lv_from_address type string,
lv_to type string,
lv_to_address type string,
lv_subject type string,
lv_msg type string.
lv_input-from = 'MYSAPTEST'.
lv_input-from_address = '<someAddress>'.
lv_input-to = 'Prashant'.
lv_input-to_address = '<someAddress>'.
lv_input-subject = ' TEST'.
lv_input-msg_body = ' Hi this is wonderfull to see it work'.
try.
create object client_proxy
exporting
logical_port_name = 'BASIC'. " Basic is a TYPE G RFC Destination
call method client_proxy->send_email
exporting
input = lv_input
importing
output = lv_response .
catch cx_ai_system_fault into sys_exception .
data lv_err type string.
lv_err = sys_exception->if_message~get_text( ).
write: / lv_err.
catch cx_ai_application_fault into sys_exception2 .
lv_err = sys_exception->if_message~get_text( ).
write: / lv_err.
endtry.
if lv_response is initial.
write: /'Not Executed'.
else.
write: /'Did Execute'.
endif.
Greetings
Prashant -
Unable SAP Work Directory in Webdynpro ABAP
Hi,
I got a requirement to display SAP Work Directory path in Webdynpro ABAP application.
So I am using FM - IW_C_GET_SAPWORKDIR to retrieve the path. I can able to execute in SAP GUI but when I try to execute the FM in Webdynro ABAP, its going to the runtime error.
Suggest me to proceed further. Thanks in Advance!
Thanks & Regards,
Jaipal.HI Srinivas,
I am getting an error as "Error accessing Windows registration" (message class - 42 and message no. - E678) from function module.
I have declared correctly but still I am getting an above error at runtime.
Regards,
Jaipal
Maybe you are looking for
-
Forwarding to a specific anchor in a jsp
My problem: I need to forward to an anchor in a jsp from a proxy. I have tried: forwardToPage(index.jsp#<anchorName>, request, response); but this just looks for a file c
-
Hello, My problem is that colors for Molokai color-schema in Vim doesn't look exactly the same as in screenshot. Molokai isn't the only color-scheme for me that looks kinda weird and I think that's somehow related to terminal support for 256 colors.
-
Интересуют совместимые аксессуары для Lenovo ThinkPad S5 Yoga 15 i7 5500U/8Gb/SSD256Gb/840M 2Gb/15.6"/Touch/FHD/W8.164/black/WiFi/ [20dq001rrt]: 1) 3G|4G|LTE - какой из существующих в продаже (включая ebay, amazon и т.п.) модемов подойдёт и какие под
-
Campaign and emailform :file export
Hi, Working on CRM 7.1.Im creating emailform with usage type as 'file export',now only attributes are available.I need to include text elements,images,subject of the emailform.Can I achieve this by implementing Badi: Maintain Additional Attributes fo
-
Matrix of Radio buttons on Datagrid please help!
Hi, Anyone help me walk through this, I have a Datagrid object which uses radio button as item renderer. To be more specific this is a matrix of radio buttons on datagrid. The datagid columns are dynamically generated depending on the number of i