Changing FieldCatalog at runtime in an ALv
Hi All,
I have a requirement like : On selection-screen I have 2 input parameters and 2 pushbuttons namely. After input, if press one of these pushbuttons a pop up will come which is having 2 radio buttons. Based on the selection of the radiobutton, I need to make some of the fields editable in a fieldcatalog. But what my problem is .... whatever I select[Radio Button] the first time only that fieldcatalog is getting displayed. Hope I am clear in explaining my problem.
-SatyaPriya
hi
good
debug the program and check when first time the field catalogue is displaying what are the process it is following before that,check where you r given the radio button action.
Thanks
mrutyun^
Similar Messages
-
Changing fieldcatalog during runtime in an ALV
Hi All,
I have a requirement like : On selection-screen I have 2 input parameters and 2 pushbuttons namely. After input, if press one of these pushbuttons a pop up will come which is having 2 radio buttons. Based on the selection of the radiobutton, I need to make some of the fields editable in a fieldcatalog. But what my problem is .... whatever I select[Radio Button] the first time only that fieldcatalog is getting displayed. Hope I am clear in explaining my problem.
-SatyaPriyaHi Sathish,
I have used the methods <b>get_frontend_fieldcatalog</b> and <b>set_frontend_fieldcatalog</b> of class cl_gui_alv_grid..
-SatyaPriya -
How to Change the position of Column in ALV report
Hi Follks,
Is is possible to change the position of column in ALV report?.If yes then how?
Basically my requirement is, that user want afacility where , he should be able to change the position
of column aftre he runs the report.
Eg: After running the report , user felt that column 5 should be at position 2 , in that case he should
be able to drag column 5 at position 2 and vice versa.
Please help me, how to solve this issue.
Note : I am using NW 7.0 SP 9
Regards
PG
Edited by: PG on Apr 13, 2009 11:10 AMHI PG,
do below whie filling the filed catlog
wa_fieldcat-fieldname = 'Field1".
wa_fieldcat-COL_POS = '1',
append wa_fieldcat to it_fieldcat.
wa_fieldcat-fieldname = 'Field2".
wa_fieldcat-COL_POS = '2',
wa_fieldcat-fieldname = 'Field3".
wa_fieldcat-COL_POS = '3',
Thanks! -
Hi all,
I am trying change images at runtime and quite frankly it's driving me nuts. I'm pretty new to Java and don't understand some of the principles but I'm trying. I have this code below, that loads up a few images. I want to be able to change some/all of these images either on a timed even or on a button press, but all the things I've tried don't work. Can someone offer me some help....thanks in advance
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class bc extends JFrame implements ActionListener {
public static void main(String[] args) {new bc();}
bc() {
//setUndecorated(true); // - this removed the titlebar!
setTitle("BC...");
setSize(350,125);
setResizable(false);
setLocation(50,50);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setBackground(new Color(0,0,0));
getContentPane().setBackground(new Color(255,255,255));
JPanel hours = new JPanel();
hours.setLayout(new GridLayout(4,2));
hours.add(hour14);
hours.add(hour24);
hours.add(hour13);
hours.add(hour23);
hours.add(hour12);
hours.add(hour22);
hours.add(hour11);
hours.add(hour21);
JPanel mins = new JPanel();
mins.setLayout(new GridLayout(4,2));
mins.add(min14);
mins.add(min24);
mins.add(min13);
mins.add(min23);
mins.add(min12);
mins.add(min22);
mins.add(min11);
mins.add(min21);
JPanel secs = new JPanel();
secs.setLayout(new GridLayout(4,2));
secs.add(sec14);
secs.add(sec24);
secs.add(sec13);
secs.add(sec23);
secs.add(sec12);
secs.add(sec22);
secs.add(sec11);
secs.add(sec21);
JPanel helptext = new JPanel();
helptext.setLayout(new GridLayout(4,2));
helptext.add(new JLabel("8"));
helptext.add(new JLabel("4"));
helptext.add(new JLabel("2"));
helptext.add(new JLabel("1"));
//add action listenters
changeImg.addActionListener(this);
JPanel cp = new JPanel();
cp.setLayout(new GridLayout(1,6));
cp.setBackground(new Color(255,255,255));
cp.add(hours);
cp.add(mins);
cp.add(secs);
cp.add(helptext);
cp.add(changeImg);
setContentPane(cp);
setVisible(true);
public void actionPerformed(ActionEvent ae) {
hour11.PaintOff(1);
//JOptionPane.showMessageDialog(this, "changed");
repaint();
JPanel hour11 = new PaintOff(0);
JPanel hour12 = new PaintOff(0);
JPanel hour13 = new PaintBlank();
JPanel hour14 = new PaintBlank();
JPanel hour21 = new PaintOff(0);
JPanel hour22 = new PaintOff(0);
JPanel hour23 = new PaintBlank();
JPanel hour24 = new PaintBlank();
JPanel min11 = new PaintOff(0);
JPanel min12 = new PaintOff(0);
JPanel min13 = new PaintOff(0);
JPanel min14 = new PaintOff(0);
JPanel min21 = new PaintOff(0);
JPanel min22 = new PaintOff(0);
JPanel min23 = new PaintOff(0);
JPanel min24 = new PaintOff(0);
JPanel sec11 = new PaintOff(0);
JPanel sec12 = new PaintOff(0);
JPanel sec13 = new PaintOff(0);
JPanel sec14 = new PaintOff(0);
JPanel sec21 = new PaintOff(0);
JPanel sec22 = new PaintOff(0);
JPanel sec23 = new PaintOff(0);
JPanel sec24 = new PaintOff(0);
JButton changeImg = new JButton("change");
}///---------This is my PaintOff class ---------------\\\
import javax.swing.*;
import java.awt.*;
import java.awt.Image.*;
public class PaintOff extends JPanel {
Toolkit tk = Toolkit.getDefaultToolkit();
public Image imgOff = tk.getImage("off.jpg");
public Image imgOn = tk.getImage("on.jpg");
public Image paintMe = tk.getImage("off.jpg");
PaintOff(int a) {
if(a == 1) {
vOn();
} else {
vOff();
public void vOn() {
paintMe = imgOn;
//JOptionPane.showMessageDialog(new bc(), "shown");
public void vOff() {
paintMe = imgOff;
public void paintComponent(Graphics g) {
g.drawImage(paintMe,0,0,this);
}PaintBlank class is not included here, it's basically just the same as PaintOff but only has one image inside.
When I try and compile this code, I get
C:\jdk1.4\bin\bclock>javac bc.java
bc.java:79: cannot resolve symbol
symbol : method PaintOff (int)
location: class javax.swing.JPanel
hour11.PaintOff(1);
^
1 error
I don't understand this either, I've tried replacing "PaintOff(1)" with "vOn()" but I get the same error. This is baffling to be, as I thought that the hour11 would have access to all the methods inside the PaintOff class?
Anyway, thanks for any help you guys give me!
Cheers
//Chris.Hi!
Your problem is that you've used a widening conversion to convert from PaintOff to a JPanel. JPanel has no such method, and so the compiler is complaining that it can't find it.
e.g
public class NoCompile{
public static void main(String args[]){
One one = new Two();
one.methTwo();
public class Two extends One{
public Two(){}
public void methTwo(){
System.out.println("Executed 2");
public class One{
public One(){}
public void meth1(){}
} will give you the same sort of error message. To make the compiler happy, use a cast.
Now this will compile and gives the right result.
public class NoCompile{
public static void main(String args[]){
One one = new Two();
((Two)one).methTwo();
}So in your case, you want to do
((PaintOff)hour11).vOn();
Does that help?
:) jen -
Insert ,Change and Delete records in OO ALV
Hi All,
This is regarding the functionlaties Insert ,Change and Delete records in OO ALV ,
I have gone through the threads posted here and checked the standard program BCALV_EDIT_04,
but still I am not able to capture the Deleted and Inserted records,
as I am new to OO ALV,can some one help me out pls.
Thanks and regrds,
Sree.Hi Sree,
A lot of material is available on SDN.
Please see this link. This link contains good example of insertr, delete records in OOPS ALV.
[OOPS ALV.|Re: Insert ,Delete & Add a row in ALV;
May it helps you.
Regards.
DS. -
How to include change delete and insert options in alv grid display
Hi,
As per my requirement I need to display my output in grid.
When the user makes any changes to any field of the alv it should get reflected in the tatabase table.
Similarly according to the requirement if user enters a new coloumn to the alv or deletes one or more rows of the alv,same should be reflected in the databse table.
I know there are many methods in object oriented.
But its little bit tough for me to implement..
Please suggest how to code for it without oo concepts.
Thanks ,
SmritiHi,
use FM with Edit functionality enabled for all fields and
Create one pf-status with some buttons
if user presses the button the alv output table should be saved and same table can be used to insert /modify /delete the dbtable.
and check this link
[alv list|alv list]
Regards,
Nandha -
Changing picture at runtime using delphi
Post Author: iman_400
CA Forum: Other
Please help me, is there anyway we can change picture at runtime using delphi 7.0 and CRXIR2?Hi, Lee;
For the version of Crystal Reports that comes with .NET, you can use something like one of our samples shows:
https://smpdl.sap-ag.de/~sapidp/012002523100006252822008E/net_win_smpl.exe
Look for the sample, vbnet_win_DynamicImage.zip. It uses an ADO.NET dataset to change the image.
For Crystal Reports XI R2 and Crystal Reports 2008, you can more directly change the image location using built in functionality.
In the Designer, choose Insert > Picture. Choose a default image to show and save it. Right-click on it and select Format Graphic. Go to the Picture tab and click the formula button for Graphic location. Save the report.
Then, at runtime you can populate the Formula with the new location for your image, either a URL or disk file location.
See the following note for more information:
[Image|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333333373334%7D.do]
Best Regards,
Jonathan -
Change to the runtime the logon language with ABAP
Hello,
I have a question.
Is it possible to change to the runtime the logon language?
With the URL-parameter example it worked.
http://www.****bsp/sap/z_page/default.htm?sap-language=en
But I need this in the event handler with ABAP coding.
thanks Erenyou can either use
CL_HTTP_UTILITY->IF_HTTP_UTILITY~SET_REQUEST_URI
uri = sap-language=FR
or
CL_HTTP_REQUEST->IF_HTTP_ENTITY~SET_FORM_FIELD
name = sap-client
value = FR
or
use
SET LOCALE LANGUAGE 'S'. within your abap coding
Regards
Raja -
[svn] 3839: Update the channel url to reflect the change in the runtime channel
Revision: 3839
Author: [email protected]
Date: 2008-10-23 07:42:37 -0700 (Thu, 23 Oct 2008)
Log Message:
Update the channel url to reflect the change in the runtime channel
Modified Paths:
blazeds/branches/3.0.x/qa/apps/qa-manual/ajax/messaging/TextMessageRuntimeDest.htmlMany ways to do this. The easiest is to have a method in one of your classes that reads the data from the database and creates all the proper structure under a RootNode and then returns that RootNode.
Whenever you want to refresh the tree, just call that method to recreate the root node (and all the underlying structure/nodes) and then re-set the root node of your tree model using the setRoot() method. That will cause it to refresh the display given the new root node.
Once you have that working, you can get fancier and make it more efficient (only updating/firing events for the nodes that actually changed, etc). -
To change table data runtime when dropdown item is changed
Hi,
I have two ui elements(Dropdown by index and table) in single view .
I need to display table as per drondown index item selection. Means i have to change table data runtime when dropdown item is changed.Please help me in that .Please provide code for same.
Regards,
gurprit BhatiaHello gurprit Bhatia,
On the view create a new action. Fill only the Name and Text and leave the other items default.
In this event you can populate the table fields.
Bound this newly created action (event) to the onSelect property of the 'DropDownByIndex'.
Regards,
Patrick Willems -
How to change the standard layout sets in ALV List
Hi Gurus,
How to change the standard layout sets in ALV list.
Is there any standard program ? or specific way to acheive this?
Kindly drop some clues?Every valuable clues rewarded more points........
Thanks in Advance,
DharaniHello Dharani
All required function modules can be found in function group SLVC (assuming that you are using OO-based ALV or, at least, fm REUSE_ALV_GRID_DISPLAY_LVC):
LVC_VARIANT_DEFAULT_GET (Read default display variant (description only, w/o field catalog))
LVC_VARIANT_EXISTENCE_CHECK
LVC_VARIANT_F4 (Display variant selection dialog box)
LVC_VARIANT_SELECT (Read a display variant)
For a sample report using LVC_VARIANT_DEFAULT_GET have a look at BCALV_GRID_10.
Regards,
Uwe -
Runtime Error in ALV Tree Output
Dear All, I am trying to create a ALV Tree using Class cl_gui_alv_tree. The Report Shows the Output with the first Node but when i try to expand it is dumping with a runtime error GETWA_NOT_ASSIGNED in class CL_ALV_TREE_BASE and method SET_ITEMS_FOR_COLUMN. The Reason being the data which was copied in the initial node display to mt_outtab is getting refreshed.
Can any one of you help me the reason for the table getting refreshed. Do i need to pass any data.
I am doing the following steps.
1. Create Container,
2. Create Tree Class object
3. Generate the Field Catalog.
4. Set table for first display " With empty internal table
5. Generate the Hierarchy
6. Call the Method Frontend Update.
Let me know if i had missed any steps in the process.
Thank you,
Regards,
Swaroop PatriOne reason for getting this error is using local defined tables for it_outtab parameter in the below code:
To get rid of the dump, define two distinct output tables globally: one is an empty table which you will pass to the below method, other one is your real output table whose size increases dependently.
CALL METHOD go_tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = ls_hier_header
CHANGING
it_outtab = gt_data_e "Empty table
it_fieldcatalog = gt_fcat_tree. -
How to change the colour of row in ALV depending on condition?
Hi All,
I want to change the color(from green to red )of perticular row in ALV depending on certain conditions like if amount in some field in row is more than 5000.
Can anybody please tell me how to do that?
expecting early reply.
Thanks in advance,
Rohini.Hi
Check this sample report
*& Report ZALVCOLOR *
REPORT ZALVCOLOR .
DATA : mara TYPE mara. " General Material Data
TYPE-POOLS: slis. " ALV Global types
FIELD-SYMBOLS :
<data> TYPE table. " Data to display
SELECT-OPTIONS :
s_matnr FOR mara-matnr. " Material number
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '50' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of lines to display'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
FIELD-SYMBOLS :
<field> TYPE ANY,
<field2> TYPE ANY,
<header> TYPE ANY,
<header2> TYPE ANY,
<lt_data> TYPE table. " Data read from DB
DATA:
lp_struct TYPE REF TO data,
lp_struct2 TYPE REF TO data,
lp_table TYPE REF TO data, " Pointer to dynamic table
lp_table2 TYPE REF TO data, " Pointer to dynamic table
ls_lvc_cat TYPE lvc_s_fcat,
lt_lvc_cat TYPE lvc_t_fcat. " Field catalog
* First column
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'MATNR'.
ls_lvc_cat-ref_table = 'MARA'.
APPEND ls_lvc_cat TO lt_lvc_cat.
* 2nd column
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'MAKTX'.
ls_lvc_cat-ref_table = 'MAKT'.
APPEND ls_lvc_cat TO lt_lvc_cat.
* 3rd column
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'MATKL'.
ls_lvc_cat-ref_table = 'MARA'.
APPEND ls_lvc_cat TO lt_lvc_cat.
* Create 1st internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_lvc_cat
IMPORTING ep_table = lp_table.
ASSIGN lp_table->* TO <lt_data>.
* Read data into 1st internal table
SELECT matnr maktx matkl
INTO TABLE <lt_data>
FROM v_matnr
UP TO p_max ROWS
WHERE matnr IN s_matnr.
* Create 2nd internal table
* Checkbox
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'CHECKBOX'.
APPEND ls_lvc_cat TO lt_lvc_cat.
* Table color
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'TABCOLOR'.
ls_lvc_cat-ref_table = 'CALENDAR_TYPE'.
ls_lvc_cat-ref_field = 'COLTAB'.
APPEND ls_lvc_cat TO lt_lvc_cat.
* Create 2nd internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_lvc_cat
IMPORTING ep_table = lp_table2.
ASSIGN lp_table2->* TO <data>.
* Create structure = structure of the 1st internal table
CREATE DATA lp_struct LIKE LINE OF <lt_data>.
ASSIGN lp_struct->* TO <header>.
* Create structure = structure of the 2nd internal table
CREATE DATA lp_struct2 LIKE LINE OF <data>.
ASSIGN lp_struct2->* TO <header2>.
* Move data from 1st internal table --> 2nd internal table
LOOP AT <lt_data> ASSIGNING <header>.
DESCRIBE TABLE lt_lvc_cat.
CLEAR <header2>.
* Fill the internal to display <data>
DO sy-tfill TIMES.
READ TABLE lt_lvc_cat INTO ls_lvc_cat INDEX sy-index.
* For each field of lt_lvc_cat.
ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header>
TO <field>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header2>
TO <field2>.
IF sy-subrc NE 0. EXIT .ENDIF.
<field2> = <field>.
ENDDO.
* Modify color
ASSIGN COMPONENT 'TABCOLOR' OF STRUCTURE <header2>
TO <field2>.
IF sy-subrc EQ 0.
PERFORM f_modify_color USING 'MAKTX' <field2>.
PERFORM f_modify_color USING 'MATKL' <field2>.
ENDIF.
APPEND <header2> TO <data> .
ENDLOOP.
ENDFORM. " f_read_data
* Form F_DISPLAY_DATA
FORM f_display_data.
* Macro definition
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-down = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv. " Field catalog
* Build Fieldcatalog - First column
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-ref_tabname = 'MARA'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO lt_fieldcat.
* Build Fieldcatalog - 2nd column
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-ref_tabname = 'MAKT'.
APPEND ls_fieldcat TO lt_fieldcat.
* Build Fieldcatalog - 3rd column
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATKL'.
ls_fieldcat-ref_tabname = 'MARA'.
APPEND ls_fieldcat TO lt_fieldcat.
* Layout
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-box_fieldname = 'CHECKBOX'.
ls_layout-coltab_fieldname = 'TABCOLOR'.
m_sort 'MATNR'. " Sort by creation date
* Display data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = <data>.
ENDFORM. " F_DISPLAY_DATA
* Form F_modify_color
FORM f_modify_color USING u_fieldname TYPE lvc_fname
ut_tabcolor TYPE table.
DATA:
l_rnd_value TYPE datatype-integer2,
ls_tabcolor TYPE lvc_s_scol.
* Random value
CALL FUNCTION 'RANDOM_I2'
EXPORTING
rnd_min = 0
rnd_max = 3
IMPORTING
rnd_value = l_rnd_value.
CLEAR ls_tabcolor.
ls_tabcolor-fname = u_fieldname.
CASE l_rnd_value.
WHEN 0.
ls_tabcolor-color-col = 1. " Blue.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 1.
ls_tabcolor-color-col = 3. " Yellow.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 2.
ls_tabcolor-color-col = 5. " Green.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 3.
ls_tabcolor-color-col = 6. " Red.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
ENDCASE.
INSERT ls_tabcolor INTO TABLE ut_tabcolor.
ENDFORM. " F_MODIFY_COLOR
Reward all helpfull answers
Regards
Pavan -
How to change header value dynamiclly in procedural alv report?
Hi experts,
I develop one report (using procedural alv ).I gave 3 input check boxes (ex : in 1st checkbox 10days in 2nd check box 20 days
in 3rd check box 30 days they entered like this in the input checkboxes in days 10,20,30.In o/p report 3 columns i maintained like this . Column1 column2 column 3
from 0 to 10 days from 11 to 20 days from 21 to 30 days.
I want to display alv report o/p like this in the respective columns.
For example they enter 15 25 35 (i/p)
o//p in alv report
Column1 column2 column 3
from 0 to 15 days from 16 to 25 days from 26 to 35 days.
i want to change days dynamically in alv header .Pls give me the code using procedural alv report.
If u want i will give u detail.pls help me in this.I assume the main issue is chaniging ALV header dynamically, isn't it? For this you need to use field seltext_m of fieldcatalog for particular column. So you can contruct header dynamically by string concatenation like
parameters: pa_1st(2) type n, "i.e. 15
pa_2nd(2) type n, "i.e 25
pa_3rd(2) type n. "i.e. 35
"first field
concatenate '0' 'to' pa_1st into it_fieldcatalog-seltext_m.
"next field
add 1 to pa_1st.
concatenate pa_1st 'to' pa_2nd into it_fieldcatalog-seltext_m.
"last field
add 1 to pa_2nd.
concatenate pa_2nd 'to' pa_3rd into it_fieldcatalog-seltext_m.
Refer [Sample ALV: Heading in ALV|http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm] for more information.
Regards
Marcin -
HOW TO CHANGE COLOR OF PARTICULAR CELL IN ALV
I HAVE DISPLAYED A REPORT IN ALV
I WANT TO CHANGE THE COLOR OF VBELN FIELD ON WHICH HOTSPOT IS ON?
HOW TO DO THIS?Hi Lovleen,
Check out the code
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display each row in a different *
*& colour *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) type c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
data: ld_color(1) type c.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
*Populate field with color attributes
loop at it_ekko into wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.
endform. " DATA_RETRIEVAL
Regards,
Chandru
Maybe you are looking for
-
Hi all , i want to display alv list with time field . if no data exists in that field its showing 00:00:00 , i have to show it blank. if i change time field as type c in my internal table its showing like this 121314, i need to display it 12:13:14 .
-
Even after consolidating, itunes library does not mirror music folder
i copied my itunes music folder from my old harddrive to my new computer. some of the songs in the library are not in the music folder. how could this be if i copied the folder? is there a way to make them exactly alike? is it even important for them
-
PHD Clients default Save dialogs point to server if available
10.6.x PHD clients seem to default to the SERVER home folder (if it's available as a result of syncing or being on the LAN) This is quite a nuisance, as a user might be saving a file and then sleeping and taking their laptop home only to find it's on
-
IPod nano stops reformatting with iPod update!
Ok, My ipod got the dreaded grey folder screen when I tried to update it's software. I uninstalled everything iPod and reinstalled the stuff with the CD that came with it. It said it needed to be formatted so I click Yes. during the process, it just
-
Using Function Keys and Alt Key in Flash Video
I am attempting to create an eLearning video, which includes instructions, a "try it yourself" section, and then a quiz. Our software that I am trying to simulate uses Function keys (F6 to bring up specific windows) as well as shortcut keys (Alt-S t