Query for printing report if field 1 = x
Forgive me if this is the wrong place to put this, My first time on here.
I want to run a query in management studio 2008r2.
The query goes like this:
SELECT [Default Branch ID], [Contact Title], [Contact FirstName], [Contact LastName], [Phone Home], [Phone Work], [Phone Mobile], [Marketing 1]
FROM Customer
EXCEPT I want to display only entries that match [marketing 1] (Customer birth month) with current date. EG print all customers with details who have a birthday this month.
How would I go about this?
Thanks in advance!
Ryan
Hi
There's no native way to automatically run a query and print from Management Studio.
However are some native ways to push an email if that's any help:
You could write a
SQL Server Agent job to be scheduled once per month to send an
email with information (not available on express and you need to setup dbmail)
You could set up a
Data Drive Subscription in Reporting Services to do much the same (Enterprise or BI Editions only).
Alternatively you could look at non-native solutions such as
this. You're into the realms of windows scripts then.
Similar Messages
-
Write a query for which has its field name as input parameter
Hi All,
I need to write a query for SSRS report. StartDate, EndDate and ChangedField are the input parameters.
Let's consider that we are taking employee details. The table contains lot of fields like emp name,add1,add2,city,state,country,designation,rank etc. We have almost 30 fields are there. These field name are coming as input parameter "ChangedField"
. I need to show the records which belong to the start date and end date also data change for the field which is given in the input parameter "ChangedField". That meand If I give ChangedField="city", we need to check for data which
has been updated with new City name in the given time period.
Please suggest.
Regards,
JulieHi Julie,
Per my understanding that you have many fields in the table to be displayed in the report, some of the fields will always show and others should be hide and show based on the selection of the parameters which include the columns names, right?
By default, we can't display columns dynamically in the report automatically without insert this column in the report before. So, in your scenario, I will suggest you to add all the columns in the reports first and then add show/hide expression on
the column visibility based on the selection of the parameter "ChangedField", when some of the fields selectted they will be display, otherwise they will be hidden. For the fields which you want to be always displayed will not need to add the expression
in the column visibility.
Details steps about how to acheive this, please referencet to the article below:
Displaying Dynamic Columns in SSRS Report
If you still have any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
HOW TO ASSIGN F4_VALUE_HELP FOR A REPORT OUTPUT FIELD???
Hi Gurus,
Can you please help me out in assigning F4_VALUE_HELP for a report output field where it is taking value as the input parameter....... If possible please help me out with some sample code ....
Regards,
Santosh
IntelligroupI don't think that you are get the F4 functionality by pressing F4, but maybe if you use a hotspot you could achieve it. Check this sample. When you click on a company code in the list, it fires the F4 help defined by the program.
report zrich_0001 .
tables: t001.
data: begin of it001 occurs 0,
bukrs type t001-bukrs,
butxt type t001-butxt,
ort01 type t001-ort01,
land1 type t001-land1,
end of it001.
start-of-selection.
select bukrs butxt ort01 land1 into table it001 from t001.
loop at it001.
format hotspot on.
write:/ it001-bukrs.
hide it001-bukrs.
format hotspot off.
write: it001-butxt.
endloop.
at line-selection.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'BUKRS'
dynprofield = 'BUKRS'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = it001.
Regards,
Rich Heilman -
Improving a query for a report in b1
Dear All,
We have a query for a report. this report display all invoices with it´s Dscription in the system just have 3 descriptions so i need the the report display the this description in column not in row and then have the sum by description. i dont know how can i put a picture for showing the example.
Some one knows how can i do? down the code.
Regards
NANCY
SELECT distinct T1.visorder as 'No. Linea',
T0.DocNum as 'No. Factura',
T0.DocDate as 'Fecha',
T0.CardName as 'Cliente',
T1.U_CANTIDAD as 'Tonelaje',
T0.U_OPERACION as 'No. Operación',
T0.DocCur as 'Moneda',
T0.GrosProfit as 'Ingreso total de factura',
T1.ItemCode as 'Código',
T1.Dscription,
T1.Quantity*T1.Price as 'Importe por Servicio',
T1.LineVat as 'IVA por servicio',
T0.VatSum as 'IVA por factura',
T2.PlngGroup as 'Cuenta SUN'
FROM OINV T0 LEFT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
inner join OCRD T2 ON T0.CardCode = T2.CardCode
WHERE T0.Series = 49 and
T0.DocDate BETWEEN [%0] AND [%1]Hi Nancy,
I'm not sure that I understand your requirement 100% but assuming you only have 3 descriptions then the following would give you totals for your different descriptions...
Simply replace the text ' etc in the code below with the descriptions values.
SELECT distinct
T1.visorder as 'No. Linea',
T0.DocNum as 'No. Factura',
T0.DocDate as 'Fecha',
T0.CardName as 'Cliente',
T1.U_CANTIDAD as 'Tonelaje',
T0.U_OPERACION as 'No. Operación',
T0.DocCur as 'Moneda',
T0.GrosProfit as 'Ingreso total de factura',
T1.ItemCode as 'Código',
CASE
WHEN T1.Dscription = '<description1>'
THEN T1.Quantity*T1.Price
ELSE 0
END as '<description1>',
CASE
WHEN T1.Dscription = '<description2>'
THEN T1.Quantity*T1.Price
ELSE 0
END as '<description2>',
CASE
WHEN T1.Dscription = '<description3>'
THEN T1.Quantity*T1.Price
ELSE 0
END as '<description3>',
T1.LineVat as 'IVA por servicio',
T0.VatSum as 'IVA por factura',
T2.PlngGroup as 'Cuenta SUN'
FROM OINV T0 LEFT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
inner join OCRD T2 ON T0.CardCode = T2.CardCode
WHERE T0.Series = 49 and
T0.DocDate BETWEEN [%0] AND [%1]
Hope this helps.
Regards,
Sean -
I've created the below crosstab query for a report.
Select Grouping_Condition,Warehouse,Max(Value) Over (Partition By Grouping_Condition,Warehouse) As Total,
Sum(Value) Over (Partition By Warehouse) As Total_Containers_Per_Warehouse,
Sum(Vat1Ue) Over () As Total_Containers,
(Max(Vat1Ue) Over (Partition By Grouping_Condition,Warehouse))
/(Sum(Vat1Ue) Over (Partition By Warehouse))*100 As Total_Pct
From
Seleect Grouping_Condition,Warehouse,Count(*) As Value
From
Set1Ect
T1.Warehouse,Shipped_Weight As Shipped_Tons,T1.Max_Weight As Maxtonnes,
Case When (Shipped_Weight)< (T1.Max_Weight*0.001)*0.95 Then 'containers_under_95'
When (Shipped_Weight*0.001) Between (T1.Max_Weight*0.001)*0.95 And (T1.Max_Weight*0.001) Then 'containers_95_100'
Et1Se 'containers_above_weight'
End Grouping_Condition
From
Tabt1E1 T1
,Tabt1E2 T2
,Tabt1E3 C
Where
T1.Co11 = T2.Col1
And T1.Col2=C.Col2
And More Conditions
Where Warehouse In ('W1','W2','W3','W4','W5')
Group By (Grouping_Condition,Warehouse)
The Above Query Gives Me Output Something Like Below:
Grouping_Condition Warehouse Total Total_Containers_Per_Warehouse Total_Containers Total_Pct
Containers_95_100 W1 5 10 60 50
Containers_Under_95 W1 5 10 60 50
Containers_95_100 W2 10 20 60 50
I've Got Report In The Below Format
W1 W2 W3 W4 W5 Total
Total_Containers 10 20 60
Containers_95_100 5 10 15
Containes_95_100_% 50 50 ????
I Need To Calculate The Total Percentage In The Above Table With ????
Any Help Is Much Appreciated..It appears as though you already have your groupings and counts per grouping, but require a ratio of each groupings count against all other counts. Is that correct ?
If so, try the new 11g analytic function, something like this:
select Grouping_Condition
,Warehouse
,ratio_to_report(Value) over () as Count_Ratio_over_Report
.. -
Need a query for monthly Report
Hello All,
I need a query for monthly report,
comp_code
emp_id
dept_id
work_day
100
A100
MECH
01/01/2013
100
A100
MECH
02/01/2013
100
A100
MECH
03/01/2013
100
A100
MECH
04/01/2013
100
A100
MECH
05/02/2013
100
A100
MECH
08/02/2013
100
A100
MECH
09/02/2013
100
A100
MECH
10/02/2013
100
A100
MECH
12/05/2013
100
A100
MECH
13/05/2013
100
A101
CIV
01/04/2013
100
A101
CIV
02/04/2013
100
A101
CIV
03/04/2013
100
A101
CIV
04/04/2013
100
A101
CIV
06/04/2013
100
A101
CIV
06/06/2013
100
A101
CIV
07/06/2013
100
A101
CIV
08/06/2013
100
A101
CIV
09/06/2013
100
A101
CIV
10/06/2013
100
A101
CIV
11/12/2013
100
A101
CIV
12/12/2013
100
A101
CIV
13/12/2013
100
A101
CIV
14/12/2013
Dear friends this the sample table of my report.In which table has contain list of employees with their working days(actual table has contain almost 5laks of records).
suppose user choose the date between 01/01/2013 and 31/12/2013 then the result should be like this.
comp_code
emp_id
dept_id
month
Total_work
100
A100
MECH
JANUARY
4
100
A100
MECH
FEBRUARY
2
100
A100
MECH
MARCH
0
100
A100
MECH
APRIL
0
100
A100
MECH
MAY
2
100
A100
MECH
JUNE
0
100
A100
MECH
JULY
0
100
A100
MECH
AUGUST
0
100
A100
MECH
SEPTEMBER
0
100
A100
MECH
OCTOBER
0
100
A100
MECH
NOVEMBER
0
100
A100
MECH
DECEMBER
0
100
A101
CIV
JANUARY
0
100
A101
CIV
FEBRUARY
0
100
A101
CIV
MARCH
0
100
A101
CIV
APRIL
5
100
A101
CIV
MAY
0
100
A101
CIV
JUNE
5
100
A101
CIV
JULY
0
100
A101
CIV
AUGUST
0
100
A101
CIV
SEPTEMBER
0
100
A101
CIV
OCTOBER
0
100
A101
CIV
NOVEMBER
0
100
A101
CIV
DECEMBER
4Hi,
If you want the output to include months where no work was done (with 0 in the total_work column) then you need to outer-join a "table" that has one row per month, and make it a partitioned outer join:
WITH got_end_points AS
SELECT TRUNC (MIN (work_day), 'MONTH') AS first_month
, TRUNC (MAX (work_day), 'MONTH') AS last_month
FROM table_x
, all_months AS
SELECT ADD_MONTHS (first_month, LEVEL - 1) AS a_month
, ADD_MONTHS (first_month, LEVEL) AS next_month
FROM got_end_points
CONNECT BY LEVEL <= 1 + MONTHS_BETWEEN (last_month, first_month)
SELECT t.comp_code
, t.emp_id
, t.dept_id
, m.a_month
, COUNT (t.work_day) AS total_work
FROM all_months m
LEFT OUTER JOIN table_x t PARTITION BY (t.comp_code, t.emp_id, t.ept_id)
ON t.work_day >= a.a_month
AND t.work_day < a.next_month
GROUP BY t.comp_code
, t.emp_id
, t.dept_id
, m.a_month
ORDER BY t.comp_code
, t.emp_id
, t.dept_id
, m.a_month
As posted, this include every month that is actually in the table. You can change the first sub-query if you want to enter first and last months.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Point out where the query above is giving the wrong results, and explain, using specific examples, how you get the correct results from the given data in those places. If you changed the query at all, post your code.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Hi! Anybody who has a sample sql query for aging report? basically this is the table structure and sample data
bill_no B1-01 B1-02 B1-03
bill_date 01-JAN 01-FEB 01-MAR
previous_balance 100 600 800
current_charges 500 200 400
total_due 600 800 1200
As of march 1, total due is 1200. how can i get the breakdown of 1200 as to the number of days it has been due. ex. 500 (60 days old 01-JAN to 01-MAR), 200 (30 days old), 400 (current)
please help. thanks!
nullSELECT CEIL((SELECT MAX(Bill_Date) FROM Bill)- Bill_Date) Days , Previous_Balance, Current_Charges FROM Bill ORDER BY Days ASC
Then create a matrix reprot. -
Retrieve underlying SQL query for deski report via java SDK in BOXIR2
Hi all,
I am trying to retrieve underlying SQL queries of a deski report in BOXIR2. However I find the error as
oDataProvider = oDocumentInstance.getDataProviders().getItem(i1);
System.out.print(oDataProvider.getName());
oSQLDataProvider = (SQLDataProvider) oDataProvider;
oSQLContainer_root = oSQLDataProvider.getSQLContainer();
But "This feature is not supported for desktop Intelligence " exception has occured.
I am running the same query for Webi, and I did not find any issue . After several time spending in google, it appears to me that this code is supported by webi only. But "This feature is not supported for desktop Intelligence " exception has occured.
Please help me to find out the solution in java SDK. If its not supported by Java SDK, then could you please provide me any workaround , e.g. any macro . Any help !!
Regards,
Nita
Edited by: Nita Prasad on Aug 11, 2009 11:20 AM
Edited by: Nita Prasad on Aug 11, 2009 11:25 AMHi Fritz,
I am not getting the way.. how to open the deski report programmatically. I am writing the code in this way:
Dim oInfoObjects1 As CrystalInfoStoreLib.InfoObjects
Set oInfoObjects1 = oInfoStore.Query("SELECT * FROM CI_INFOOBJECTS WHERE SI_NAME='" & oInfoObject.Title & "' AND SI_ID='" & oInfoObject.Id & "' order by SI_NAME")
Dim oInfoObject1 As CrystalInfoStoreLib.InfoObject
Dim UserCount1 As Integer
UserCount1 = oInfoObjects1.ResultCount
MsgBox "SELECT * FROM CI_INFOOBJECTS WHERE SI_NAME=' " & oInfoObject.Title & " ' AND SI_ID=' " & oInfoObject.Id & " ' order by SI_NAME"
MsgBox " Total number of Deski reports are : [" & UserCount1 & "]", vbOKOnly
Dim j As Integer
For j = 1 To UserCount1
Set oInfoObject1 = oInfoObjects1.Item(i)
sFile_ReportList = StrConv(oInfoObject1.Title, vbLowerCase) & ".rep"
sFile_Output = "D:\TraceWrite1\ " & StrConv(oInfoObject1.Id & "_" & oInfoObject1.Title, vbLowerCase) & ".txt"
sFile_ReportListTemp = StrConv(oInfoObject1.Files.Item(j), vbLowerCase)
MsgBox "[" & sFile_ReportList & "]", vbOKOnly
If Dir(sFile_ReportList) = "" Then
MsgBox "The text file [" & sFile_ReportList & "] for the DeskI documents does not exist!" & vbCrLf & "Aborting process."
Exit Sub
End If
I am getting the error on line ... If Dir(sFile_ReportList) = "" Then... The code is not able to locate the deski report path.
Is this the correct way to get a deski report information? Please let me know, If I am going in the right direction.
Edited by: Nita Prasad on Aug 18, 2009 3:47 PM -
Dear All,
My A/P Invoice entry is as Follows.
A/P Invoice
1) Item code (Multiple Items Possible)
2) Quantity per item
3) Unit Price per item
4) Under frieght I entry 3 freight value
5) Tax Code is selected
The report required is
1) A/P Invoice No
2) A/P Post Date
3) A/P Documnet date
4) A/P Vendor Code
5) A/P Vendor Name
6) Vendor state ( From Vendor Master date Address)
7) Vendor Cst no / Vat no / Tin No ( These all are UDF)
8) A/P Doc total before Discount ( This does not contain frieght value) ( I am able to obtain this from the OPCH-- Max 1099 Amount Field)
9) A/P Doc total After discount
10) A/P Feieght Break up.
11) A/P DOc total + Excise details
12) A/P Tax Code
13) A/P Tax Amount
14) A/P Final Total Value
The main issue is till point number (8) I can get the query after that the query goes wrong.
I need a similar query for A/R Invoice also.
Please advice.hi aslam,
Try this query,
SELECT T0.DocNum as 'AP Invoice No.',
T0.DocDate as 'Posting Date',
T0.TaxDate as 'Doc. Date',
T0.CardCode as 'Vendor Code',
T0.CardName as 'Vendor Name',
T1.State1,
T2.TaxId1 as 'CST No.',
T2.TaxId11 as 'TIN No.',
T0.Max1099, T0.DocTotal,
T0.TotalExpns,
T0.VatSum
FROM [dbo].[OPCH] T0 INNER JOIN [dbo].[OCRD] T1 ON T0.CardCode = T1.CardCode
INNER JOIN [dbo].[PCH12] T2 ON T0.DocEntry = T2.DocEntry
WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'
Whether it solves ur requirement ?
Jeyakanthan -
TDS Amount on Vendor Advance Shows positive value in *QUERY* for TDS Report
Hi Everybody,
I have made a query for List of TDS Report with Vendor informations as required by my client. In which the value of TDS on Vendor Advance Payment appears as positive value instaead of negative value. Please suggest how to rectify.
Thanks,
PaulDear,
If you have cleared the advance in F-54, then this will reverse the tax amount. That could be the reason for tax amount in debit. -
I have a program written which uses the print report function. Everything works fine in the uncompiled code, my report prints just fine. I can compile my project all the way to a full installer. When I run the executable I get the error:
Error 7 occurred at Get LV Class Default Value.vi
With the following text:
Possible reason(s):
LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS X, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
=========================
NI-488: Non-existent board.
Complete call chain:
Get LV Class Default Value.vi
NI_report.lvclass:New Report.vi
print report.vi
EMS V3.0 streamline.vi
LabVIEW attempted to load the class at this path:
H:\InMotion\EMS\builds\EMS_01\Emissions Analyzer\EMS.exe\1abvi3w\vi.lib\Utility\NIReport.llb\Standard Report\NI_Standard Report.lvclass
"EMS V3.0 streamline.vi" is my main vi, "print report.vi" is the subvi that creates and prints the report based on all the information sent to it. I get no warning when I compile this to an executable. I already tried repairing both LV SP1 and the report generator toolkit. No change after I compile to an exe.
Any help would be appreciated. Thanks.
Garrett HerningOk, I tried that... and now I get an error when I try to compile to an executable... This is right at the end of the build and will not let me build an executable.
Error:
An error has occurred. Expand the Details section for more information.
Details:
Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference:
Error 7 occurred at Invoke Node in AB_Build.lvclass:Copy_Files.vi->AB_Application.lvclass:Copy_Files.vi->AB_EXE.lvclass:Copy_Files.vi->AB_Build.lvclass:Build.vi->AB_Application.lvclass:Build.vi->AB_EXE.lvclass:Build.vi->AB_Engine_Build.vi->AB_Build_Invoke.vi->AB_Build_Invoke.vi.ProxyCaller
Possible reason(s):
LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS X, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
=========================
NI-488: Non-existent board.
Method Name: Linker:Write Info To File -
Sample for printing report directly to printer
Hi Guys
Does anyone have a report which can print directly to the printer when the radio button option is selected .
I want to print the ALV in excel format.
Printer >>>>.
Screeb >>>>>
Regards
P.EslamHi
I tried with this FM but giving short dump error can anyone explain why pls see the below program for testing.
REPORT Z_ESLP_ZTCODE .
"LINE-SIZE 600 .
TABLES : AGR_TCODES,
AGR_USERS,
TSTCT.
type-pools: slis. "ALV Declarations
CONSTANTS MARK VALUE 'X'.
*Data Declaration
LIFNR, NAME1, STRAS, ORT01, REGIO, PSTLZ, PFACH, LAND1
TYPES: BEGIN OF T_DISP,
AGR_TCODES TYPE AGR_TCODES-TCODE , " Transaction code A
AGR_NAME TYPE AGR_TCODES-AGR_NAME, " Role Name B
AGR_UNAME TYPE AGR_USERS-UNAME, " Short User Name B
TTEXT TYPE TSTCT-TTEXT, " Description Name C
TEXTC TYPE USER_ADDR-NAME_TEXTC, " Long User Name
SPRSL TYPE TSTCT-SPRSL , " Language c
END OF t_disp.
DATA: it_disp TYPE STANDARD TABLE OF t_disp INITIAL SIZE 0,
wa_disp TYPE t_disp.
*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,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
DATA:L_PARAMS TYPE PRI_PARAMS,
L_VALID TYPE C.
DATA: w_file TYPE rlgrap-filename VALUE 'it_value'.
SELECTION PARAMETER CRITERIA
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: P_TCODE FOR AGR_TCODES-TCODE , "OBLIGATORY, "no-extension no intervals,
U_NAME FOR AGR_USERS-UNAME,
R_NAME FOR AGR_USERS-AGR_NAME .
SELECTION-SCREEN END OF BLOCK BLK1.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN END OF BLOCK BLK2.
SELECTION-SCREEN END OF BLOCK BLK.
SELECTION-SCREEN BEGIN OF BLOCK radio WITH FRAME.
PARAMETERS :scr RADIOBUTTON GROUP rbg1 ,
pr RADIOBUTTON GROUP rbg1 .
SELECTION-SCREEN END OF BLOCK radio.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
fieldcatalog-fieldname = 'AGR_UNAME'.
fieldcatalog-seltext_m = 'User'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'TEXTC'.
fieldcatalog-seltext_m = 'Name'.
fieldcatalog-outputlen = 50.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGR_NAME'.
fieldcatalog-seltext_m = 'Role Name'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGR_TCODES'.
fieldcatalog-seltext_m = 'Trans Code'.
fieldcatalog-col_pos = 3.
fieldcatalog-outputlen = 15.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'TTEXT'.
fieldcatalog-seltext_m = 'DESCRIPTION'.
fieldcatalog-outputlen = 40.
fieldcatalog-col_pos = 4.
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).
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_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_disp
exceptions
program_error = 1
others = 2.
if sy-subrc EQ 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 lfa1 table and populate itab it_lfa1
form data_retrieval.
CASE MARK.
WHEN scr.
SELECT AGR_TCODESTCODE AGR_TCODESAGR_NAME AGR_USERSUNAME TSTCTTTEXT USER_ADDR~NAME_TEXTC
INTO TABLE IT_DISP
FROM AGR_TCODES
INNER JOIN AGR_USERS
ON AGR_TCODESAGR_NAME = AGR_USERSAGR_NAME
INNER JOIN USER_ADDR
ON AGR_USERSUNAME = USER_ADDRBNAME
INNER JOIN TSTCT
ON AGR_TCODESTCODE = TSTCTTCODE
where
agr_tcodes~tcode in p_tcode
and
agr_users~uname in u_name
and
agr_tcodes~agr_name in r_name
and
TSTCT~SPRSL EQ 'E'.
WHEN pr.
CALL FUNCTION 'FTBU_START_EXCEL'
EXPORTING
data_name = w_file
data_path_flag = 'T'
*---Start Excel and not Wait
wait = ' '
TABLES
data_tab = it_disp
EXCEPTIONS
no_batch = 1
excel_not_installed = 2
wrong_version = 3
internal_error = 4
invalid_type = 5
cancelled = 6
download_error = 7
OTHERS = 8.
NEW-PAGE PRINT ON PARAMETERS L_PARAMS NO DIALOG.
write : 'print'.
NEW-PAGE PRINT ON.
ENDCASE.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'Transaction codes by User and Role Name ' .
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_disp lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Transaction Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform. -
Check print report PaymentAmountText field gets spaces while using RPAD Fn
Hi,
In the check print report we are using the PaymentAmountText field to print the amount in text.
After printing the remaining spaces should be filled with '*'
I used the below command
<?xdofx:rpad(PaymentAmountText,100,'*')?>
But the output is as follows:
Twenty-Five Pounds And Fifty Pence
Only***********************************************
There is a huge space between two words.
So please suggest some ideas to remove the space between two words.There is a huge space between two words.
So please suggest some ideas to remove the space between two words.
you can use normalize-space(tag_name) like
Result - <xsl:value-of select="normalize-space('Initial werwe rrr r r')"/>
and result as
Result - Initial werwe rrr r r
also look at Re: Problem with Rpadding in RTF -
Hi,
I have to generate a report which contains a query with database link. This database link is not hard coded and would be picked up from another report which contans a link to this report. So this database link value for the query could be any. Can anyone guide me hot to write a dynamic select statement so that i could append database link value at run time.
Thanks
SalmanHi,
You can not directly use a PL/SQL query to create an Interactive Report - that is not yet available.
What you could do is create a collection from your query and then use that for the report. Have a look at: [http://download-uk.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/advnc.htm#BABGHJFD].
In there, you will see APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY - this allows you to create a collection from a string. You could add a PL/SQL process to your page that runs "On Load: Before Header" that actually creates the collection. Something like:
BEGIN
IF APEX_COLLECTION.COLLECTION_EXISTS('MYCOLLECTIONNAME') THEN
APEX_COLLECTION.DELETE_COLLECTION('MYCOLLECTIONNAME');
END IF;
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY('MYCOLLECTIONNAME','MY SQL QUERY STRING');
END;Your Interactive Report can then be based on:
SELECT SEQ_ID, C001, C002, C003, ...
FROM APEX_COLLECTIONS
WHERE COLLECTION_NAME = 'MYCOLLECTIONNAME'The tricky part is the headings as these would tend to be the SEQ_ID, C001, C002, C003, etc column names from the collection itself.
To get around this, make sure that the report's sql statement includes as many Cnnn columns as you will need for the widest of the reports. Before doing anything else, run the report once to make sure that all these columns are included in the output.
Then, through Shared Components, Application Items, create items that will hold heading names - for example, G_HEADING1, G_HEADING2 etc - one for each possibile column.
Now, update the process to:
BEGIN
IF APEX_COLLECTION.COLLECTION_EXISTS('MYCOLLECTIONNAME') THEN
APEX_COLLECTION.DELETE_COLLECTION('MYCOLLECTIONNAME');
END IF;
IF ..test1.. THEN
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY('MYCOLLECTIONNAME','MY SQL QUERY STRING 1');
:G_HEADING1 := 'ColumnHeading1Value';
:G_HEADING2 := 'ColumnHeading2Value';
:G_HEADING3 := NULL; -- column not used for this query, so set it to null
ELSIF ..test2 .. THEN
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY('MYCOLLECTIONNAME','MY SQL QUERY STRING 2');
:G_HEADING1 := 'ColumnHeading1Value';
:G_HEADING2 := 'ColumnHeading2Value';
:G_HEADING3 := 'ColumnHeading3Value';
ELSIF ...etc...
.. etc ...
END IF;
END;Finally, on the report itself, set the column headings to *&G_HEADING1.*, *&G_HEADING2.* etc. Then, on each column, set a Condition of "Value of Item in Expression 1 is NOT NULL" and in Expression 1, enter in the application item for that column - eg, G_HEADING1
I have done all that here: [http://apex.oracle.com/pls/otn/f?p=16338:5] - select either Departments or Employees from the list and the report will change.
Andy -
Capture current query for a report region
Apologies if this is answered elsewhere, but I could not find it.
I have a reporting application where several different reports that have a list of customers. I would like to develop a means to generate a mailing list for the customers that is generic and can be used on any report. I envision getting the list of customer by executing a query like:
select person_id from
( <report region query> );
Is there a way to get the current query (or query result) for a report region and process it in a PL/SQL procedure? This would need to work for regions that have an SQL query and a PL/SQL function returning a query.
Thanks,
Billsorry for the double post, browser trouble...
Maybe you are looking for
-
I'm a teacher at a music department at a small University. We have digitized our entire CD library to MP3's, and allow students to listen to MP3's at certain designated computers. We protect the MP3's, however, and do not allow students to download t
-
How do I get the new photos albums from my imac to sync to my iphone?
Last week my iMac did the software update that replaced iPhoto on my iMac with the new Photos application. Since then, I have migrated all my iphoto library to the Photos library and have been able to further sort my photos in the albums area. I have
-
How to set the value of Day in JSpinner of format DD:HH:mm
Hi All, I am trying to implement a spinner of format day:HH:mm but the problem is that I didn't any function by which I can set some dynamic value in Day (for initial display). I can set some value in hour and minute by using Date fDate = new Date();
-
hello there -- i am contemplating subscribing for an online number but i have a question i can't quite find the answer to... i understand that with my own number, anyone from anywhere call call me on it, and pay their local rates for making that call
-
Hi, I just got a Verizon iPhone and used Verizon's app to transfer my contacts from the old Verizon phone to the iPhone. Then I set my Yahoo contacts to sync with the iPhone over the air. If I add a new contact on the iPhone, it will sync to Yahoo bu