How to change Rowid of a row.
Hello All,
I want to change a rowid of a row when somebody updates it. I put the table in partition. Table is having 47 fields and I have give "PARTITION BY HASH" on 16 fields. I only updates this fiels who are n partition so how many percent chance are there for the rowid to get changed.
If you have an application which depends on database-specific functionality in the source database (ROWID changing when data is updated), I would suggest that you're better off writing database-specific functionality in the target database to accomplish the same business goal than to try to coerce the same functionality from the target database. If you aren't using partitioning elsewhere, for example, the extra cost of licensing this option in the hope of often causing a ROWID to change would be hard to justify.
Can you explain the business purpose that your Centura SQLBase code was accomplishing and how changing ROWID's factored in? There may be a much simpler Oracle solution.
If you are really wedded to ROWID's changing, you may be able to build index-organized tables rather than heap organized tables, but be sure that you understand the implications of this sort of approach.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
How to find rowid of locked rows?
Hello All,
I have the "before update trigger" I want to know the rowid of all the locked row before update so that I dont try to update the same row which is locked by some other user. In Ask Tom forum I have seen how to know the rowid of locked row, but it will work only when Some body got hanged in that Perticular row while trying to update it. I dont want the User to get hanged, for that I want to user before update trigger. Help me.I believe this is a duplicate of another question in this forum
How to find out rowid of locked row
which I answered.
Justin -
How To find rowid of Locked row.
Hello,
can somebody tell me the "select statement", how to find the rowid of a locked row, which is locked by "select for update" and also the rowid of a row which is going to be updated by "update statement".check out v$session and the following columns.
It is documented here
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3171.htm#1122127
ROW_WAIT_OBJ#
NUMBER
Object ID for the table containing the ROWID specified in ROW_WAIT_ROW#
ROW_WAIT_FILE#
NUMBER
Identifier for the datafile containing the ROWID specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
ROW_WAIT_BLOCK#
NUMBER
Identifier for the block containing the ROWID specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
ROW_WAIT_ROW#
NUMBER
The current ROWID being locked. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1. -
How to change the number displaying rows in a table
Hi all,
i have a table for resources in Debrief Work order (Standard Screen), we need to change the default displaying rows. inistially it displayed 3 empty rows.
i tried to change the Records Displayed for the table but it did not affect.
also it is possible to change the "Add 3 rows" button in the table to add for example 5 rows instead?
any idea?
Regards,
Mahdi ChararaHi,
Through personalization we can do.On standared page top right u will find personalization link.click on the clink next expand all there find apporiate table .Here u will fine reorder button set as u want display and save. then u can see the change.For add row functionality u need to extend the co. -
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 background color of row of a table in a panel table
hi! im trouble right now, somebody help me. i have a matrix of row and column, panel row and panel table in jsp. my problem is how can i change the background color of a row once it clicked. i have row in table which have panel table with panel column and panel row.
i have already work for it but i only change the background color once i clicked is the first row and first column then the rest row and column is not working..pls.. give me sample code for it..thnx a lot!!!
Thnank's,
froiletOk! I have 2 jsp, the input jsp and display.jsp! Once i input value on input.jsp, it will display on display.jsp. I have also my javascript named updateBin.js. Now, how can i update each row once i clicked it... the succeeding rows and columns..hope u help me with this..here is my code:
Display.jsp
<html:html locale="true">
<head>
<html:base/><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Strip Map Loader</title><script type="text/javascript" src="js/updateBin.js"></script>
</head>
<%
int intRow = Integer.parseInt(request.getParameter("intRows"));
int intColumn = Integer.parseInt(request.getParameter("intColumns"));
int intPanelRow = Integer.parseInt(request.getParameter("intPanelRows"));
int intPanelColumn = Integer.parseInt(request.getParameter("intPanelColumns"));
%>
<BODY bgcolor="#33b9ec" leftmargin="50%">
<b>Strip ID: </b><font color="red" face="arial"><b><bean:write name="strStripID" scope="request" /></b></font>
<br><br>
<font size="3" face="tahoma"><b>Bins Updater Tool:</b></font>
<table border="1" width="365px" bgcolor="#1ea6f7" height="15">
<tr>
<td valign="top" align="center">
<table><tr><td><font size="2">Select Bin Type:</font></td>
<td><select id="binType" onchange="updateBin()" size="1">
<OPTION></OPTION>
<OPTION value="green">Good Bin</OPTION>
<OPTION value="red">Reject Bin</OPTION>
</select></td></tr></table>
</td>
</tr>
</table>
<table id="tbl" align="center" border="1" cellspacing="3" cellpadding="5" bgcolor="#CC9900">
<tr>
<td>
<%for (int pnlrows=1; pnlrows<=intPanelRow; pnlrows++){%>
<table id="table" width="100%" border="1" bgcolor="#CC9900" cellspacing="7" cellpadding="0" align="center">
<tr>
<%for(int pnlcols=0; pnlcols<intPanelColumn;pnlcols++){%>
<td>
<%for (int rows=1;rows<=intRow; rows++){%>
<table cellspacing="5" width="100px" align="center" bgcolor="#CC9900">
<tr>
<td>
<%for(int cols=1; cols<intColumn; cols++){%>
</td>
<td id="col" bgcolor="#008000" align="center" ondblclick="changeCol()"> X </td>
<%}%>
<td id="row" bgcolor="#008000" align="center" ondblclick="changeRow()"> X </td>
<td></td>
<%}%>
</tr>
</table>
<%}%>
</td>
</tr>
</table>
<%}%>
</td>
</tr>
</table>
and this is my javascript code:
function updateBin()
var binType=document.getElementById("binType")
if(binType.value == "green")
[binType.selectedIndex].value
//binType = changeR();
//alert('Good Bin Selected');
if(binType.value == "red")
[binType.selectedIndex].value
//binType = changeC();
//alert('Reject Bin Selected');
if(binType.value == "")
alert('Please select only on the category!')
function changeRow()
if(binType.value=="green")
x=document.getElementById('row').style.background="green";
alert('Updated!')
if(binType.value=="red")
x=document.getElementById('row').style.background="red";
//alert('Reject Bin Updated!')
function changeCol()
if(binType.value=="green")
x=document.getElementById('col').style.background="green";
alert('Updated!')
if(binType.value=="red")
x=document.getElementById('col').style.background="red";
//alert('Reject Bin Updated!')
this code only updates the first row and column..but the succeeding panel row and panel column can't update...what will i do? theres something wrong in my javascript or in my jsp...pls help me......thanx.....in advance!! -
How to change select upto 1 rows into read statement
Dear all,
Table A contains many dates for given salesdocumentnumber and
Table B contains many dates for given salesdocumentnumber .
Table A and Table B contains same entries .II need maxdate for all salesdocument in Table A comparing Table A and Table B
TableA_alias was sorted and deleted adjacent duplicates.
loop at TableA_alias
select pdate into variable_1 from table Table_A
UP TO 1 ROWS order by pdate descending
where
it_pdate-salesdoc = TableA_alias-salesdoc and
it_pdate-salesitem = TableA_alias-salesitem and
it_pdate-sline = TableA_alias-sline .
select pdate into variable_2 from table Table_B
UP TO 1 ROWS order by pdate descending
where
it_pdate-salesdoc = TableA_alias-salesdoc and
it_pdate-salesitem = TableA_alias-salesitem and
it_pdate-sline = TableA_alias-sline .
if variable_1 > variable_2.
TableA_alias-pdate = variable_1.
else.
TableA_alias-pdate = variable_2.
endif.
endloop.
Could anyone help me to make this code more performance tuned by using Read statement
Regards
Bala
Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting - post locked
Edited by: Rob Burbank on Nov 16, 2009 9:19 AMhi Siegfried,
i need to make this code ,performance wise more optimized. could you please suggest how can i improve this
loop at it_pdate_temp into wa_pdate_temp.
select /bic/zpviewdt from /BIC/AZVFOSDP100 into variable_1
UP TO 1 ROWS
where
doc_number = wa_pdate_temp-salesdoc and
s_ord_item = wa_pdate_temp-salesitem and
sched_line = wa_pdate_temp-sline
order by /bic/zpviewdt descending .
endselect.
select /bic/zpviewdt from /bic/azvfosp1w00 into variable_2
UP TO 1 ROWS
where
doc_number = wa_pdate_temp-salesdoc and
s_ord_item = wa_pdate_temp-salesitem and
sched_line = wa_pdate_temp-sline
order by /bic/zpviewdt descending .
endselect.
if variable_1 > variable_2.
wa_pdate_temp-pdate = variable_1.
else.
wa_pdate_temp-pdate = variable_2.
endif.
endloop. -
How to change Default number of rows displayed in a Briefing Book
Hi,
We have a requirement to deliver a dashboard containing 7 dashboard pages to the business users.
To achieve this, I have created a briefing book by adding all the required dahboard pages and scheduled an agent to deliver the briefing book in PDF format. However, the briefing book delivered by the agent shows only 25 rows for all the analysis (reports) included in the dashboard pages.
I have already made the following settings:
1. At the report level, edited the table view property to show 150 Rows Per page.
2. At the dashboard page level, edited the PDF and Print properties to Print All Rows.
3. Edited the instanceconfig.xml file to include the following tag under <Table> tag: <DefaultRowsDisplayedInDelivery>15000</DefaultRowsDisplayedInDelivery>
Please advise if there is any setting which can help in increasing the default number of rows in a Briefing Book (OBIEE 11.1.1.3).
Thanks & Regards,
SumitHi,
This is a bug in 11.1.1.3
Bug 12671370 - BRIEFING BOOKS DO NOT SHOW ALL ROWS
As a workaround, you may want to click on the "Display Maximum(500) rows per page" button on the dashboard page before you download to Briefing books.This will work for reports with less than 500 rows.
Rgds,
Dpka -
Hi guys, I am struggling to find out how to change the number of rows on a contact sheet on Iphoto , i have selected my photos and i want it to print 6 photos on each page however I am not able to do it. Please help me out, im a Art student and i need to submit my contact sheets for an assignment Thanks in advance guys !!!!!
I don't think you can do that with the Contact Sheet layout. If you have Pages or a 3rd party image editor that supports layers you can do what you want. Or try the demo version of OmniGraffle for Mac It will run fully operational for 14 days.
-
Ow to change the color of row in Datagrid view
How to change the color of row in Datagridview. Eg. Am getting a remote server services by get-service. I want to change the color of services that are not running. Am using the below function to get the services.
Please help me it would be useful
function Get-SystemInfo
$array = New-Object System.Collections.ArrayList
$Script:SystemInfo = Get-WmiObject win32_service -ComputerName $textbox1Computername.text | select DisplayName,Name,state,status,startmode | Sort-Object state,startmode,DisplayName
$array.AddRange($SystemInfo)
$datagridview1.DataSource = $arrayThanks.
Can you simply my code for Memory usage to Show Computer name, TotalMem,UsedMem,FreeMem, used Mem %, Free Mem %
Am using the below code :
$buttonMemory_Click= {
if($textbox1Computername.text -ne "")
$script:Object =@()
$script:array = New-Object System.Collections.ArrayList
$Object =@()
$SystemInfo = Get-WmiObject -Class Win32_OperatingSystem -computername $textbox1Computername.text | Select-Object csname, TotalVisibleMemorySize, FreePhysicalMemory
$TotalRAM = $SystemInfo.TotalVisibleMemorySize/1MB
$FreeRAM = $SystemInfo.FreePhysicalMemory/1MB
$UsedRAM = $TotalRAM - $FreeRAM
$RAMPercentFree = ($FreeRAM / $TotalRAM) * 100
$RAMUsedPercent = (100 * $UsedRAM) / $TotalRAM
$TotalRAM = [Math]::Round($TotalRAM, 2)
$FreeRAM = [Math]::Round($FreeRAM, 2)
$UsedRAM = [Math]::Round($UsedRAM, 2)
$RAMPercentFree = [Math]::Round($RAMPercentFree, 2)
$RAMUsedPercent = [Math]::Round($RAMUsedPercent, 2)
$TotalVirtualMemorySize=[Math]::Round($SystemInfo.TotalVirtualMemorySize/1MB, 3)
$FreeVirtualMemory=[Math]::Round($SystemInfo.FreeVirtualMemory/1MB, 3)
$FreeSpaceInPagingFiles=[Math]::Round($SystemInfo.FreeSpaceInPagingFiles/1MB, 3)
$NP=$SystemInfo.NumberofProcesses
$NU=$SystemInfo.NumberOfUsers
$Object += New-Object PSObject -Property @{
#ComputerName = $textbox1Computername.text
TotalRAMGB = $TotalRAM;
FreeRAMGB = $FreeRAM;
UsedRAMGB = $UsedRAM;
FreeRAMPercentage =$RAMPercentFree;
UsedRAMPercentage =$RAMUsedPercent; -
How to change the default color of the selected row
hi all,
I need to know how to change the default color(yellow) of the selected row in a table component.whether i need to change anything in the stylesheet.If so, where should i make the changes in the stylesheet.
thanks and regards,
rpkThe chart colors are being referred to *'palette.cxml'* file in these directories
BI_HOME\web\app\res\s_oracle10\chartsupport
BI_HOME\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\chartsupport
you can change to your custom colors.
Restart OC4J and PS to make the new ones work..
Regards,
Raghu -
How to change Number of Rows in a Tabular Form report page?
Hi
I am working with a tabular form to create an attendance sheet for a school using Oracle Application Express 3.0.1.00.12. Whenever I change the Number of Rows value from 10 to 1000 in the Layout and Pagination section of the report page, the SUBMIT button is not working and it is unable to process at that stage. How can I change the valu so that I can see all the rows in a single page, make changes to all rows and submit the page rightaway. Please help me.
Thanks,
Chak
Edited by: user520137 on Jan 12, 2010 12:04 PMHi
I am working with a tabular form to create an attendance sheet for a school using Oracle Application Express 3.0.1.00.12. Whenever I change the Number of Rows value from 10 to 1000 in the Layout and Pagination section of the report page, the SUBMIT button is not working and it is unable to process at that stage. How can I change the valu so that I can see all the rows in a single page, make changes to all rows and submit the page rightaway. Please help me.
Thanks,
Chak
Edited by: user520137 on Jan 12, 2010 12:04 PM -
How to change the background color of a single row
Hi OTN,
I am using JDeveloper 11.1.1.2 with ADF faces in view layer.My issue is How to change the background color of a single row in af:table ?.How to highlight ADF table row based on column value?
Found by searching -
How to change a color for a row in ALV grid display
Hi,
how to change a color for a row in ALV grid display based on a condition.Any sample code plzHello Ramya,
Did you check in [SCN|How to color a row of alv grid]
Thanks! -
How to change the color of specific row in ALV tree
Hi,
I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
Pls suggest...hi
hope this code will help you.
Reward if help.
REPORT zsharad_test1.
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_LIST_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
Maybe you are looking for
-
How to search for a file at application server?
Hi, I need to choose one file for further processing from the directory, located into 'WORK' directory at application server. As far as I see, class CL_GUI_FRONTEND_SERVICES and FILE_OPEN_DIALOG woudn't help me - it's a 'FRONTEND_SERVICES'.... and wo
-
BAPI_PO_RELEASE not releasing PO's
Dear All, In my program am calling BAPI_PO_RELEASE to realse PO's which are infact created by BAPI_PO_CREATE from the same program. Here I am really puzzled by the fact that all PO's are not released as expected. Strangest Part is when
-
External HD and storage ?n
Hi all. i have a question about storing some of my projects and sample librarys on DVD. the situation is that iv been on the road for the last 6 months and will continue to be so for probably the next 4 months. i tried to bring as little as i possibl
-
What's happening with cold fusion?!
first, this very page is throwing js errors in both ie8 and firefox 24.0 , i can't reply to any posts then, with all this flurry of security breaches on gov websites running cold fusion, do we have a comprehensive white paper showing how to plug all
-
Hi, All, What means Industry Key in the vendor master data? How to use this? Where and when to use this functionality? Thanks,