ABAP Query: creation of local field (Subtraction between 2 dates)
Hi,
I want to create a local field which will calculate the number of days between 2 dates (for example, document date - posting date).
What I did:
1) Created the user group in SQ03
2) Created the infoset in SQ02
3) I'm stucked at the creation of the Query in SQ01. I'm at the «Create Query: Select field screen». I clicked on Edit --> Local Field --> Create. I selected the «calculation field» attribute. I clicked on the «Complex calculation button», but I don't know how to write my formulate DOCUMENT DATE - POSTING DATE.
Thanks a lot for your help.
Julien
Try these FM's to calculate difference between two dates..
DAYS_BETWEEN_TWO_DATES
LEAP_DAYS_BETWEEN_TWO_DATES
HR_SEN_CALE_DAYS_DATE
ISB_DAYS_BETWEEN_TWO_DATES
FIMA_DAYS_BETWEEN_TWO_DATES
FIMA_DAYS_BETWEEN_TWO_DATES_2
FIMA_LEAP_DAYS_BETWEEN_2_DATES
SD_DATETIME_DIFFERENCE
Similar Messages
-
Creation of local field in ABAP Query
Hi
Please let me know how to create a local field in ABAP query. I am finding the option inactive in SQ01.
Regards
Priyadarshinihi priya,
*__Adding u201CLocal Fieldu201D (user defined field) in SAP Query_ :
There is also facility to add the user defined fields in SAP query output. Also we can provide calculation formula for calculating values for this user defined field.
Calculation formula consists of standard fields from standard SAP tables. So the values fetched for particular standard SAP fields from standard SAP tables get calculated as per the calculation formula defined for the user defined field and displays the value accordingly.
To do this first go to change mode for Query which automatically takes you to screen shown below and click on icon , as below :
Then further screen will appears. So select the Field group and again click on the same icon button .
Then switch on the Short names for the fields and give the short names to fields which we need to use in Calculation formula.
Give the short names and then created u201CLocal Fieldu201D, as shown in below screen shot. Also Short names are given to fields, which can be used further for calculation.
Defining Local Field u201CREM_QTYu201D along with its field type and Calculation formula.
In this case we have
defined field type for new
field as similar to
ORD_QTY and
Calculation formula is
defined.
Also its possible to have Conditional logic for Local field by putting Condition in u201CConditionu201D line.
Now activate this newly added Local field for coming it in output screen. To do the same again go to u201CBasic Listu201D and activate the Local Field as shown below :
i think this will help u
regards,
sindhu. -
Including MANDT field in ABAP Query Report as output field
Hi All,
I need to display the client(MANDT) field in the ABAP Query Report as an output field.
But in SQ01 where we select the fields to be displayed as output in query , this field is not visible.
I later checked in the Infoset. Even in the infoset the field MANDT is greyed out and all other fields are active.
Can someone tell me how to include the field MANDT in the output of the ABAP Query Report.self resolved
-
ABAP QUERY - Adding a new field in the output
Hello ,
I am creating a ABAP query in which i need to do a calculation and display it in the output.
How do i do it?
I have added the field PLAF-GSMNG and PLAF-AVMNG in the infoset.
The calculation that i have to do is CALCULATEFIELDS = PLAF-GSMNG - PLAF-AVMNG.
I have to display the CALCULATEFILEDS in the output. How do i add this field and where do i do the calculation for this.
Regards
AshishHi Kanagaraj,
Thanks a lot for your help.
Actually those steps dint work but i created a new infocube and copied the structure from old infocube and then just created a Transformation and DTP.It worked fine.Did not generate a export datasource.
But for my previous question
3 characteristics and 3 keyfugures.
Want to add a new field based on the department ID
Tthe values have to be populated for the new field.
It is not a constant value.So what should i choose in the conditons.
Regards,
Harish -
Abap Query - Creation of Report
Hi guys,
I do have a question to ABAP Query:
I want to create a report that shows me all current active employees and all of their corresponding positions from Infotype 1.
I have got it to the part where the report gives me all employees (active and withdrawn).
The question is:
How can I show only active employees as of todays date?
Thanks,
SaschaThanks for your reply,
but if I enter date 31.12.9999 and status of active. it gives me for some the latest record and for some two - though I could not find out why?!
I should say, I am using logical database PNP for this query
null -
ABAP query- unable to delete the join between tables
Im unable to delete the join between two tables. when i right clicked on the join then it gives two options:
1. Display join condition
2. Remove join condition
both these options are grey in color so i cant select them. how can i remove join?goto SQ02 and enter infoset and goto change mode agagin select change mode and click the join then select and delete link...
-
Hello all,
I understand that SAP automatically generates an ABAP program for every ABAP Query wherein the selection fields are connected by an "AND" statement within the WHERE clause of the actual SELECT statement.
Is there a way to control this WHERE clause in such a way that we can use "OR" operators as well to connect some selection fields?
Thanks in advance,
JohnHi, Everyone .
We can do that .
At selection-screen output (code section 13), set "1" to the field REQUIED by using MODIFY SCREEN code .
(You can get Dynpro number by F1 key or T-cd SE51 )
Masao .
Edited by: MASAO NONAKA on Oct 20, 2008 9:11 AM -
SAP Query - Extract part of field
Hi,
I created a query with a local field. I want to extract only the last 3 characters of a field.
Is there a LEFT or RIGHT function I can use like in Excel?
The field I want to extract it from is 12 characters long.
Hope someone can help.
Thanks, LupeYou can not fetch only 3 characters directly
There are 3 ways you can achieve this
1> Create additional field in the infoset and code the logic. (If this report is used frequently, you should use this)
2> Download the output of query in the excel and perform excel actions (Use this if the report is not frequently required. Does not take much time to fetch 3 characters)
3> if the report format is fixed, you can create ABAP report and code yo fetch only 3 characters -
Need to create an ABAP query on 2 tables BSIK and BSAK
Hi,
I need to create an ABAP query which has the fields document no, doc date, amount in doc currency and some other fields from 2 tables BSIK and BSAK. Is it possible to write a single abap query to fetch the data from both the tables.
The selection screen fields are doc number, date and doc type.
I need to display invoices for open items and cleared items together.
Please let me know if this is possible.
Thanks and Regards,
AjithSee if this is anything like what you need:
REPORT ztest MESSAGE-ID 00.
TABLES: bkpf, bseg.
SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs,
s_belnr FOR bkpf-belnr,
s_gjahr FOR bkpf-gjahr,
s_blart FOR bkpf-blart,
s_budat FOR bkpf-budat.
DATA: BEGIN OF bkpf_int OCCURS 0.
INCLUDE STRUCTURE bkpf.
DATA: END OF bkpf_int.
DATA: BEGIN OF bseg_int OCCURS 0.
INCLUDE STRUCTURE bseg.
DATA: END OF bseg_int.
DATA: BEGIN OF bsik_int OCCURS 0.
INCLUDE STRUCTURE bsik.
DATA: END OF bsik_int.
SELECT *
FROM bkpf
INTO TABLE bkpf_int
WHERE bukrs IN s_bukrs
AND belnr IN s_belnr
AND gjahr IN s_gjahr
AND blart IN s_blart
AND bldat IN s_budat.
SORT bkpf_int BY bukrs belnr gjahr.
SELECT *
FROM bseg
INTO TABLE bseg_int
FOR ALL ENTRIES IN bkpf_int
WHERE bukrs = bkpf_int-bukrs
AND belnr = bkpf_int-belnr
AND gjahr = bkpf_int-gjahr
AND koart = 'K'.
SORT bseg_int BY bukrs belnr gjahr buzei.
LOOP AT bseg_int.
MOVE-CORRESPONDING bseg_int TO bsik_int.
READ TABLE bkpf_int WITH KEY
bukrs = bseg_int-bukrs
belnr = bseg_int-belnr
gjahr = bseg_int-gjahr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE-CORRESPONDING bkpf_int TO bsik_int.
APPEND bsik_int.
ELSE.
MESSAGE e001 WITH 'Error during read'.
ENDIF.
ENDLOOP.
Rob -
Unable to access Archived data with an ABAP Query
I have an ABAP Query that uses Logical Database KDF (Vendor) for reporting.
KDF is Archive Enabled and I can access archived document via SAP standard programs that used the KDF Logical Database.
the query appears accessing the data but nothing shows on the report.
Has anyone successfully written and ABAP query and included access to the Archived data?
Any help is appreciated.Hi Gena,
I'm facing exactly the same problem as you...
Since this post is an old one, I imagine that you may not remember, but I have to try...
Have you solved it? If yes, could you please tell me how?
I've tried to use CL_ABAP_GZIP and CL_ABAP_UNGZIP_BINARY_STREAM and I'm getting the same error 30 at the IctDecompressStream function.
Tks in advance,
Flavio. -
Differences between DATA TYPE and DATA OBJECTS
I am new to ABAP,I want to know the differences between DATA TYPE and DATA OBJECTS with some examples.
please help me regarding this.Hi Ashish,
Data Types: Are pure descriptions.
No memory is associated with data types.
Describes the technical properties of data objects.
EX.
1. C-CHARACTER
2. D-DATE
3. F-FLOAT
4. I-INTEGER
5. N-NUMERIC TEXT
6. T-TIME
7. P-PACKED NUMBER
8. X-HEXADECIMAL
9. STRING-Variable length string.
10. XSTRING-Variable length byte string.
Data Objects: Are created during runtime.
They cannot exist without the data Types.
Occupies memory space.
EX:
1. INTERNAL DATA OBJECT- Internal Data objects
LITEERAL- A literal has a fixed value.Ex: WRITE:u201DWORK HARDu201D.
VARIABLES: Data statement is used to create variables.
EX.DATA: NUM TYPE I.
NUM: VARIABLE defined by data statement.
EX: DATA: PRICE LIKE NUM.
CONSTANT-It is a data object, which contains a constant value throughout the program.
Can be declared in program by using CONSTANT statement.
EX:CONSTANT: INT TYPE I VALUE 15.
2. EXTERNAL DATA OBJECT: Are defined in tables i.e In ABAP/4 dictionary you can access this data from table.
EX: TABLES: SFLIGHT
DATA: SEATS LIKE SFLIGHT-SEATSMAX.
3. SYSTEM DEFINED DATA OBJECTS:Space & system variables like SY-UNAME,SY-DATUM, SY-REPID.
4. SPECIAL DATA OBJECTS:
PARAMETERS: Are Variables ,which can accept value from user.
SELECTION SCREEN : Are special internal tables to accept value ranges from user.
3 APPROACHES TO DEFINE DATA OBJECTS.
1. ELEMENTARY TYPES
DATA: Customer _Name (25) TYPE C,
Vendor_Name (25) TYPE C.
2. REFRENCE TO AN EXISTING FIELD:
DATA: Customer _Name2 (25) TYPE C,
Vendor_Name2 (25) LIKE Customer_Name2
3. REFRENCE TO NON-ELEMENTARY TYPE:
TYPES: T_NAME (25) TYPE C
DATA: CUSTOMER_NAME TYPE T_NAME
VENDOR_NAME TYPE T_NAME
4. RECORD-Information in rows & columns.
DATA: BEGIN OF BOOKING,
ID (4) TYPE C,
FLIGHT_DATE TYPE D,
NAME LIKE CUSTOMER_NAME,
END OF BOOKING.
You can also look into SAP help for more information.
Regards,
Indu. -
ABAP Query - Local field creation error
Hi,
In SQ01, I created a query. when i try to create local field EDIT>LOCAL FIELD>CREATE. Its throwing error 'Reference field does not exist' Message no. AQ273.Can anyone please tell me how to create local field then?
useful answers will be rewarded.
Thanks
Shameem.Hi,
When creating a local field in a query, you need to define the type of data it will hold. There is a radio button to select a "reference field" or you can specify the type of data directly. I believe you got this error message because you selected reference field but specified no other field in the query to use as reference.
RaulV -
Diff between sap query and abap query
diff between sap query and abap query
Hi,
ABAP query is mostly used by functional consultants.
SAP Query :
Purpose
The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
Features
SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
All the data required by users for their lists can be selected from any SAP table created by the customer.
To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
ABAP Query,:
As far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
use either SQ02 ans SQ01
or SQVI tr code
for more information please go thru this url:
http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
http://goldenink.com/abap/sap_query.html
Please check this PDF document (starting page 352) perhaps it will help u.
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
check the below link will be helpful for u
Tutorial on SQVI
once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
regards,
vasavi.
reward if it is helpful. -
Difference between Report painter and abap query .
can anyone please tell me the difference between the report painter and the ordinary alv,clasical reporting and also the difference between Report painter and abap query. How the output format will be in Report painter. If anyone has any documents please send it to
[email protected]
Thanks,
Joseph.hi,
ABAP Query is an ABAP Workbench tool that enables users without knowledge of the ABAP programming language to define and execute their own reports.
In ABAP Query, you enter texts and select fields and options to determine the structure of the reports. Fields are selected from functional areas and can be assigned a sequence by numbering.
link for abap query --
https://forums.sdn.sap.com/click.jspa?searchID=221911&messageID=2790992
whereas the Report Painter enables you to report on data from various applications. It uses a graphical report structure that forms the basis for the report definition. When defining the report, you work with a structure that corresponds to the final structure of the report when the report data is output.
link for report painter --
https://forums.sdn.sap.com/click.jspa?searchID=221874&messageID=1818114
Regards,
pankaj singh
Message was edited by:
Pankaj Singh
Message was edited by:
Pankaj Singh -
How to display/create Local field in SAP query
HI All,
I'm new to abap query. I have to include a local field in the existing query. I know through SQ01->Edit->Local field we can display the Local fields, but the options under Local Fields menu option are disable even in change mode of Query.
So, later through SDN found that, I have to Switch On the short names menu option. Even the sub-options in Short Names are disabled.
Can any body please let me know how can we display the local fields to the change the formula and how can we create the new local fields in the existing qeury.
Hope I'm able to explain my issue clearly.
Thanks in advance.You can create the local fields in the "Select Field" screen. (Third screen after "Title, Format" and "Select Field Group") This option is disabled on the other screens.<br />
<br />
<i>Reference : <a class="jive-link-external" href="http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d2/cb4186455611d189710000e8322d00/frameset.htm" target="_newWindow">Defining Local Fields</a> in <a class="jive-link-external" href="http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d2/cb3efb455611d189710000e8322d00/frameset.htm" target="_newWindow">SAP Query</a>.</i><br />
<br />
Regards,<br />
Raymond
Maybe you are looking for
-
Bug report: on LabVIEW 2011 SP1 and Windows 8 'Open URL in default browser.vi'
Dear colleagues, Here is a bug report. Culprit: 'Open URL in default browser.vi'. System: Windows 8, Professional. LabVIEW 2011 SP1. Abnormal behaviour and steps to reproduce: Above mentioned VI doesn't work when LabVIEW was started with administrato
-
Hi Friends I have some queries, can some body help to explain this: 1. Do Fi persons work on Credit control area , if yes whats the use of credit control area, and where we do the all detail config for this one. 2. how to see the financial statements
-
Workflow To restrict the release of Transport request
Hi Guys, Can any one tell me is there any Standard workflow to restrict the User's to release the Transport Request? Regards Venkatesh.S Edited by: venkatesh saravanaperumal on Jan 16, 2008 11:40 AM
-
Can't send outgoing messages using hotmail on iPhone 4
Help! I've just switched from iPhone 3 (where I used my hotmail with no probs) to iPhone 4 and have been setting it up as I had it before. I've added my hotmail account and incoming emails are received but it won't let me send outgoing mail. It keeps
-
Hi everybody, I guess to remember I read that <xsd:include> is not allowed. Do you have some information? Regards Mario