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` ).
Similar Messages
-
How can i change the column label text in a alv table display
how can i change the column label text in a alv table display??
A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
<i>* declare column, settings, header object
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
get column by specifying column name.
lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
set Header Text as null
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( ' ' ).</i>
My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
<i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
i have checked in debugging and the error occured at the statement :
<i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
Thanks,
SuriI found it myself how to do it. The error says that it is not able to find the reference object i.e it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_cmdl TYPE REF TO cl_salv_wd_config_table,
lr_col TYPE REF TO cl_salv_wd_column.
DATA : node_year TYPE REF TO if_wd_context_node,
elem_year TYPE REF TO if_wd_context_element,
stru_year TYPE if_alv_layout=>element_importing,
item_year LIKE stru_year-i_current_year,
lf_string TYPE char(x),
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
Get the entered value from the input field of the screen
node_year = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
elem_year = node_year->get_element( ).
elem_year->get_attribute(
EXPORTING
name = 'IMPORT_NODE-PARAMETER'
IMPORTING
value = L_IMPORT_PARAM ).
WRITE L_IMPORT_PARAM TO lf_string.
Get the reference of the table
lr_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lr_cmp_usage->has_active_component( ) IS INITIAL.
lr_cmp_usage->create_component( ).
ENDIF.
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_column_settings = lr_if_controller->get_model( ).
get column by specifying column name.
IF lr_column_settings IS BOUND.
lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
set Header Text as null
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( lf_string ).
endif. -
Can we hide the lines between the columns and rows of an alv in wd abap
HI all ,
I know that we can colour cell/column/row in an alv in wd abap.
but, can we hide the lines between the columns and rows of an alv in wd abap.
i have checked this link [hiding lines b/n rows and columns of an alv|http://help.sap.com/saphelp_nw04/helpdata/en/91/e7eb40c4f8712ae10000000a155106/content.htm]
but didn't understand, can please anybody provide some example or any material..? it will be very helpful.
THANK YOU.
Edited by: arfat111 on Feb 15, 2010 7:05 AMCode some like this in the WDDOINIT method of your view which defines the ALV component as used component.
instansiate the ALV component
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usage_alv().
if lo_cmp_usage->has_active_component() is initial.
lo_cmp_usage->create_component().
endif.
data lo_interfacecontroller type ref to iwci_salv_wd_table.
lo_interfacecontroller = wd_this->wd_cpifc_usage_alv().
data lo_value type ref to cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model().
hide the grid lines
lo_value->if_salv_wd_table_settings~SET_GRID_MODE( value = '01' ).
Thanks,
Abhishek -
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 -
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 -
JTextField - Setting the column size doesn't work. Help, please.
Hi,
I want to set the column size of a text field from another text field by the input from the user. However, it just doesn't work. The following is my code. Just check out the last anonymous inner class action listener. Somehow i can get the user text, but it just doesn't work.
Thanks for any helpful inputs.
* Introduction to Java Programming: Comprehensive, 6th Ed.
* Excercise 15.11 - Demonstrating JTextField properties, dynamically.
* @Kaka Kaka
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
public class Ex15_11 extends JFrame{
// Create two text fields and three radio buttons
private JTextField jtfUserText = new JTextField(10);
private JTextField jtfColumnSize = new JTextField(new Integer(10));
private JRadioButton jrbLeft = new JRadioButton("Left");
private JRadioButton jrbCenter = new JRadioButton("Center");
private JRadioButton jrbRight = new JRadioButton("Right");
public static void main(String[] args){
Ex15_11 frame = new Ex15_11();
frame.pack();
frame.setTitle("Excercise 15.11 - Text Field Property");
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
// Start of Constructor
public Ex15_11(){
// Set the the frame layout
setLayout(new BorderLayout(5, 5));
// Create three panels and two labels
JPanel jpText = new JPanel();
JPanel jpHorizontalAlignment = new JPanel();
JPanel jpColumn = new JPanel();
JLabel jlblTextField = new JLabel("Text Field");
JLabel jlblColumn = new JLabel("Column Size");
// Create a button group for the radio buttons to be grouped
ButtonGroup group = new ButtonGroup();
// Group the radio buttons
group.add(jrbLeft);
group.add(jrbCenter);
group.add(jrbRight);
// set a titled border for a panel
jpHorizontalAlignment.setBorder(new TitledBorder("Horizontal Alignment"));
// Create a line border
Border lineBorder = new LineBorder(Color.BLACK, 1);
// the all the components to their corresponding panels
jpText.add(jlblTextField);
jpText.add(jtfUserText);
jpHorizontalAlignment.add(jrbLeft);
jpHorizontalAlignment.add(jrbCenter);
jpHorizontalAlignment.add(jrbRight);
jpColumn.setBorder(lineBorder);
jpColumn.add(jlblColumn);
jpColumn.add(jtfColumnSize);
// add the panels to the frame
add(jpText, BorderLayout.NORTH);
add(jpHorizontalAlignment, BorderLayout.WEST);
add(jpColumn, BorderLayout.EAST);
jrbLeft.addActionListener(new ActionListener(){
// Handle event
public void actionPerformed(ActionEvent e) {
jtfUserText.setHorizontalAlignment(SwingConstants.LEFT);
jrbCenter.addActionListener(new ActionListener(){
// Handle event
public void actionPerformed(ActionEvent e) {
jtfUserText.setHorizontalAlignment(SwingConstants.CENTER);
jrbRight.addActionListener(new ActionListener(){
// Handle event
public void actionPerformed(ActionEvent e) {
jtfUserText.setHorizontalAlignment(SwingConstants.RIGHT);
// Register the listener for the coloum size
jtfColumnSize.addActionListener(new ActionListener(){
// Handle event
public void actionPerformed(ActionEvent e) {
System.out.println(Integer.parseInt(jtfColumnSize.getText()));
jtfUserText.setColumns(Integer.parseInt(jtfColumnSize.getText()));
}Edited by: ChangBroot on Dec 16, 2008 6:13 PMdon't forget to revalidate the JPanel after changing the components it holds:
jtfColumnSize.addActionListener(new ActionListener()
// Handle event
public void actionPerformed(ActionEvent e)
System.out.println(Integer.parseInt(jtfColumnSize.getText()));
jtfUserText.setColumns(Integer.parseInt(jtfColumnSize.getText()));
jpText.revalidate();
});This will tell the jpText JPanel's layout manager to relayout the components that this JPanel holds. It should resize your JTextField. Note that in order to call this from within the anonymous inner ActionListener jpText will need to be declared "final". Either that or declared as a class field. -
Dear SharePoint Developers,
Please help.
I need to know How to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx?
I think this is a "sealed column", whatever that is, which is shown in SPD 2013 as a column of content type "document, folder, MyCustomContentType".
I know when I set the column order in my custom Content Type settings page, it is correct.
But, when I load the NewDocSet.aspx page, the column order that I set in the settings page is NOT used for this "sealed column" which is bad.
Can you help?
Please advise.
Thanks.
Mark Kamoski
-- Mark KamoskiHi,
According to your post, my understanding is that you want to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx.
Per my knowledge, if you have Content Type management enabled for the list or library (if you see a list of content type with the option to add more), the display order of columns is set for each content type.
Drill down into one of them and you'll see the option under the list of columns for that content type.
To apply the column order in the NewDocSet.aspx page, you need to:
Select Site Settings, under Site Collection Administration, click Content type publishing. In the Refresh All Published
Content Types section, choose Refresh all published content types on next
update.
Run two timer jobs(Content Type Hub, Content Type Subscriber) in central admin(Central Administration--> Monitoring--> Review timer jobs).
More information:
http://sharepoint.stackexchange.com/questions/95028/content-types-not-refreshing-on-sp-online
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Set the column name of a table in a list box
is there any code to set the column name of a table in a list box at oracle devloper 6i?
pls help.I dont want to go for pl/sql . It should work any table.You want Dynamic SQL without using PL/SQL? Tricky. I'm sure there's a possible way using some very complex and convoluted XML functionality of SQL but in reality you are asking for something that isn't natural to SQL queries, especially if you are expecting a dynamic number of columns to be produced for each row of data. SQL expects a table structure, including output formats, to be a defined number of columns with any number of rows, not a defined number of rows with any number of columns.
Perhaps if you explain why you need this sort of functionality then we may be able to offer a better solution.
;) -
Set the column length in an sql query
Hi,
Is there a way to set the column length in a query without using sqlplus commands like row size and format column.
I'd like to do it just from the sql query itself.
select 'this is a test' from dual; Can I define the width of this column in the select statement
Cheers.Use RPAD,
SQL> WITH T
2 AS (SELECT 'this is test' str FROM DUAL
3 UNION ALL
4 SELECT 'this is a long test' FROM DUAL
5 UNION ALL
6 SELECT 'this is a long long long long test' FROM DUAL)
7 SELECT RPAD ( str, 20) str,LENGTH( RPAD ( str, 20)) len
8 FROM T;
STR LEN
this is test 20
this is a long test 20
this is a long long 20
SQL> G. -
To integrate the Adobe form in webdynpro ABAP
Hi Experts,
How to use the adobe form in Webdynpro ABAP?
Thanks & regads
VinoThat is quite the general question and I think if you search SCN you will find many resources - such as videos, tutorials, how-to guides, documentation - on the subject. Perhaps just starting with the online Help and the associated links form the help article will get you started:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/0f/128841e8231709e10000000a155106/frameset.htm -
How do I set the column content to automatic break lines
Hello Guys,
I have a problem with the column width and the column content of a standard report. Within the report are hugh entries which aren't interrupted by an space character. I set my column width to a special value by usingen "css style: display block; width: 300px;". Now the problem is that some of the column entries have a longer width than the column width is setted. So they overlock the entries of the column next to them.
My question is: How do I set the column content to automatic break lines after a certain count of characters?
After researching a couple of websites and discussion thread I found maybe a reference to the solution. I hope it help you to give me an answer.
COLUMN LAST_NAME FORMAT A4
regards
wderrWderr,
PDFs are another animal entirely. Try adjusting the width of the column under the Print Attributes tab of the report.
If that doesn't work you'll probably need to create custom XSL-FO layouts which, depending on the tools you have at your disposal, could take some time.
Regards,
Dan
Blog: http://DanielMcGhan.us/
Work: http://SkillBuilders.com/ -
New to portal: Setting the column width in portal QBE report
I'm trying to set different widths to different columns in the QBE report. One of the columns in the report contains long descriptive text. With the default column width the reports runs into many pages and user has to scroll a lot. I would like to set the column width for this column so that it does not wrap for every 2/3 words. In the customization tab, I'm setting the width type to "Char" and selecting the number of characters to be displayed in that coulmn. Percent/pixel width type also didn't help. Should I set the Header width also?. I'm not sure where to set this header column width.QBE report just ignores these customization parameters and displays the report in default format. Please let me know if you have any idea/solution to this problem.
Thanks
SuryaHi,
This is a bug and has been fixed 30984.
Thanks,
Sharmila -
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. -
Function Module For Upload the Powerpoint Template in Webdynpro ABAP
Hi,
Can anyone tell me, is there any standard function module to upload the Powerpoint Template to Webdynpro ABAP.
Regards,
SaranHello Saran,
for uploading the powerpoint as file you could use the FileUpload ui element.
Best regards,
Thomas -
How to set the column table so it can not be moved !
how to set the column table so it can not be moved !
m_table.getTableHeader().setReorderingAllowed(false);
m_table.getTableHeader().setResizingAllowed(false);
Maybe you are looking for
-
[SOLVED] Scribes only launches as root (was Scribes won't launch)
Hi! I just installed Arch. I wanted to use Scribes as my text editor. I was able to open it once and now it won't open. I get a Starting Scribes message on my bottom panel (I'm using Gnome) but then nothing happens. It's set as the default text edito
-
Error in statement with sql plus
Hi, I have written this sql statement: SELECT rtrim('Cambio di: ' || (CASE WHEN nvl(A.DESCRIZIONE_EMITTENTE ,' ') <> nvl(B.DESCRIZIONE_EMITTENTE ,' ') THEN 'Descrizione emittente, ' ELSE '' END) || (CASE WHEN nvl(A.INDIRIZZO_SEDE_EMI
-
Dynamic Parameter cannot fetch DB values
hello experts, i make a report in Crystal Reports w/ 2 parameters 1 static parameter and 1 dynamic parameter. when i preview the report in CR static param and dynamic param are ok. but when i published the report in sbo using Crystal report add-on th
-
trash
-
IEXPLORE.EXE - Application Error in Crystal Reports XI
IEXPLORE.EXE - Aplication Error X The instruction at "0x42fc2af2" referenced memory at "0x43686d0c". the memory could not be "read". I work in IT and not directly with this software. A user needed an upgraded computer with this software installed and