How to add a new field from SQL to report
Post Author: Auburn
CA Forum: .NET
The field I am wanting to add to my report is not an actual field in SQL. The field is actually a calculation done in the Select statement like this: SELECT (SUM(CASE KILSHEET.Contract WHEN 1 THEN ((TOT_CARC_WEIGHT / 100) * 1.75) ELSE 0 END)) AS LSS here is the actual full SELECT: SELECT Sum(KILSHEET.PAY) As Pay, Sum(KILSHEET.Dead_Pay) As Dead_Pay, Sum(KILSHEET.GRADE_PREM) As Grade_Prem, Sum(KILSHEET.SORT_ADJ) As Sort_Adj, Sum(KILSHEET.SLOWS_PAY) As Slows_Pay, Sum(KILSHEET.RESALES_PAY) As Resales_Pay, Sum(KILSHEET.PLANT_CHARGE) As Plant_Charge, Sum(KILSHEET.OTHER_PREM) As Other_Prem, Sum(KILSHEET.NPB) As NPB, Sum(KILSHEET.SLOW_NPB) AS Slow_NPB, Sum(KILSHEET.RESALE_NPB) AS RESALE_NPB, Sum(KILSHEET.NPPC) AS NPPC, Sum(KILSHEET.SLOW_NPPC) AS SLOW_NPPC, Sum(KILSHEET.RESALE_NPPC) AS RESALE_NPPC, Sum(KILSHEET.NUMB_HEAD) AS NUMB_HEAD, Sum(KILSHEET.WEIGHT_FEE) AS WEIGHT_FEE, Sum(KILSHEET.SLOW_WEIGHT_FEE) AS SLOW_WEIGHT_FEE, Sum(KILSHEET.RESALE_WEIGHT_FEE) AS RESALE_WEIGHT_FEE, Sum(KILSHEET.WEIGHT) AS WEIGHT, Avg(KILSHEET.PER_LEAN)AS PER_LEAN, AVG(KILSHEET.ACTUAL_YIELD_PER) AS ACTUAL_YIELD_PER, AVG(KILSHEET.AVG_BACKFAT) AS AVG_BACKFAT, Sum(KILSHEET.TOT_CARC_WEIGHT) AS TOT_CARC_WEIGHT, Sum(KILSHEET.DIY) AS DIY, Sum(KILSHEET.DEAD) AS DEAD, Sum(KILSHEET.SLOWS) AS SLOWS, Sum(KILSHEET.RESALES) AS RESALES, Sum(KILSHEET.CONDEMNED) AS CONDEMNED, Sum(KILSHEET.DEAD_WEIGHT) AS DEAD_WEIGHT, Sum(KILSHEET.CONDEMNED_WEIGHT) AS CONDEMNED_WEIGHT, Sum(KILSHEET.SLOWS_WEIGHT) AS SLOWS_WEIGHT, Sum(KILSHEET.RESALES_WEIGHT) AS RESALES_WEIGHT, SUM((Kilsheet.TOT_Carc_WEIGHT / 100) * MarketPrice.mkprice) As TotalPrice,(SUM(CASE KILSHEET.Contract WHEN 1 THEN ((TOT_CARC_WEIGHT / 100) * 1.75) ELSE 0 END)) AS LSS FROM KILSHEET LEFT OUTER JOIN marketprice ON KILSHEET.Contract = marketprice.contract AND DATEPART(week, KILSHEET.KILLDATE) = marketprice.mkweek AND DATEPART(year, KILSHEET.KILLDATE) = marketprice.mkyear " & condStr + " " + locStr The problem with this is that my report is a Summary report. It has to summarize multiple fields and the LSS calculation only needs to be calculated for certain records, hence the CASE. Is there a way to add the LSS field to the report without it being physically part of the database? I am really struggling with this and any help would be greatly appreciated. I hope I described this ok.
Post Author: blairwheadon
CA Forum: .NET
This is what SQL Expressions are for. I suggest you try using those (visible in the Field Explorer) to capture custom SQL field logic.
Alterantively you could use a SQL command with your hand-written SQL.
Thanks, Blair
Similar Messages
-
Hi All ,How to add a new field for MEDRUCK if we havea ZMEDRUCK
Hi All ,
How to add a new field for MEDRUCK if we have a ZMEDRUCK
Req: If I want to add a new field for the following text editor line :
IN MAIN WINDOW > TEXT EDITOR> SERCH FOR TOTAL_AMOUNT-->
In that we will have
&ekko-waers& &komkfkwrt&
(currency) (numerics)
Pls send the Code to make these changes .Pls its urgent
Thanks&Regards.
Bharat.Hi
If that field which you wants to add is available in one of the structures like EKKO,EKPO then you can add that field just beside the other fields
If that field is not there in the any of the structures then you can define a variable using define command
/: DEFINE &VAR&
/ &VAR& = <some value>
or you can write subroutines to fetch the data from outside tables and can use those fields data in the script
<b>Reward points for useful Answers</b>
Regards
Anji -
How to add a new field in MM01, with say contaminent as a field?
How to add a new field in MM01, with say contaminent as a field? I process that i know is i has to go the user exit and check out the three user exits that are available for MM01 after that what i have to do please can any one help me out with the procedure to proceed?
Hai venkateshwar reddy ,
try with these user exits
MGA00001 Material Master (Industry): Checks and Enhancements
MGA00002 Material Master (Industry): Number Assignment
MGA00003 Material Master (Industry and Retail): Number Display
Refer these steps also
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/screen-exit-on-mm01-mm02-mm03-322717# -
How to add a new field in the cube and load data
Hi,
The requirement is
We have ZLOGISTICS cube , the data souce of this filed has REFDCONR-reference dcument number filed . We have to create a new field in cube load data and get this new filed into the report also.
Please any one can help me with the step by step process of how to do?
How to get the data into BW and into the report.Hi,
So you need that this new field have data in old records?
1.- If you are in BI 7.0 and the logic or data for that New field are in the same Dimension, you can use a Remodeling to fill it. I mean if you want if you want to load from a Master Data from other InfoObject in the same Dim.
2.- If condition "1" is not yours.
First add the new field, then create a Backup Cube (both cubes with the new field) and make a full update with all information in the original Cube. The new field willl be empty in both cubes.
Create an UR from BackUp_Cube to Original_Cube with all direct mapping and create a logic in the Start Routine of the UR (modiying the data_package) you can look for the data in the DSO that you often use to load.
To do that both cubes have to be Datasources ( right click on Cube-> aditional function-> and I think is "Extract Datasource")
Hope it helps. Regards, Federico -
How to add a new Field in the Dynamic Selection screen section.
HI,
There is a requirement in which I need to add a field in existing program of dynamic selections.
I need to add a field KNKK-DBRTG (Customer Rating) in dynamic selections screen of some existing report
which has a dynamic selection screen with other fields like customer account, company code etc. Along with this i need to add Customer rating field also in the selection screen.
I have used GET KNKK statement to select this in the Dynamic selection screen. But I need to make it appear
on the screen.
LDB used is the Customer Database.
I have added GET KNKK statement after GET KNA1 statement.
Can any one help me how we can make this rating field appear in the selection screen.
With the GET statement Credit control area Fields can be selected in the selection screen but I have to permanantly add the field in the selection screen.
Regards
Prashant PrabhuHi,
So you need that this new field have data in old records?
1.- If you are in BI 7.0 and the logic or data for that New field are in the same Dimension, you can use a Remodeling to fill it. I mean if you want if you want to load from a Master Data from other InfoObject in the same Dim.
2.- If condition "1" is not yours.
First add the new field, then create a Backup Cube (both cubes with the new field) and make a full update with all information in the original Cube. The new field willl be empty in both cubes.
Create an UR from BackUp_Cube to Original_Cube with all direct mapping and create a logic in the Start Routine of the UR (modiying the data_package) you can look for the data in the DSO that you often use to load.
To do that both cubes have to be Datasources ( right click on Cube-> aditional function-> and I think is "Extract Datasource")
Hope it helps. Regards, Federico -
How to add a new field in the Field Mapping
Dear Freinds,
I have two un used fields in the Source fields to the Target Fields ,
i have to add the 3 fields which r there in the my source fields to that
of the target fields ( as per the change in the requirement) in the 5th Step
i.e Maintain Field Mapping and Conversion Rules
the Target strucutre & the Source fields( by clicking the button
Source field and selcting the fields from the popup menu) in the mapping and conversion step ,i want to add 3 fields which are availabe in the list of th source list which i want to map to the Target strucutre .
When i tried it is adding in the othe target field
presently i have mapping (5th sept ) as below.
ZPA30_08 LSMW
Fields
TABNAME Table Name
Source: ZP0008_STRC-PERNR (Personnel Number)
Rule : Default Settings
Code: ZPA30_08-TABNAME = 'ZPA30_08'.
TCODE Transaction Code
Rule : Default Settings
Code: ZPA30_08-TCODE = 'PA30'.
now i want to add 3 fields Pernr,wage type and Amount , but when iam trying it is
getting and saved in the TABNAME .
How can i map please let me know .
Regards
syamlaHi,
So you need that this new field have data in old records?
1.- If you are in BI 7.0 and the logic or data for that New field are in the same Dimension, you can use a Remodeling to fill it. I mean if you want if you want to load from a Master Data from other InfoObject in the same Dim.
2.- If condition "1" is not yours.
First add the new field, then create a Backup Cube (both cubes with the new field) and make a full update with all information in the original Cube. The new field willl be empty in both cubes.
Create an UR from BackUp_Cube to Original_Cube with all direct mapping and create a logic in the Start Routine of the UR (modiying the data_package) you can look for the data in the DSO that you often use to load.
To do that both cubes have to be Datasources ( right click on Cube-> aditional function-> and I think is "Extract Datasource")
Hope it helps. Regards, Federico -
Add a new field(from transparent table) to the infoset
Hi,
I need to add a new field to the existing infoset in HR. I found that field exist in the CSKS table. in the infoset they are using PNP logical database. As per my understaning i have to link the CSKS-KOSTL with P0001-KOSTL.
Could you tell me how to do this?
Please do the needful.
Thanks & Regards,
Krishna.Hi,
I have added that KOSAR in the additional fields and i added the code for that like
clear kosar.
select single kosar
into kosar
from csks
where kokrs = p0001-kokrs
and kostl = p0001-kostl.
Is it will work now? One more help how to add this change to the transport?
Please do the needful.
Thanks & Regards,
Krishna. -
How to add a new field to an existing Generic Search result list?
Good day,
I'm new to the concepts of the Generic Search Framework. I'm attempting to add a new field to an existing result list, and have that new field restricted to a value of "C". This new field will not be displayed, it is only used to ensure that Invoice Documents with a DocStatus of "C" are returned to the B2B Application.
From the *modification\generic-searchbackend-config.xml file, the existing
<h4><property-group name="billing_resultlist_B2B_R3">
<property name="BILLINGDOC" columnTitle="sbt.sbs.genericsearch.billing.invoice.title" parameterType="rowkey" hyperlink="b2b/documentstatusdetailprepare.do" linkParamClass="com.sap.isa.ui.uiclass.genericsearch.GenericSearchUIDynamicContent" linkParamMethod="buildAttributesForBillingDocumentDetails" linkTargetFrameName="form_input" />
<property name="BILL_DATE" type="date" columnTitle="status.sales.date" writeUnderProperty="BILLINGDOC" defaultSortSequence="DESCENDING" />
<property name="NET_VALUE" type="number" columnTitle="status.billing.detail.netvalue" fieldOutputHandlerClass="com.sap.isa.ui.uiclass.genericsearch.GenericSearchUIDynamicContent" fieldOutputHandlerMethod="buildBillingNetValue" cssClassName="amount" />
<property name="CURRENCY" type="hidden" />
<property name="PAYER" columnTitle="gs.hd.gl.partner" linkParamClass="com.sap.isa.ui.uiclass.genericsearch.GenericSearchUIDynamicContent" linkParamMethod="buildShowPartnerLinkSales" />
<property name="PAYERS_GUID" type="hidden" />
<property name="SD_DOC_CAT" type="hidden" />
<property name="OBJECTS_ORIGIN" type="hidden" />
</property-group>
</h4>
I'm trying to better understand how the R/3 tables and columns are specified in the Generic Search Framework. I know that the R/3 table and field is: VBRK.RFBSK, but in the configuration XML files, I never see this exact information specified. How it is specified to be a part of the result set?
After reading the section in the Development and Extension Guide, I also learned about the "allowedValue" definition, and I believe that I will use that to specify the "C" value for the Invoice Document Status field.
I would greatly appreciate any help.
Thanks,
_kevinHi Kevin,
this means you are working in this section of the generic-searchbackend-config.xml
<property-group name="SearchCriteria_B2B_Billing"
useSearchRequestMemory="true">
Below this property
<property name="IRT_BDH_BILL_TYPE"
type="box"
entityType="BEART_BILL_TYPE"
tokenType="EXP"
requestParameterName="rc_documenttypes"
label="gs.att.lbl.doc.type"
UIJScriptOnChange="GSloadNewPageR3(this);">
<allowedValue value="ORDER" description="b2b.status.shuffler.key1val2"/>
<allowedValue value="QUOTATION" description="b2b.status.shuffler.key1val1" />
<allowedValue value="INQUIRY" description="b2b.status.shuffler.key1val11" />
<allowedValue value="ORDERTMP" description="b2b.status.shuffler.key1val3" />
<allowedValue value="CONTRACT" description="b2b.status.shuffler.key1val4" />
<allowedValue value="INVOICE" description="b2b.status.shuffler.key1val5" default="true"/>
<allowedValue value="CREDITMEMO" description="b2b.status.shuffler.key1val6" />
<allowedValue value="DOWNPAYMENT" description="b2b.status.shuffler.key1val7" />
<allowedValue value="AUCTION" description="b2b.status.shuffler.key1val9" />
</property>
please try adding this new property
<property name="DOCUMENT_STATUS(1)"
entityType="CL_CRM_REPORT_SET_STATUS"
tokenType="RAN"
type="hidden"
requestParameterName="rc_status_head1" value="C" />
This should do the trick. Unfortunately, I don't have a E-Commerce scenario with an ERP backend for testing purposes available to you have to test it yourself. Keep me updated with the test results !
Philipp Koock
SAP CRM Web Channel Consultant
http://www.koock.net -
How to add a new Field to the WEB User Interface in CRM 2007
Dear experts,
I have been struggling to add a new field to the (CRM 2007) user interface from available fields for a specific view.
I have maintained settings in BS__WD_CMPWBàRuntime Repository editoràComponentàViewàConfigurationàNew ConfigurationàAvailable FieldsàField Propertiesàand save.
But the field is only appearing in display mode in the Web UI, which doesnu2019t allows any user input.
I need your help to resolve the issue, I would be grateful if you could provide step-by-step documentation with screenshots or any other kind of documentation.
Each suggestion will be appreciated.
Best regards,
Raghu ram.Hi Raghu Ram,
I think you added a new custom field using some method like EEWB etc.,
Then, you are adding the field onto the UI using UI Configuration Tool .. right ?
These are the steps to diagnose:
Method 1.Check the field properties in the model browser first.
It should be showing 'C' i.e., CHANGEABLE. If it is showing as 'R', it is only READABLE.
In such a case you need to find a BADI to change the field properties.
For example, in Marketing Applications OBJ BADI has a method CHANGE FIELD PROPERTIES for this purpose.
Method 2. Debug and check what is the value coming for RV_DISABLED parameter in the GET_I method in BSP_WD_CMPWB. This should be FALSE.
Method 3. Check what are the field properties in the UI Configuration tool.
Make sure it is not a display only field.
Regards,
Masood Imrani S. -
Layout Set: How to add a new field in a layout Set?
Hi ABAPPERS.
Question:
How can I add a new field in a layout set?
Scenario:
QC21 uses a global Layout Set ZQMECOA_GLOBAL.
There's a field required in this Layout Set which is Production Date(CAUFVD-GLTRP).
Where is the date query happening here?
Where can I insert the SELECT statement for the new field required?
I try to look at:
OPEN_FORM and WRITE_FORM, it seems that date query or SELECTION of data is not happening here.
Thanks.If you are adding a header field then you will extend the header structure in CRM and do the same with Item structures for Item fields. You will use EEWB or similar technique in the CRM backend to extend the header or item.
These extended fields in the backed are available in customer_h or _i structures in the order object that can be read and modified in the Header BAdI or Item BAdi.
If you think that this message is cryptic or not enough, then you should search for Extension Guide in this forum and read the document. -
How to Add a new fields in the selection screen of LDB.
Hi All,
I want to add a new fields in the selection screen of LDB & then i need to select the data for that fields.
So could you please tell me for that where i need to add the code for selecting the data.
Thanks
RoliHi
welcome to SDN forum
If you are designing your own LDB with your own tables you can define tree structure and then the selection screen for the tables
if you wants to modify the std LDB of SAp means take the access key and to modify that code
if you add the extra field you have to modify the where conditions in the code also
see the doc
A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.
LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.
Less coding s required to retrieve data compared to normal internel tables.
Tables used LDB are in hierarchial structure.
Mainly we used LDBs in HR Abap Programming.
Where all tables are highly inter related so LDBs can optimize the performance there.
Check this Document. All abt LDB's
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2flibrary%2fabap%2fabap-code-samples%2fldb+browser.doc
GO THROUGH LINKS -
http://www.sap-basis-abap.com/saptab.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
Re: **LDB**
www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html
www.sap-img.com/abap/abap-interview-question.htm
www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm
Gothru the blog which provides info on LDB's:
/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
Sample code
TABLES: SPFLI,
SFLIGHT,
SBOOK,
SCARR.
START-OF-SELECTION.
GET SPFLI.
WRITE:/ SPFLI: , SPFLI-CARRID, SPFLI-CONNID,
SPFLI-AIRPFROM, SPFLI-AIRPTO.
GET SFLIGHT.
WRITE:/ SFLIGHT: , SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.
GET SBOOK.
WRITE:/ SBOOK: , SBOOK-CARRID, SBOOK-CONNID,
SBOOK-FLDATE, SBOOK-BOOKID.
GET SFLIGHT LATE.
WRITE:/ GET SFLIGHT LATE: , SFLIGHT-FLDATE.
Regards
anji -
How to add a new field in order.jsp
Hey,
I want to add a new field in order.jsp. How to store that data into backend?If you are adding a header field then you will extend the header structure in CRM and do the same with Item structures for Item fields. You will use EEWB or similar technique in the CRM backend to extend the header or item.
These extended fields in the backed are available in customer_h or _i structures in the order object that can be read and modified in the Header BAdI or Item BAdi.
If you think that this message is cryptic or not enough, then you should search for Extension Guide in this forum and read the document. -
How to add a new field in predefined report output
HI,
how to and where to search for the filling of "fieldcat table" in the predefined ALV report.
So that i can add a new field in the output of a predefined reportHi
Try to check where the fm REUSE_ALV_FIELDCATALOG_MERGE is used in the report.
Max -
How to add a new field on the right side of 'Part function' in Opportunity
HI All
I have a requirement wherein I need to add a new field for 'first name/last name' on the right side of 'Partner function' field in opportunity search criteria..
Ex:(here i'm showing overview how the search criterial screen appears in UI since i can't attach screen shot)
Partner function is sales lead firstname/lastname
It is similar to...when we select the option 'Is between' for date field then automatically one extra field will appear
on the extreme right to enter a range for the date so similary I need to add one field to the extreme right where
the user will select 'first name/lastname' using 'F4' help in addition the abvoe 'Partner function'.
Could you please let me know how can we add it??
Regards
AnilHi,
First try to find out if you already have that field available in your view configuration. If yes, then you just need to add that to visible/displayed fields. Other wise you'd have to extend the context nodes using AET/EEWB. After you add the fields using configuration you can move them where ever you want to place them. I believe for first name/last name F4 comes by default.
Regards
Prasenjit -
How to add a new field to the Quote: Shipping and Bill Tab Payment region
Hello All,
We have a requirement to add payment description column to the Payment Region of Shipping and Bill tab in Quoting User(Quote Page).
We have extended the View object HeaderPaymentsVOObj and created a custom view object, then created and ported the substitution.
In Quotes page, 'Shipping and Bills' tab Payments region, we have created a new item(Payment Description), assigned the custom View object instance and attribute to it.
We are able to enter and update the payment details before substitution, but after substitution while entering payment details we are facing the below error.
At most one payment record can exist at quote header/line level.
Help and inputs are highly appreciated.
Thanks in advance.
Regards,
Supriya.Hi,
So you need that this new field have data in old records?
1.- If you are in BI 7.0 and the logic or data for that New field are in the same Dimension, you can use a Remodeling to fill it. I mean if you want if you want to load from a Master Data from other InfoObject in the same Dim.
2.- If condition "1" is not yours.
First add the new field, then create a Backup Cube (both cubes with the new field) and make a full update with all information in the original Cube. The new field willl be empty in both cubes.
Create an UR from BackUp_Cube to Original_Cube with all direct mapping and create a logic in the Start Routine of the UR (modiying the data_package) you can look for the data in the DSO that you often use to load.
To do that both cubes have to be Datasources ( right click on Cube-> aditional function-> and I think is "Extract Datasource")
Hope it helps. Regards, Federico
Maybe you are looking for
-
The Airplay Screen saver option telling me to choose a wi fi and choose this apple tv keeps poping up on my apple tv when it goes on screen saver mode. It blocks all of my photos showing on my screen saver. Can anyone help me to remove this
-
Business Process Engine Error and Adapor Monitor JPR error in PI 7.0 Server
Hello, I have installed PI7.0 Server on windows server. When I use SXMB_IFR tcode I got RWB screen and RWB Business Process Engine is in red. though I have configured automatic workflow customizing through SWF_XI_CUSTOMIZING tcode. Still i am getting
-
How to connect ndr3700 to airport extreme
how do i connect my extreme to existing netgear NDR3700
-
Editing audio files in Yosemite
How can I edit (trim, add chapters) audio (MP3) files in Yosemite on my iMac?
-
Deleted objects assigned to transport..
hi , i created one object, it is assigned to a transport. like a Ztable. Then when i delete it again transport request is being asked !! why ? what does this mean ? what happens to this transport then ? what shud i do with this ?? thks