Read 100 Question OMR Sheet and Show result
Hello All,
I got a Project from:
http://www.codeproject.com/Articles/451169/Csharp-Optical-Marks-Recognition-OMR-Engine-1-0?msg=4386396#xx4386396xx
thanks to umar.techBOY.
I changed it to my requirment as 100 Questions with 4 Options in A4 size Paper.
Its working fine as far as read registration is concern.
The problem with the read Answer Function.
The code for reading Answer are as follows:
private void button7_Click(object sender, EventArgs e)
//ContrastCorrection cc = new ContrastCorrection();
//panel1.BackgroundImage = cc.Apply((Bitmap)panel1.BackgroundImage);
panel1.Invalidate(); Application.DoEvents();
showTimeStamp("Slicing Started");
Rectangle[] Blocks = new Rectangle[]
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock1),
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock2),
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock3),
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock4)
List<Bitmap[]> bmps = new List<Bitmap[]>();
for (int i = 0; i < 4; i++)
bmps.Add(SliceOMarkBlock(panel1.BackgroundImage, Blocks[i], 25));
showTimeStamp("Slicing ended");
string ans = "";
foreach (Bitmap[] blk in bmps)
foreach (Bitmap line in blk)
ans += rateSlice(line,25) + ",";
ans += "\r\n";
panel1.Invalidate();
Application.DoEvents();
MessageBox.Show(ans);
private int rateSlice(Bitmap slice, int OMCount)
Rectangle[] cropRects = new Rectangle[OMCount];
Bitmap[] marks = new Bitmap[OMCount];
for (int i = 0; i < OMCount; i++)
cropRects[i] = new Rectangle(i * slice.Width / OMCount, 0, slice.Width / OMCount, slice.Height);
int crsr = 0;
foreach (Rectangle cropRect in cropRects)
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using (Graphics g = Graphics.FromImage(target))
g.DrawImage(slice, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
marks[crsr] = target;
crsr++;
long maxPD = (slice.Width / OMCount) * slice.Height * 255;
List<long> inks = new List<long>();
List<long> fullInks = new List<long>();
foreach (Bitmap mark in marks)
inks.Add(InkDarkness(mark));
fullInks.Add(inks[inks.Count - 1]);
int indofMx = -1,indofMn = -1;
long maxD = 0, minD = 0; ;
for (int i = 0; i < OMCount; i++)
if (inks[i] > maxD)
maxD = inks[i];
indofMx = i;
minD = maxD;
for (int i = 0; i < OMCount; i++)
if (inks[i] < minD)
minD = inks[i];
indofMn = i;
for (int i = 0; i < OMCount; i++)
inks[i] -= minD - 1;
bool parallelExist = false, spe = false, tpe = false, fpe = false;
for (int i = 0; i < OMCount; i++)
if (i != indofMx)
if ((double)fullInks[indofMx] / fullInks[i] <= 2)
if (tpe) fpe = true;
if (spe) tpe = true;
if (parallelExist) spe = true;
parallelExist = true;
int negScore = parallelExist ? -1 : 0;
negScore = spe ? -2 : negScore;
negScore = tpe ? -3 : negScore;
negScore = fpe ? -4 : negScore;
if (!parallelExist)
return indofMx + 1;
bool atleastOneUnfilled = false;
for (int i = 0; i < OMCount; i++)
if (i != indofMx)
if ((double)fullInks[indofMx] / fullInks[i] >= 3)
atleastOneUnfilled = true;
if (atleastOneUnfilled)
return negScore;
return 0;
private long InkDarkness(Bitmap OMark)
int darkestC = 255, lightestC = 0;
UnmanagedImage mark = UnmanagedImage.FromManagedImage(OMark);
for (int y = 0; y < OMark.Height; y++)
for (int x = 0; x < OMark.Width; x++)
Color c = mark.GetPixel(x, y);
if (((c.R + c.G + c.B) / 3) > lightestC)
lightestC = ((c.R + c.G + c.B) / 3);
if (((c.R + c.G + c.B) / 3) < darkestC)
darkestC = ((c.R + c.G + c.B) / 3);
int dc = 0;
for (int y = 0; y < OMark.Height; y++)
for (int x = 0; x < OMark.Width; x++)
Color c = mark.GetPixel(x, y);
if (((c.R + c.G + c.B) / 3) < (lightestC + darkestC) / 2)
{ dc += 255; }
return dc;
private Bitmap[] SliceOMarkBlock(System.Drawing.Image fullSheet, Rectangle slicer, int slices)
List<Rectangle> cropRects = new List<Rectangle>();
Bitmap[] bmps = new Bitmap[slices];
for (int i = 0; i < slices; i++)
cropRects.Add(new Rectangle(slicer.X, slicer.Y + (slicer.Height / slices) * i, slicer.Width, slicer.Height/slices));
Bitmap src = (Bitmap)fullSheet;
int crsr = 0;
foreach (Rectangle cropRect in cropRects)
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using (Graphics g = Graphics.FromImage(target))
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
bmps[crsr] = target;
crsr++;
return bmps;
throw new Exception("Couldn't slice");
Its Showing result like ---> -2,-3,-2,-4,-4,-4 and so on up to 100 Questions
is there any one Help me for this.
It looks like you've already engaged the author on the CodeProject site and they have attempted to help you. It would be best to finish the discussion there. I'll move this to the C# forums (since it is C# code) but it may get moved again to
Off-Topic since the issue revolves around this particular CodeProject article (and since the author has already attempted to help).
Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
Similar Messages
-
Problem with store ResultSet and show result in table
Hi, I'm kind of new in ADF, I need to store ResultSet and show result in table-component. I have two problems:
1) I get my ResultSet by calling callStoredProcedure(...) and this returns actually ref_cursor as ResultSet.
When I try to println() contains of this result set in this method - it works OK (commented part),
but when I want to println() somewhere else (eg. in retrieveRefCursor() method) it doesn't work.
The problem is that the scrollability of the ResultSet is lost - it becomes a TYPE_FORWARD_ONLY ResultSet.
Is there any way to store data from ref_cursor for a long time?
2) My second problem is "store any result set and show this data in table". I have tried use method storeNewResultSet() but
without result (table contains only "No rows yet" and everything seems to be OK - no exception, no warning, no error...).
I have tried to call this method with ResultSet from select on dbs (without resultSet as ref_cursor ) - no result with createRowFromResultSet(),
storeNewResultSet(), setUserDataForCollection()...
I've tried a lot of ways to do this, but it doesn't work. I really don't know how to make it so it can work.
Thanks for your help.
ADF BC, JDev 11.1.1.0
This is my code from ViewObjectImpl
package tp.model ;
import com.sun.jmx.mbeanserver.MetaData ;
import java.sql.CallableStatement ;
import java.sql.Connection ;
import java.sql.PreparedStatement ;
import java.sql.ResultSet ;
import java.sql.ResultSetMetaData ;
import java.sql.SQLException ;
import java.sql.Statement ;
import java.sql.Types ;
import oracle.jbo.JboException ;
import oracle.jbo.server.SQLBuilder ;
import oracle.jbo.server.ViewObjectImpl ;
import oracle.jbo.server.ViewRowImpl ;
import oracle.jbo.server.ViewRowSetImpl ;
import oracle.jdbc.OracleCallableStatement ;
import oracle.jdbc.OracleConnection ;
import oracle.jdbc.OracleTypes ;
public class Profiles1ViewImpl extends ViewObjectImpl {
private static final String SQL_STM = "begin Pkg_profile.get_profile_list(?,?,?,?);end;" ;
public Profiles1ViewImpl () {
/* 0. */
protected void create () {
getViewDef ().setQuery ( null ) ;
getViewDef ().setSelectClause ( null ) ;
setQuery ( null ) ;
public Connection getCurrentConnection () throws SQLException {
// Note that we never execute this statement, so no commit really happens
Connection conn = null ;
PreparedStatement st = getDBTransaction ().createPreparedStatement ( "commit" , 1 ) ;
conn = st.getConnection () ;
st.close () ;
return conn ;
/* 1. */
protected void executeQueryForCollection ( Object qc , Object[] params , int numUserParams ) {
storeNewResultSet ( qc , retrieveRefCursor ( qc , params ) ) ;
// callStoredProcedure ( qc , SQL_STM ) ;
super.executeQueryForCollection ( qc , params , numUserParams ) ;
/* 2. */
private ResultSet retrieveRefCursor ( Object qc , Object[] params ) {
ResultSet rs = null ;
rs = callStoredProcedure ( qc , SQL_STM ) ;
return rs ;
/* 3. */
public ResultSet callStoredProcedure ( Object qc , String stmt ) {
CallableStatement st = null ;
ResultSet refCurResultSet = null ;
try {
st = getDBTransaction ().createCallableStatement ( stmt , 0 ) ; // call
st.setObject ( 1 , 571 ) ; //set id of my record to 571
st.registerOutParameter ( 2 , OracleTypes.CURSOR ) ; // my ref_cursor
st.registerOutParameter ( 3 , Types.NUMERIC ) ;
st.registerOutParameter ( 4 , Types.VARCHAR ) ;
st.execute () ; //executeUpdate
System.out.println ( "Numeric " + st.getObject ( 3 ) ) ;
System.out.println ( "Varchar " + st.getObject ( 4 ) ) ;
refCurResultSet = ( ResultSet ) st.getObject ( 2 ) ; //set Cursoru to ResultSet
// setUserDataForCollection(qc, refCurResultSet); //don't work
// createRowFromResultSet ( qc , refCurResultSet ) ; //don't work
/* this works but only one-time call - so my resultSet(cursor) really have a data
while ( refCurResultSet.next () ) {
String nameProfile = refCurResultSet.getString ( 2 ) ;
System.out.println ( "Name profile: " + nameProfile ) ;
return refCurResultSet ;
} catch ( SQLException e ) {
System.out.println ( "sql ex " + e ) ;
throw new JboException ( e ) ;
} finally {
if ( st != null ) {
try {
st.close () ; // 7. Close the statement
} catch ( SQLException e ) {
System.out.println ( "sql exx2 " + e ) ;
/* 4. Store a new result set in the query-collection-private user-data context */
private void storeNewResultSet ( Object qc , ResultSet rs ) {
ResultSet existingRs = getResultSet ( qc ) ;
// If this query collection is getting reused, close out any previous rowset
if ( existingRs != null ) {
try {
existingRs.close () ;
} catch ( SQLException s ) {
System.out.println ( "sql err " + s ) ;
setUserDataForCollection ( qc , rs ) ; //should store my result set
hasNextForCollection ( qc ) ; // Prime the pump with the first row.
/* 5. Retrieve the result set wrapper from the query-collection user-data */
private ResultSet getResultSet ( Object qc ) {
return ( ResultSet ) getUserDataForCollection ( qc ) ;
// createRowFromResultSet - overridden for custom java data source support - also doesn't work
protected ViewRowImpl createRowFromResultSet ( Object qc , ResultSet resultSet ) {
ViewRowImpl value = super.createRowFromResultSet ( qc , resultSet ) ;
return value ;
}Hi I have the same problem like you ...
My SQL Definition:
CREATE OR REPLACE TYPE RMSPRD.NB_TAB_STOREDATA is table of NB_STOREDATA_REC
CREATE OR REPLACE TYPE RMSPRD.NB_STOREDATA_REC AS OBJECT (
v_title VARCHAR2(100),
v_store VARCHAR2(50),
v_sales NUMBER(20,4),
v_cost NUMBER(20,4),
v_units NUMBER(12,4),
v_margin NUMBER(6,2),
v_ly_sales NUMBER(20,4),
v_ly_cost NUMBER(20,4),
v_ly_units NUMBER(12,4),
v_ly_margin NUMBER(6,2),
v_sales_variance NUMBER(6,2)
CREATE OR REPLACE PACKAGE RMSPRD.NB_SALES_DATA
AS
v_sales_format_tab nb_tab_storedata;
FUNCTION sales_data_by_format_gen (
key_value IN VARCHAR2,
l_to_date IN DATE DEFAULT SYSDATE-1,
l_from_date IN DATE DEFAULT TRUNC (SYSDATE, 'YYYY')
RETURN nb_tab_storedata;
I have a PLSQL function .. that will return table ..
when i use this in sql developer it is working fine....
select * from table (NB_SALES_DATA.sales_data_by_format_gen('TSC',
'05-Aug-2012',
'01-Aug-2012') )
it returning table format record.
I am not able to call from VO object. ...
Hope you can help me .. please tell me step by step process...
protected Object callStoredFunction(int sqlReturnType, String stmt,
Object[] bindVars) {
System.out.println("--> 1");
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement("begin ? := " +"NB_SALES_DATA.sales_data_by_format_gen('TSC','05-Aug-2012','01-Aug-2012') ; end;", 0);
System.out.println("--> 2");
st.executeUpdate();
System.out.println("--> 3");
return st.getObject(1);
catch (SQLException e) {
e.printStackTrace();
throw new JboException(e); -
Read data from excel sheet and then perform the required operations.
Hi all
I need to write a procedure which can read data from excel sheet.I have excel sheet in which i have to options one is modification and other is addition.so if it reads modification then i need to read the concerned table name then check its availability in pl-sql datbase.If table exists then reading the realated column in that row to fire the querry. The excel sheet is saved in local disk c.
can anybody help me with this.How i need to start specialy to read the data from excel sheet saved in local disk c.
Edited by: user13334062 on Jun 30, 2010 3:45 AMHi
If you can convert the excel to a csv format, then it can be simply query from DB Creating Oracle External Tables. Best part is that you may still change the CSV using EXCEL.
Following action Points can be adopt;
*1. Convert Excel File to a csv. File Save as CSV*
*2. Create Oracle Directory* ( This has to be the location of your excel file )
SQL> Create directory mydir as 'C:\testdb'; --- "testdb" is the location folder in win for your excel sheet.
*3. Create the External Table*
SQL> create table my_ext_tab (
Field1 Datatype,
Field2 Datatype,
Field3 Datatype,
Field4 Datatype,
Field5 Datatype
Organization external
(type oracle_loader default directory mydir
access parameters (records delimited by newline fields terminated by ',')
location ('my_ext_tab.csv'))
reject limit 100;
*4. Now you can query the table "my_ext_tab"*
Select * from "my_ext_tab";
Please avoid the reformat the data column inside the spreadsheet (CSV). -
Read contents of Pages library and show in custom webpart
Hi,
How to read the contents of "Pages" library (Published pages and custom created pages only and not reading OOB pages)?
I have a publishing site, in which I need to read the "Title" and URL" of the pages which are created by users and show in a custom webpart. If a new page is published, that page data should be added to the webpart.
Is it possible to achieve this? I know of Content Query webpart, but I need to custom create a custom webpart with custom styling. Is it possible to use the logic of content query webpart in a custom visual webpart? How to achieve this programmatically?
ThanksThe process in 2013 is essentially the same as it was in 2010. The only difference is that you don't have to manually add additional fields to the datafields list in the .webpart file. But the .XSL customization is identical. That's why
you won't find many articles on how to do it in 2013. It was already covered in 2010 and hasn't changed. Here is one example from 2013.
http://sp2013.blogspot.com/2012/09/content-query-and-metadata-driven.html
Paul Stork SharePoint Server MVP
Principal Architect: Blue Chip Consulting Group
Blog: http://dontpapanic.com/blog
Twitter: Follow @pstork
Please remember to mark your question as "answered" if this solves your problem. -
Compare two .txt files and show result
HI
Could anybody show me how to compare two text files and show the result.
i.e.
textfile1.txt
harry.denmark
karry.sweden
textfile2.txt
harry.denmark
karry.sweden
marry.usa
Compare
result=
marry.usa
The text files I want to compare are how ever much larger than this example. (up to 2-3.000 words)
anybody ??
Sincerly
PederHI & thanks for reply
I know almost nothing about java so could you or anybody please show me the code to do this? Or is it perhaps too large or difficult a code?
I know how to compile a .java file and run it in prompt :-) and thats about it (almost)
I offcourse understand if its too much to ask for :-) -
Function/Procedure help - just want to build simple query and show results
I'd like a simple "histogram" function - perhaps there is one built-in I'm not aware of. I just want to count discrete values of a column. So I'm constantly writing queries of the form:
select column_name, count(*)
from table_name
group by column_name
order by column_name;
and I'm trying to write a function that will allow me to just type:
execute whatever(column_name, table_name)
or select whatever(column_name, table_name) from ?
and get the equivalent results from the query above.
How do you, or can you, write a procedure to take column/table names as inputs, substitue them into a query, execute the query and just display the results of that query? As I'm trying to figure out how to do this via google search, I keep going down rabbit holes of creating temporary tables/data types/records/refcursors etc. and I can't get any of it to compile. I'm not a DBA or SQL expert, so I'm hoping there's a simple way to accomplish this (without having to store and then process the "results" one row at a time)If I understand the requirement correctly, a simple pipelined function will do it:
Dynamic
GROUP_VALUE NUM_RECS
10 1
20 2
30 6
40 1
50 45
60 5
70 1
80 34
90 3
100 6
110 2
1
12 rows selected.
1 SELECT *
2* FROM TABLE (Gen_Counts.Group_Count ('EMPLOYEES', 'DEPARTMENT_ID'))
Static
DEPARTMENT_ID COUNT(*)
10 1
20 2
30 6
40 1
50 45
60 5
70 1
80 34
90 3
100 6
110 2
1
12 rows selected.
1 SELECT department_id, Count(*)
2 FROM employees
3 GROUP BY department_id
4* ORDER BY 1The types and package code is:
CREATE OR REPLACE TYPE group_count_type IS OBJECT
(group_value VARCHAR2(4000), num_recs NUMBER);
CREATE OR REPLACE TYPE group_count_list_type IS TABLE OF group_count_type;
CREATE OR REPLACE PACKAGE Gen_Counts IS
FUNCTION Group_Count (p_tab_name VARCHAR2, p_col_name VARCHAR2) RETURN group_count_list_type PIPELINED;
END Gen_Counts;
CREATE OR REPLACE PACKAGE BODY Gen_Counts IS
FUNCTION Group_Count (p_tab_name VARCHAR2, p_col_name VARCHAR2) RETURN group_count_list_type PIPELINED IS
l_cur SYS_REFCURSOR;
l_rec_list group_count_list_type;
l_cur_str VARCHAR2(1000) := 'SELECT group_count_type (' || p_col_name || ', Count(*)) FROM ' || p_tab_name ||
' GROUP BY ' || p_col_name || ' ORDER BY ' || p_col_name;
BEGIN
OPEN l_cur FOR l_cur_str;
DBMS_Output.Put_Line (l_cur_str);
LOOP
FETCH l_cur BULK COLLECT
INTO l_rec_list LIMIT 1000;
EXIT WHEN l_rec_list.COUNT = 0;
FOR i IN 1..l_rec_list.COUNT LOOP
PIPE ROW (group_count_type (l_rec_list(i).group_value, l_rec_list(i).num_recs));
END LOOP;
END LOOP;
END Group_Count;
END Gen_Counts;
/Edited by: BrendanP on 06-Sep-2012 07:18
Just to be clear - I'm not saying it's a great idea to do that, just that's a way of doing it technically. I'd just use the static way myself. -
Counting files in a folder and showing results in an alert window.
Hello all.
I would like to get the script to count the number of files in a selected folder.
I have a UI where there are browse, ok and cancel buttons.
I wanted the OK button to show the number of jpeg files in the selected folder. If no folder is selected, and the OK button is pressed, it would prompt the user to select a folder before pressing the OK button.
Thanks!all you need to learn scripting is in the "JavaScript Tools Guide", you're making some progress but reading that and following the samples will make things clear and speed the learning proccess up.
if you look at your code there's only one function, it is called when the Browse button is clicked. See how it is constructed and write another similar function for the Ok button, in there read the contents of the label box and create a folder with that path, then call the function to read the files.
dlg.Panel1.okBtn.onClick = function (){
selectedFolder = new Folder(decodeURI(dlg.Panel1.Path.text));
if (selectedFolder.exists)
doSomething (selectedFolder);
else
alert("select a folder first...");
dlg.center(); //center dialog box on screen
dlg.show(); //show dialog box
function doSomething(folder)
files = folder.getFiles();
alert(files.length + " Files in selected Folder");
alert(files); -
How do i read a question in javacc and be able to identify key tokens
hello everyone....
I need help. I am still new with javacc, i am trying to generate a parser that will accept a question and be able to recognise the keywords and the askword from the question. e.g a question like "what is HIV" . it is suppose to get "what" as the askword and "HIV" as the key
another example: "what are arv drug" "what" as the askword and "arv drug" as the key
below is the code for what i have done so far.... thanx in advance
Code:
PARSER_BEGIN(SMS_QUERY)
import java.io.StringReader;
public class SMS_QUERY {
public static void main(String args[]) throws ParseException{
SMS_QUESTION q = new SMS_QUESTION(System.in);
q.QUESTION();
System.out.println(q);
PARSER_END(SMS_QUERY)
SKIP :
| "\t"
| "\n"
| "\r"
void SMS_QUESTION() : {}
(NounPhrase())+ | AskWord() | AskWord() (NounPhrase())+ | <EOF>
void AskWord() : {}
Awhat()
void Awhat() : {}
"what" | "wht" | "wt" | "wyt" | "vat" | "wat"
void NounPhrase() : {}
key()
void key() : {}
q1key() | q2key() | q3key()
void q1key() : {}
"Arv" | "Arv Drugs" | "Arv drgs" | "Arv drgh"
void q2key() : {}
"HIV" | "Hi virus"
}This not a javacc forum. Locking.
-
Hi!
I am unable to get the result for my one of the item as checkbox. Other two are working properly .Please check and let me know wheres the problem please.
***INCLUDE ZSD_CONTRACT_LIST_T01_RENTAL1 .
TABLES: vbak, vbap, wbrk, zsdsched,vbkd, fplt, fpla, tvlvt.
TYPE-POOLS: slis.
data: BEGIN OF gt_report occurs 0,
vbeln LIKE vbak-vbeln, "Sales Document
posnr LIKE vbap-posnr, "Item
ernam LIKE vbak-ernam, "Created by
erdat LIKE vbak-erdat, "Created on
audat LIKE vbak-audat, "Document Date
vbtyp LIKE vbak-vbtyp, "SD document category
auart LIKE vbak-auart, "Sales Document type
vkorg LIKE vbak-vkorg, "Sales Org
vtweg LIKE vbak-vtweg, "Distribution Channel
spart LIKE vbak-spart, "Division
vkbur LIKE vbak-vkbur, "Sales Office
guebg LIKE vbak-guebg, "Valid from date
gueen LIKE vbak-gueen, "Valid to date kunnrt LIKE kna1-name1, "Sold-to Name
kunwet LIKE kna1-name1, "Ship-to Name
kunnrt LIKE kna1-name1, "Sold-to Name
kunret LIKE kna1-name1, "Bill-to Name
kunnr LIKE vbak-kunnr, "Sold-to party
kunnrt LIKE kna1-name1, "Sold-to Name
kvgr4 LIKE vbak-kvgr4, "Territory
matnr LIKE vbap-matnr, "Material
arktx LIKE vbap-arktx, "Material Short Text
charg LIKE vbap-charg, "Batch
matkl LIKE vbap-matkl, "Material Group
pstyv LIKE vbap-pstyv, "Item Category
zmeng LIKE vbap-zmeng, "Target Quantity
zieme LIKE vbap-zieme, "Target Unit
kdmat LIKE vbap-kdmat, "Customer Material Number
werks LIKE vbap-werks, "Plant
lgort LIKE vbap-lgort, "Storage Location
vstel LIKE vbap-vstel, "Shipping Point
route LIKE vbap-route, "Route
netpr LIKE vbap-netpr, "Net Price
kpein LIKE vbap-kpein, "Condition Price Unit
kmein LIKE vbap-kmein, "Condition Unit
shkzg LIKE vbap-shkzg, "Returns Item
oidrc LIKE vbap-oidrc, "DRC Code
kunwe LIKE vbap-oid_ship, "Ship-to
aufnr LIKE vbap-aufnr, "Order Number
vkaus LIKE vbap-vkaus, "Usage
kunwet LIKE kna1-name1, "Ship-to Name
zzwprofid LIKE vbap-zzwprofid, "Waste Profile ID
kunre LIKE wbrk-kunre, "Bill-to
kunret LIKE kna1-name1, "Bill-to Name
addl_schd LIKE icon-id, "Push Button For addl line
datab LIKE zsdsched-datab, "Valid-From Date
datbi LIKE zsdsched-datbi, "Valid To Date
zschdfreq LIKE zsdsched-zschdfreq, "Contract schedule frequency
frequency LIKE zsdsched-frequency, "Frequency
monday LIKE zsdsched-monday, "Mondays
tuesday LIKE zsdsched-tuesday, "Tuesdays
wednesday LIKE zsdsched-wednesday, "Wednesdays
thursday LIKE zsdsched-thursday, "Thursdays
friday LIKE zsdsched-friday, "Fridays
saturday LIKE zsdsched-saturday, "Saturdays
sunday LIKE zsdsched-sunday, "Sundays
dzieme LIKE zsdsched-dzieme, "Target quantity UoM
comments LIKE zsdsched-comments, "Comments
END OF gt_report.
data: Begin of gt_report1 occurs 0,
fksaf LIKE fplt-fksaf,
afdat LIKE fplt-afdat,
fakwr LIKE fplt-fakwr,
fkdat LIKE fplt-fkdat,
nfdat LIKE fplt-nfdat,
fpart LIKE fpla-fpart,
bedat LIKE fpla-bedat,
endat LIKE fpla-endat,
horiz LIKE fpla-horiz,
bezei LIKE tvlvt-bezei,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
ernam LIKE vbak-ernam,
guebg LIKE vbak-guebg,
gueen LIKE vbak-gueen,
auart LIKE vbak-auart,
kunnr LIKE vbak-kunnr,
kvgr4 LIKE vbak-kvgr4,
vkbur LIKE vbak-vkbur,
vkorg LIKE vbak-vkorg,
vtweg LIKE vbak-vtweg,
vbtyp LIKE vbak-vbtyp,
name1 LIKE kna1-name1,
pstyv LIKE vbap-pstyv,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
oid_ship LIKE vbap-oid_ship,
kpein LIKE vbap-kpein,
kmein LIKE vbap-kmein,
netpr LIKE vbap-netpr,
kdmat LIKE vbap-kdmat,
posnr LIKE vbap-posnr,
matkl LIKE vbap-matkl,
aufnr LIKE vbap-aufnr,
vkaus LIKE vbap-vkaus,
route LIKE vbap-route,
kunre LIKE wbrk-kunre, "Bill-to
kunwe LIKE vbap-oid_ship, "Ship-to
kunwet LIKE kna1-name1, "Ship-to Name
kunnrt LIKE kna1-name1, "Sold-to Name
kunret LIKE kna1-name1, "Bill-to Name
End of gt_report1.
data: gs_report LIKE LINE OF gt_report,
gs_report1 LIKE LINE OF gt_report1,
gt_sched TYPE TABLE OF zsdsched,
gt_sched_tmp TYPE TABLE OF zsdsched,
gs_sched TYPE zsdsched,
gt_sel LIKE gt_report OCCURS 0,
gt_sel1 LIKE gt_report1 OCCURS 0,
gt_vbpa TYPE TABLE OF vbpa,
gs_vbpa TYPE vbpa,
gv_auart TYPE auart,
gv_counter TYPE i.
**-- ALV variables
DATA: ls_fieldcat TYPE slis_fieldcat_alv, "Field Catalog list
gt_fieldcat TYPE slis_t_fieldcat_alv, "Field Catalog
ls_sort TYPE slis_sortinfo_alv, "Sorting list
gt_sort TYPE slis_t_sortinfo_alv, "Sort
gs_layout TYPE slis_layout_alv, "List Layout
gs_variant TYPE disvariant, "Display Variant
gv_repid LIKE sy-repid,
gv_save(1) TYPE c,
ls_fieldcat1 TYPE slis_fieldcat_alv, "Field Catalog list
gt_fieldcat1 TYPE slis_t_fieldcat_alv, "Field Catalog
ls_sort1 TYPE slis_sortinfo_alv, "Sorting list
gt_sort1 TYPE slis_t_sortinfo_alv, "Sort
gs_layout1 TYPE slis_layout_alv, "List Layout
gs_variant1 TYPE disvariant, "Display Variant
gv_repid1 LIKE sy-repid,
gv_exit(1) TYPE c.
CONSTANTS: gc_a TYPE c VALUE 'A',
gc_g TYPE c VALUE 'G',
gc_re(2) TYPE c VALUE 'RE'.
Screen-control Variables
CONTROLS:
tctrl_sched TYPE TABLEVIEW USING SCREEN 1010. " Schedule lines.
*& Report ZSD_CONTRACT_LIST
*& Created on: January 21, 2007
*& Description: List of Contracts - ALV
REPORT zsd_contract_list_rental1.
INCLUDE zsd_contract_list_t01_rental1.
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK m1 WITH FRAME TITLE text-t01.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_vkorg FOR vbak-vkorg MEMORY ID vko,
s_vtweg FOR vbak-vtweg MEMORY ID vtw,
s_spart FOR vbak-spart MEMORY ID spa,
s_vkbur FOR vbak-vkbur MEMORY ID vkb.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_erdat FOR vbak-erdat,
s_ernam FOR vbak-ernam,
s_guebg FOR vbak-guebg,
s_gueen FOR vbak-gueen,
s_auart FOR gv_auart MEMORY ID vta
MATCHCODE OBJECT h_vakz,
s_fkarv FOR fplt-fkarv.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS:
s_kunnr FOR vbak-kunnr,
s_kunwe FOR vbap-oid_ship,
s_kunre FOR wbrk-kunre.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t03.
SELECT-OPTIONS: s_werks FOR vbap-werks MEMORY ID wrk,
s_lgort FOR vbap-lgort MEMORY ID lag,
s_vstel FOR vbap-vstel MEMORY ID vst,
s_route for vbap-route,
s_matnr FOR vbap-matnr.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t04.
PARAMETERS: p_varia TYPE disvariant-variant MEMORY ID wrk,
p_all AS CHECKBOX DEFAULT 'X',
p_group AS CHECKBOX DEFAULT 'X',
p_rental AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF BLOCK m1.
Start of Selection
START-OF-SELECTION.
PERFORM get_data.
Display ALV
END-OF-SELECTION.
IF gt_report[] IS INITIAL.
MESSAGE s419(brain).
ELSE.
PERFORM create_alv.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varia.
PERFORM f01_f4_variant CHANGING p_varia.
*& Form get_data
text
FORM get_data .
select the appropriate rental data.
IF p_rental IS NOT INITIAL AND ( ( p_all IS INITIAL ) AND ( p_group IS INITIAL ) ).
SELECT avbeln aerdat aernam aaudat avbtyp aauart a~vkorg
avtweg aspart avkbur aguebg agueen akunnr a~kvgr4
bpstyv bmatnr bwerks boid_ship bkpein bkmein
bnetpr bkdmat bposnr bmatkl baufnr bvkaus b~route
dbezei efkarv eafdat efakwr efkdat enfdat e~fksaf
ffpart fbedat fendat fhoriz flodat ftndat b~oid_ship AS kunwe
INTO CORRESPONDING FIELDS OF TABLE gt_sel1
FROM vbak AS a
INNER JOIN vbap AS b ON avbeln = bvbeln
INNER JOIN vbpa as c ON avbeln = cvbeln
INNER JOIN vbkd AS g ON avbeln = gvbeln
INNER JOIN fplt AS e ON gfplnr = efplnr
INNER JOIN fpla AS f ON efplnr = ffplnr
INNER JOIN tvlvt AS d ON bvkaus = dabrvw
WHERE a~vbeln IN s_vbeln
AND a~erdat IN s_erdat
AND a~vbtyp = gc_g
AND a~ernam IN s_ernam
AND a~vkorg IN s_vkorg
AND a~vtweg IN s_vtweg
AND a~spart IN s_spart
AND a~vkbur IN s_vkbur
AND a~guebg IN s_guebg
AND a~gueen IN s_gueen
AND a~auart IN s_auart
AND a~kunnr IN s_kunnr
AND b~oid_ship IN s_kunwe
AND b~werks IN s_werks
AND b~lgort IN s_lgort
AND b~vstel IN s_vstel
and b~route in s_route
AND b~matnr IN s_matnr
AND e~fkarv IN s_fkarv
AND e~fksaf = 'A'
OR e~fksaf = 'B'.
sort gt_sel1.
*ENDIF.
IF NOT gt_sel1[] IS INITIAL.
Get Bill-to Party's for Item Lines
SELECT vbeln posnr parvw kunnr INTO CORRESPONDING FIELDS OF TABLE gt_vbpa
FROM vbpa
FOR ALL ENTRIES IN gt_sel1
WHERE vbeln = gt_sel1-vbeln
AND parvw = gc_re.
Loop through captured data for additional information
LOOP AT gt_sel1 INTO gs_report1.
Find the bill-to party
READ TABLE gt_vbpa INTO gs_vbpa WITH KEY vbeln = gs_report1-vbeln
posnr = gs_report1-posnr
parvw = gc_re.
IF sy-subrc <> 0.
READ TABLE gt_vbpa INTO gs_vbpa WITH KEY vbeln = gs_report1-vbeln
parvw = gc_re.
CHECK sy-subrc = 0 AND gs_vbpa-kunnr IN s_kunre.
ELSE.
CHECK gs_vbpa-kunnr IN s_kunre.
ENDIF.
gs_report1-kunre = gs_vbpa-kunnr.
Get the Customer's Name
gs_report1-kunnrt = zcl_kna1=>get_name1( itp_kunnr = gs_report1-kunnr ).
gs_report1-kunwet = zcl_kna1=>get_name1( itp_kunnr = gs_report1-kunwe ).
gs_report1-kunret = zcl_kna1=>get_name1( itp_kunnr = gs_report1-kunre ).
Get the scheduling lines for the item line.
CLEAR gv_counter.
APPEND gs_report1 TO gt_report1.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM gt_report1.
*ENDIF.
ELSE.
IF ( ( p_all IS NOT INITIAL ) OR ( p_group IS NOT INITIAL ) ) AND p_rental IS INITIAL.
Select the appropriate contract data.
SELECT a~vbeln a~erdat a~ernam a~audat a~vbtyp a~auart a~vkorg
a~vtweg a~spart a~vkbur a~guebg a~gueen a~kunnr a~kvgr4
b~posnr b~matnr b~charg b~matkl b~arktx b~pstyv b~zmeng
b~zieme b~kdmat b~werks b~lgort b~vstel b~netpr b~kpein
b~kmein b~shkzg b~oid_extbol b~oid_miscdl b~oidrc b~oid_ship AS kunwe
b~zzwprofid c~datbi c~datab b~route
baufnr bvkaus d~bezei
INTO CORRESPONDING FIELDS OF TABLE gt_sel
FROM vbak AS a
INNER JOIN vbap AS b ON a~vbeln = b~vbeln
INNER JOIN tvlvt AS d ON bvkaus = dabrvw
LEFT OUTER JOIN zsdsched AS c ON b~vbeln = c~vbeln AND
b~posnr = c~posnr
WHERE a~vbeln IN s_vbeln
AND a~erdat IN s_erdat
AND a~vbtyp = gc_g
AND a~ernam IN s_ernam
AND a~vkorg IN s_vkorg
AND a~vtweg IN s_vtweg
AND a~spart IN s_spart
AND a~vkbur IN s_vkbur
AND a~guebg IN s_guebg
AND a~gueen IN s_gueen
AND a~auart IN s_auart
AND a~kunnr IN s_kunnr
AND b~oid_ship IN s_kunwe
AND b~werks IN s_werks
AND b~lgort IN s_lgort
AND b~vstel IN s_vstel
and b~route in s_route
AND b~matnr IN s_matnr.
SORT gt_sel.
ENDIF.
IF NOT gt_sel[] IS INITIAL.
Get Bill-to Party's for Item Lines
SELECT vbeln posnr parvw kunnr INTO CORRESPONDING FIELDS OF TABLE gt_vbpa
FROM vbpa
FOR ALL ENTRIES IN gt_sel
WHERE vbeln = gt_sel-vbeln
AND parvw = gc_re.
endif.
Select the remaining records from the ZSDSCHED Table.
IF p_group IS NOT INITIAL.
SELECT * FROM zsdsched
INTO TABLE gt_sched
FOR ALL ENTRIES IN gt_sel
WHERE vbeln = gt_sel-vbeln
AND posnr = gt_sel-posnr.
SORT gt_sched.
ENDIF.
Loop through captured data for additional information
LOOP AT gt_sel INTO gs_report.
Find the bill-to party
READ TABLE gt_vbpa INTO gs_vbpa WITH KEY vbeln = gs_report-vbeln
posnr = gs_report-posnr
parvw = gc_re.
IF sy-subrc <> 0.
READ TABLE gt_vbpa INTO gs_vbpa WITH KEY vbeln = gs_report-vbeln
parvw = gc_re.
CHECK sy-subrc = 0 AND gs_vbpa-kunnr IN s_kunre.
ELSE.
CHECK gs_vbpa-kunnr IN s_kunre.
ENDIF.
gs_report-kunre = gs_vbpa-kunnr.
Get the Customer's Name
gs_report-kunnrt = zcl_kna1=>get_name1( itp_kunnr = gs_report-kunnr ).
gs_report-kunwet = zcl_kna1=>get_name1( itp_kunnr = gs_report-kunwe ).
gs_report-kunret = zcl_kna1=>get_name1( itp_kunnr = gs_report-kunre ).
Get the scheduling lines for the item line.
CLEAR gv_counter.
IF NOT p_group IS INITIAL.
If we are grouping the lines add the icon button.
LOOP AT gt_sched INTO gs_sched WHERE vbeln = gs_report-vbeln
AND posnr = gs_report-posnr.
IF gv_counter > 0.
gs_report-addl_schd = '@1E@'.
CONTINUE.
ENDIF.
MOVE-CORRESPONDING gs_sched TO gs_report.
ADD 1 TO gv_counter.
ENDLOOP.
ELSE.
Otherwise get the rest of the schedule information
READ TABLE gt_sched INTO gs_sched
WITH KEY vbeln = gs_report-vbeln
posnr = gs_report-posnr
datbi = gs_report-datbi
datab = gs_report-datab.
IF sy-subrc = 0.
MOVE-CORRESPONDING gs_sched TO gs_report.
ENDIF.
ENDIF.
APPEND gs_report TO gt_report.
ENDLOOP.
Remove any duplicates from the reporting table
DELETE ADJACENT DUPLICATES FROM gt_report.
If Show all records is initial, delete non-scheduled lines (ex. Sub-items)
IF p_all IS INITIAL.
DELETE gt_report WHERE datbi = 0
AND datab = 0.
ENDIF.
endif.
endif.
ENDFORM. " get_data
*& Form create_alv
text
FORM create_alv .
if ( ( p_all is not initial ) or ( p_group is not initial ) ) and p_rental is initial.
PERFORM initialize_fieldcat USING gt_fieldcat[].
PERFORM populate_layout CHANGING gs_layout
gs_variant.
PERFORM populate_sort USING gt_sort[].
PERFORM display_alv_report.
else.
if p_rental is not initial and ( ( p_all is initial ) and ( p_group is initial ) ).
PERFORM initialize_fieldcat1 USING gt_fieldcat1[].
PERFORM populate_layout1 CHANGING gs_layout1
gs_variant1.
PERFORM populate_sort1 USING gt_sort1[].
PERFORM display_alv_report1.
*endif.
*endif.
ENDFORM. " create_alv
*& Form initialize_fieldcat
Get and enhance the field catalog data
-->L_FIELDCAT[] text
FORM initialize_fieldcat USING l_fieldcat TYPE slis_t_fieldcat_alv.
IF p_rental IS NOT INITIAL .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZSD_CONTRACT_LIST_RENTAL1'
i_internal_tabname = 'GT_REPORT1'
i_inclname = 'ZSD_CONTRACT_LIST_T01_RENTAL1'
CHANGING
ct_fieldcat = l_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'VBELN'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Contract'.
ls_fieldcat-hotspot = 'X'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNNRT'.
ls_fieldcat-seltext_s =
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sold-to Name'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNWET'.
ls_fieldcat-seltext_s =
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Ship-to Name'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNRET'.
ls_fieldcat-seltext_s =
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Bill-to Name'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'ADDL_SCHD'.
IF NOT p_group IS INITIAL.
ls_fieldcat-seltext_s = 'Schd'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Additional Scheduling Lines'.
ls_fieldcat-icon = 'X'.
CLEAR: ls_fieldcat-key,
ls_fieldcat-ref_fieldname,
ls_fieldcat-ref_tabname,
ls_fieldcat-reptext_ddic,
ls_fieldcat-ddic_outputlen.
ls_fieldcat-hotspot = 'X'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
ELSE.
DELETE l_fieldcat INDEX sy-tabix.
ENDIF.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'DATAB'.
ls_fieldcat-seltext_s = 'Schd From'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sched. From Date'.
CLEAR: ls_fieldcat-key.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat1 WITH KEY fieldname = 'DATBI'.
ls_fieldcat-seltext_s = 'Schd To'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sched. To Date'.
CLEAR: ls_fieldcat-key.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
ELSE.
IF p_rental IS INITIAL.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZSD_CONTRACT_LIST_RENTAL1'
i_internal_tabname = 'GT_REPORT'
i_inclname = 'ZSD_CONTRACT_LIST_T01_RENTAL1'
CHANGING
ct_fieldcat = l_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'VBELN'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Contract'.
ls_fieldcat-hotspot = 'X'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNNRT'.
ls_fieldcat-seltext_s =
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sold-to Name'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNWET'.
ls_fieldcat-seltext_s =
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Ship-to Name'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'KUNRET'.
ls_fieldcat-seltext_s =
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Bill-to Name'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'ADDL_SCHD'.
IF NOT p_group IS INITIAL.
ls_fieldcat-seltext_s = 'Schd'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Additional Scheduling Lines'.
ls_fieldcat-icon = 'X'.
CLEAR: ls_fieldcat-key,
ls_fieldcat-ref_fieldname,
ls_fieldcat-ref_tabname,
ls_fieldcat-reptext_ddic,
ls_fieldcat-ddic_outputlen.
ls_fieldcat-hotspot = 'X'.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
ELSE.
DELETE l_fieldcat INDEX sy-tabix.
ENDIF.
READ TABLE l_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'DATAB'.
ls_fieldcat-seltext_s = 'Schd From'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sched. From Date'.
CLEAR: ls_fieldcat-key.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
READ TABLE l_fieldcat INTO ls_fieldcat1 WITH KEY fieldname = 'DATBI'.
ls_fieldcat-seltext_s = 'Schd To'.
ls_fieldcat-seltext_m = ls_fieldcat-seltext_l = 'Sched. To Date'.
CLEAR: ls_fieldcat-key.
MODIFY l_fieldcat FROM ls_fieldcat INDEX sy-tabix.
ENDIF.
ENDIF.
ENDFORM. " initialize_fieldcat
*& Form populate_layout
text
<--GS_LAYOUT
<--GS_VARIANT
FORM populate_layout CHANGING gs_layout TYPE slis_layout_alv
gs_variant TYPE disvariant.
gs_layout-colwidth_optimize = 'X'.
gs_layout-allow_switch_to_list = 'X'.
gs_layout-zebra = 'X'.
gs_variant-report = sy-repid.
ENDFORM. " populate_layout
*& Form populate_sort
text
-->l_SORT[] text
FORM populate_sort USING l_sort TYPE slis_t_sortinfo_alv.
ENDFORM. " populate_sort
*& Form display_alv_report
FORM display_alv_report .
gv_repid = sy-repid.
IF p_rental IS INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = gv_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'GT_REPORT'
is_layout = gs_layout
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = gt_sort
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = gc_a
is_variant = gs_variant
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_report
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.
ENDIF.
ELSE.
IF p_rental IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = gv_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'GT_REPORT1'
is_layout = gs_layout
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = gt_sort
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = gc_a
is_variant = gs_variant
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = GT_REPORT1
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.
endif.
endif.
ENDFORM. " display_alv_report
*& Form initialize_fieldcat1
Get and enhance the field catalog data for rental fields
-->L_FIELDCAT[] text
*FORM initialize_fieldcat1 USING l_fieldcat1 TYPE slis_t_fieldcat_alv.
**if ***
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZSD_CONTRACT_LIST_rental1'
i_internal_tabname = 'GT_SEL1'
i_inclname = 'ZSD_CONTRACT_LIST_T01_rental1'
CHANGING
ct_fieldcat = l_fieldcat1
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
**else.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZSD_CONTRACT_LIST_rental1'
i_internal_tabname = 'GT_SEL1'
i_inclname = 'ZSD_CONTRACT_LIST_T01_rental1'
CHANGING
ct_fieldcat = l_fieldcat1
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
***endfi.
*ENDFORM. " initialize_fieldcat
*& Form populate_layout
text
<--GS_LAYOUT
<--GS_VARIANT
*FORM populate_layout1 CHANGING gs_layout1 TYPE slis_layout_alv
gs_variant1 TYPE disvariant.
gs_layout1-colwidth_optimize = 'X'.
gs_layout1-allow_switch_to_list = 'X'.
gs_layout1-zebra = 'X'.
gs_variant1-report = sy-repid.
*ENDFORM. " populate_layout
***& Form populate_sort
text
-->l_SORT[] text
*FORM populate_sort1 USING l_sort TYPE slis_t_sortinfo_alv.
*ENDFORM. " populate_sort
***& Form display_alv_report
*FORM display_alv_report1 .
gv_repid = sy-repid.
if p_rental is not initial and ( ( p_all is initial ) and ( p_group is initial ) ).
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = gv_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'gt_sel1'
is_layout = gs_layout1
it_fieldcat = gt_fieldcat1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = gt_sort1
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = gc_a
is_variant = gs_variant1
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_sel1
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.
*endif.
*ENDFORM. " display_alv_report
*& Form f01_f4_variant
Get the Layout variant for the user.
FORM f01_f4_variant CHANGING c_variant TYPE disvariant-variant.
DATA: ls_variant TYPE disvariant,
l_exit TYPE char1.
ls_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = ls_variant
i_save = 'A'
it_default_fieldcat =
IMPORTING
e_exit = l_exit
es_variant = ls_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF l_exit EQ space.
c_variant = ls_variant-variant.
ENDIF.
ENDIF.
ENDFORM. " f01_f4_variant
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE gt_report INTO gs_report INDEX rs_selfield-tabindex.
CHECK sy-subrc = 0.
CASE rs_selfield-fieldname.
WHEN 'VBELN'.
Set parameter ID for transaction screen field
CHECK NOT gs_report-vbeln IS INITIAL.
SET PARAMETER ID 'KTN' FIELD gs_report-vbeln.
CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.
WHEN 'ADDL_SCHD'.
CHECK NOT gs_report-addl_schd IS INITIAL.
REFRESH gt_sched_tmp.
LOOP AT gt_sched INTO gs_sched
WHERE vbeln = gs_report-vbeln
AND posnr = gs_report-posnr.
APPEND gs_sched TO gt_sched_tmp.
ENDLOOP.
CHECK sy-subrc = 0.
CALL SCREEN '1010' STARTING AT 5 5.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
*& Module STATUS_1010 OUTPUT
text
MODULE status_1010 OUTPUT.
SET PF-STATUS 'MAIN_1010'.
SET TITLEBAR '1010' WITH gs_report-vbeln gs_report-posnr.
ENDMODULE. " STATUS_1010 OUTPUT
*& Module USER_COMMAND_1010 INPUT
text
MODULE user_command_1010 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'CANC'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_1010 INPUTHi !
This report shows the schedule line items , group schedule line items and rental contact (billing plan) lines when particular checkbox is checked. The checkboxs p_all(non-schedule line) , p_group(group schedule line items) are working in my above alv report and showing result but unfortunately when p_rental is checked it dosent give me result , it says no data selected. This when checked has to show result based on a different set of selections as I have done, but its not shwoing me the result .
Kindly help please.
Thanks -
Hi,
I want to create a visual webpart which will read data from excel sheet and import it in to sql server database.(using sharepoint development)
I want to do it using visual webpart.
Please help to solve the issue.
Thanks in advance!
Regards
RajniHi Rajni,
Microsoft.Office.Interop.Excel assembly provides class to read excel file data, in your web part solution, reference the assembly, and following blog contains samples about how to read the excel file data,
and import it to SQL database.
1.Create a Visual Web Part Project:Create
Visual Web Parts in SharePoint 2010
2.Read the excel workbook by using SPFile class:
http://alancejacob.blogspot.in/2012/06/read-data-from-excel-file-and-insert-in.html
http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
3.Export the excel workbook to SQL Server:
http://www.c-sharpcorner.com/UploadFile/99bb20/import-excel-data-to-sql-server-in-Asp-Net/
Best Regards,
Eric
Eric Tao
TechNet Community Support -
How to show result from process in popup page?
<br>We want to use one popup page for many information in application. So we want to make the following thing.
<br>We want to execute process and show result in popup page (through hidden parameter-"P2_MESSAGE").
<br>We also assign title of region on that popup page through "P2_TITLE".
<br>What I do not know is how to show popup after process-branch problem.
<br>Process is executed from one button. Button is located on page "28" and popup page is "2"
<br>Code for javascript should be like:
<br>
javascript:popupURL('f?p=&APP_ID.:2:&APP_SESSION.::::P2_TITLE,P2_MESSAGE:'+'status '+','+'&P28_X.')<br>THXI have found in one thread:
<br>
<br>1) create an application item APP_ONLOAD (of course you can choose your own name)
<br>2) create an application level before footer computation on APP_ONLOAD to clear the item after the page is generated.
<br>3) place &APP_ONLOAD. (dot also) in the on load property of the page.
<br>4) fill the APP_ONLOAD using :APP_ONLOAD := 'onload="your own javascript to call a popup window;"' in the plsql of an after On Submit - After Computations and Validations process (type PL/SQL anonymous block)
Fill the when button pressed property of the process with the button you want to use to show the popup.
<br>5) create a branch to branch to the current page (or a other if you wish)
<br>
Looks OK but when I create in PL/SQL js with "&" signe, which I use for filling some hidden values in popup page I get error.
begin
is_test_ok (1, :P28_X);
:APP_ONLOAD := 'onload="javascript:popupHeightURL(''f?p=&APP_ID.:2:&APP_SESSION.::::P2_TITLE,P2_MESSAGE:''+''statusu testova''+'','+''&P28_X.'')"';
end;<br>Should I use ASCII codes for that or what? Any example please!
<br>THX -
Execute a VO '4' times and show the result in single table at once.
Hi,
I want to execute single a VO query multiple times with different parameters and show the results together in a Table at once
In Detail
I have a table to which is associated with a VO.
The VO contains SQL whose WhereClauseParameters need to be dynamically binded.say headerId and lineId
Select ... from ....where headerId = :1 AND lineId = :2
I have to pass these 4 values and show all the results in a single table
headerId lineid
H1 ............... L1
H1 ............... L2
H2 ............... L1
H2 ............... L2
I understand that i need to bind parameters dynamically and exceute the VO.
As i have 4 different set of parameters, the view object will be executed 4 times.
I want to show all the results together in a single table.
How can I do it.
thanks,
GowtamHi Mani,
Thanks a lot for the patience and detailed solution.I will try it out and tell you the status.
Meanwhile, I have 2 questions on this solution(just curious)
I will give you the snapshot of the table
Table - ModelInfo
Model......Tube..... Float....Size......Col5.....Col6.......Col7.......
M1............T1.......... F1. .....1..........C15......C16.....C17.....
M1............T1...........F1.......2..........C25......C26.....C27.....
M1............T2......... .F2.......1..........C35......C36.....C37.....
M1............T2...........F2.......2..........C45......C46.....C47.....
M2............T1.......... F1. .....1..........
M2.............T1..........F1.....2.........Cn5.......Cn6........Cn7
.<continues...>
.<till>
.Mn............Tn..........Fn.......n........Cxy.......Cpq.......Crs....
Question 1:
if you notice this data,
The Columns 5 to 7 are dependent on Combination of Model,Tube,Float and Size.
Hence will this query work properly(without mixing up data from other Pk combination) and will it be efficient?(I Know this is a stupid qst, still double checking..As your solution assumes that each row is unique for Model only..which is not true)
Select ...From....Where
Model in(M1,M2,..Mn) AND Tube in(T1,T2..Tn) AND Float in(F1,F2,....Fn) and Size in(1,2...n).
In short, will C15,C16 and C17 appear only with M1,T1,F1,1..I believe it will.
Question 2:
As I told,
Third party program will return Array of Objects.
Each object will have a variable called Flow along with
Model,Tube,Float and Size.
Flow is not stored in the database(can not be stored due to functional reasons).I want to show this Flow also along with other columns fetched from the DB for all 100+ rows.
How can I do it?
I will give u the scenario(with just 2 rows)...please check(Flow is not stored in DB)
Third Party object : ObjModel
Model......Tube..... Float....Size......Flow
M1............T1.......... F1. .....1..........100
M1............T1...........F2.......2...........200.
M1............T2.......... F1.......1..........300
M1............T2...........F2.......2..........400
My concern is,
After the VO executes and shows other 6 columns, it should show Flow appropriately.(associated with each object in the array)
I understand that I need to have a Transient attribute in VO called[b] Flow.But I don't know how to perform the two tasks simultaneously..
Task1:Your solution on showing table columns
Task2:Showing Transient data for each object returned from program.
thanks,
Gowtam -
Newbie Question My Photos print and show desaturated color
Hi I have a feeling there is a very simple answer to this. My photos which I mainly process in Lightroom 3 (with some adjustments in Photoshop CS3) print and show desaturated colors wether or not they are RAW or JPEG. I have applied camera profile settings such as landscape, to raw files but when I export them as a jpg and send to a photo shop to print they are still desaturated. Also when I send a stand alone file to a media contact it shows desaturated to them. If I deliberately adjust my monitor to Pro RGB it appears to show the true colour that others are seeing. I have attempted to over saturate to get a reasonable print but clearly this is not correct.
Proberbly an easy question for someone out there but I am having trouble resolving it.
Many Thanks
StevePlease click on the link below and read the entire site carefully. Then follow the instructions to the letter.
http://www.gballard.net/psd/cmstheory.html
In a nutshell:
• Calibrate and profile your monitor. Set the resulting profile as your monitor profile. Never use a device independent color space (such as ProPhoto RGB, Adobe RGB or sRGB) as your monitor profile. Only use your calibrated profile specific to your monitor.
• honor the embedded profile in each file;
• when sending your images to a run-of-the mill lab, convert your images to sRGB (do not use assign profile; use CONVERT to profile) and embed the sRGB profile in them.
The above site explains it all to you.
Wo Tai Lao Le
我太老了 -
Questions Re: (1) Creating Contact Sheets, and (2) Editing photos
Hello,
I have two questions about iPhoto '09:
(1) Regarding the creation of a contact sheet, how do I select more than one photo at a time?!? I open up my photos, click on a photo to choose it. If I try to click the next photo I want on the contact sheet, the first one is un-chosen. I click File > Print > Contact Sheet, and sure enough, only the most-recently chosen photo is the only one on the sheet.
(I have tried Edit > Select All > Print > Contact Sheet, but [as is implied in the "all" part of Select All], of course this results in a contact sheet full of photos I don't want.)
(2) Sometimes when I pick a photo to edit, click the Edit icon at the bottom of the window, get the enlarged pic and start editing, none of my changes show up i in the enlarged image. But when I click "Done," the changes are there in the image in the album. This is annoying, since while editing, I have to click "Done" to see the effect of a change every time I make one, and then start all over with the "Edit" icon, make more changes, click "Done" to see them, etc.
This does not happen with every photo. Weird.
Thanks, anyone, for ideas and help.Light
Welcome to the Apple user to user assistance forums
(1) Regarding the creation of a contact sheet, how do I select more than one photo at a time?!?
The same as all Mac selections:
- you can click on the first of a set of contiguous photos and then depress the shift key and click on the last of the set and select all photos from the first to the last
- you can click and drag across a set of photo to select the set
- you can click on a photo and then depress the command (apple) key and click on additional non-contiguous photos to select them
- you can make an album of the photos you want and display the album and select all
and on and on and on - there are many, many ways to select multiple photos
(2) Sometimes when I pick a photo to edit, click the Edit icon at the bottom of the window, get the enlarged pic and start editing, none of my changes show up i in the enlarged image. But when I click "Done," the changes are there in the image in the album. This is annoying, since while editing, I have to click "Done" to see the effect of a change every time I make one, and then start all over with the "Edit" icon, make more changes, click "Done" to see them, etc.
quit iPhoto and with the finder Delete your iPhoto preference file - "your username" ==> library ==> preferences ==> com.apple.iPhoto.plist - launch iPhoto and it will create a new default preference file, set any personal preferences you want and if you have moved the iPhoto library repoint to it
LN -
Please read my question carefully, this is, I think, a question for the experts. It's not the usual name change question.
When I setup my new MacBook Pro, something slipped by me and my computer was named First-Lasts-MacBook-Pro (using my real first and last name).
I changed the computer name in Preferences/Sharing to a new name and Preferences/Accounts to just be Mike. I can right click on my account name, choose advanced, and see that everything looks right.
However, If I do a scan of my network with my iPhone using the free version of IP Scanner, it lists my computer as First-Lasts-MacBook-Pro! And it lists the user as First-Last.
So even though another Mac just sees my new computer name, and my home folder is Mike, somewhere in the system the original setup with my full name is still stored. And it's available on a network scan. So my full name might show up at a coffee shop.
Can I fully change the name without doing a complete re-install of Lion and all my apps?One thought... you said the iPhone displayed your computer's old name? I think that you must have used the iPhone with this computer before you changed the name. So no one else's iPhone should display your full name unless that iPhone had previously connected to your Mac. For example, I did this exact same change, and I use the Keynote Remote app to connect with my MacBook Pro. It would no longer link with my MacBook Pro under the old name, and I found that I had to unlink and then create a new link under the new name. So the answer to your question is, there is nothing you need to do on the Mac, but rather the phone, and no other phone will display your full name.
Maybe you are looking for
-
How to register youtube videos on mac hard drive?
how to register youtube videos on mac hard drive? iMac 21.5 po, mid 2010 .Processor Intel i3
-
? About converting a 2-disc movie ...
Ok, so I have finally been able to convert movies to a format acceptable to use with my little 5th Gen Video iPod. Now, I have another question though. How do you convert a single movie that is on 2 discs so that it is one continuous movie and isn't
-
Monitor displays wallpaper after mac pro powered down
since I replaced my MBP with a new Mac Pro, after I shut down, my wallpaper is still displayed on my display (HP 2335). I can even disconnect the DVI from my mac pro, and it is still displayed. I've never seen anything like this. Any ideas?
-
Stereo import problems creates mono to stereo problem/question
After 10 hours of uploading video to the hard drive I'm finally ready to work on the project, but something odd happened. After the first tape upload all the files switched from two track stereo to one track mono. How does this happen? I don't relish
-
Sqlldr through Java Stored Proc
I am loading data from sqlldr through a java stored proc that executes command strings. My string executes in windows through the command window just fine and I can see the data but If I run the sqlldr through java then I must exit my session and rel