How to insert code conditions ina QUERY
Hi All,
I'm creating a Query to extract the data from EKKO, EKPO and EKKN.
here I have to insert a piece of code as checking below.
IF EKPO-KNTTP ne ' '. "not equal to blank
extract the data from table EKKN.
ENDIF.
here I need your help like how to write this code in a Query.
Thanks,
Sunil Bodda.
Edited by: sunil bodda on Apr 15, 2009 12:05 PM
Hi Sunil,
You need to code it in infoset. follow the steps below.
1. Goto SQ02, enter your infoset.
2. Click on "Extras" button(above find button). On the next page you will find a "Code" tab.
3. Declare a constant as space. choose DATA in the drop down for coding section.
4. Choose "Record processing" or if any other appropriate choice from the drop down in the coding section.
5. CHECK EKPO-KNTTP EQ c_space. and write your code here.
Hope this helps.
Similar Messages
-
Hi All,
I'm creating a Query to extract the data from EKKO, EKPO and EKKN.
here I have to insert a piece of code as checking below.
IF EKPO-KNTTP ne ' '. "not equal to blank
extract the data from table EKKN.
ENDIF.
here I need your help like how to write this code in a Query or Functional Area (Info Set).
Thanks,
Sunil Bodda.Duplicate POST.....
select the query and go to QUERY in the menubar then goto more functions where you have an option display report name it will give you the report name.
Menubar ---> Quer ---> MoreFunctions ----> Display Reportname.
Goto SE80/SE38-->Report name and add the Codes in the program.
Regards,
gurpreet -
How to insert autoincrement record and query it with multiple keys
Hi all,
I am not familiar with BerkeyleyDB, I am now doing a project that needs to insert records and then query it out with multiple keys at later time. Since there is no field that can be distinct primary key, I want to user DbSequence as auto increment primary key to db, and set other index keys as secondary db, then using join cursor to do query with multiple keys.
I don't know how to use DbSequence, can anyone direct me to a example of using DbSequence as auto increment primary key?
Regards
-BruceI figured out the method to insert record with auto increment primary key. I listed the code block below:
char m_SeqNamePositions[32] = "MyPositions";
DbSequence *m_pSeqPositions;
m_pDBPositions = new Db(NULL, 0);
m_pDBPositions->open(NULL, pszFileName, szFileName, DB_BTREE, DB_CREATE, 0); // 无数据文件
m_pSeqPositions = new DbSequence(m_pDBPositions, 0);
Dbt key((void *)m_SeqNamePositions, (u_int32_t)strlen(m_SeqNamePositions));
m_pSeqPositions->open(NULL, &key, DB_CREATE);
db_seq_t SeqNum;
m_pSeqPositions->get(0, 1, &SeqNum, 0);
Dbt key((void *)&SeqNum, (u_int32_t)sizeof(SeqNum));
Dbt data(pRecord, sizeof(*pRecord));
return m_pDBPositions->put(NULL, &key, &data, DB_NOOVERWRITE);
m_pSeqPositions->close(0);
m_pDBPositions->close(0);
delete m_pSeqPositions;
delete m_pDBPositions;
m_pDBPositions = NULL; -
How to insert a condition in the Graphic Window of a SAP Script ?
Hi,
I need to give a condition inside the Graphic Window for printing the Logo in the SAP Script. Now, my problem is that the Graphic window is only opening in Display mode. How to make it editable and insert a condition in it?
OR
Is there any other way to do it?
Please Help.
Thanks in Advance.
-VRUHi
I got your point. I'll provide you solution
In the logo window goto coding part by pressing F9 and give your coding as
IF &BKPF-BUKRS& = 'COM1'
INCLUDE GSPL OBJECT GRAPHICS ID BCOL LANGUAGE DE
BITMAP 'LOGO1' OBJECT GRAPHICS ID BMAP TYPE BCOL
ELSEIF &BKPF-BUKRS& = 'COM2'
BITMAP 'LOGO2' OBJECT GRAPHICS ID BMAP TYPE BCOL
ELSEIF &BKPF-BUKRS& = 'COM3'
BITMAP 'LOGO3' OBJECT GRAPHICS ID BMAP TYPE BCOL
ELSEIF &BKPF-BUKRS& = 'COM3'
BITMAP 'LOGO4' OBJECT GRAPHICS ID BMAP TYPE BCOL
ELSEIF &BKPF-BUKRS& = 'COM4'
BITMAP 'LOGO5' OBJECT GRAPHICS ID BMAP TYPE BCOL
ENDIF
<b>Note:</b>But you have to upload all your logos in se78 then only you can upload and give conditions for this
Regards
Pavan -
How to Use MAX condition using Query Report
Hi SAP Abap Expert,
Can we use the MAX condition in Query Report (SQ01/SQ02) ?
I have created one sample query using table VBRP and VBRK then i need to use max condition to get the MAX record in VBELN.
Please Help ???Hi Ashishsingh,
According to your description, you want to know how to use MAX function in SQL Server Analysis Services MDX Query, right? In this case, please refer to the link below which describe the syntax and sample of MDX function.
http://technet.microsoft.com/en-us/library/ms145601.aspx
http://www.mdxpert.com/Functions/MDXFunction.aspx?f=64
Hope this helps.
Regards,
Charlie Liao
TechNet Community Support -
How to insert a conditional image into a report
Hi
I am fairly new to HTML DB, but I have managed to create my first application.
I need a little help with one report.
One of the columns in the report contains Y, N or R. The customer wants me to display a different coloured image depending on the value (ie a red button for N, green for Y or amber for R).
I have can add a static image to a report via "Column Formatting" -> "HTML Expression", but I have no idea how to make it conditional.
Any ideas?
Many thanks in advance.
RakGreat, that works!!!!
Thanks very much.
For completeness (incase anyone else reads this), there was one typo, in your solution, you omitted the opening '<' in the image source HTML tag
select loanno, itemid,
decode (returned, 'N', '<img src="#IMAGE_PREFIX#bullet_red.gif" border="0" alt="Loaned">',
'Y', '<img src="#IMAGE_PREFIX#bullet_green.gif" border="0" alt="In Library">',
'R', '<img src="#IMAGE_PREFIX#bullet_orange.gif" border="0" alt="Returned">'
) as status
from loans
Thanks for your help,...
Rak -
How to insert 2 conditions in a Query
Hi ,
How can i apply 2 conditions to a query
First i need to apply a condition X to query and then i need to apply condition Y to the results which are based on condition X
How can i acheve thisHi
We can create multiple condition in one query
When ever u select condition on tab it shows two options Chenge condition and new condition
If we have 2 comndition in one query it works with AND function .
If we have all applicable condition in one condition then it works with OR functionality.
Assign points -
How to use many conditions in query
Hi all,
i have a situation,must prepare a report to find availability of it devices.they are given the specific ip of devices.
my query
SELECT
Resultdate, [SERVICE] ,[SERVICE TYPE] ,[IP]
, DailyAvailability
FROM [Orion].[dbo].[DepartmentNodesNew] t1
left join ( select round(1-(sum([DownTimeMin])/(1440*count(*))),4)*100 as DailyAvailability,
count(*) as Node, c2.ResultDate ,[Departament] ,[IPAdress]
from [Orion].[dbo].[OrionEventsNodeDownTime] as c2 group by [Departament] ,[IPAdress] , c2.ResultDate) t2
on t1.IP=t2.IPAdress
where t2.DailyAvailability is not null and t1.SERVICE='SAP CRM' and t2.ResultDate='2014-12-10'
order by ResultDate
now how can i calculate the daily availability of sap crm which have 2 servers and they are in cluster,when one is down service is ok.when both of them are down service is off. how can i calculate by writing conditions.
case when ([SERVICE]='SAP CRM' AND [SERVICE TYPE]= 'DB Server' and [DownTimeMin] =0) then DBAvailability 100
else then DBAvailability select round(1-(sum([DownTimeMin])/(1440*count(*))),4)*100 ???SELECT Resultdate
,[SERVICE]
,[SERVICE TYPE]
,[IP]
,DailyAvailability
INTO #TempTable
FROM [Orion].[dbo].[DepartmentNodesNew] t1
LEFT JOIN (
SELECT round(1 - (sum([DownTimeMin]) / (1440 * count(*))), 4) * 100 AS DailyAvailability
,count(*) AS Node
,c2.ResultDate
,[Departament]
,[IPAdress]
FROM [Orion].[dbo].[OrionEventsNodeDownTime] AS c2
GROUP BY [Departament]
,[IPAdress]
,c2.ResultDate
) t2 ON t1.IP = t2.IPAdress
WHERE t2.DailyAvailability IS NOT NULL
AND t1.SERVICE = 'SAP CRM'
AND t2.ResultDate = '2014-12-10'
ORDER BY ResultDate
SELECT Resultdate
,[SERVICE]
,[SERVICE TYPE]
,[IP]
,DailyAvailability
,CASE
WHEN (
[SERVICE] = 'SAP CRM'
AND [SERVICE TYPE] = 'DB Server'
AND [DownTimeMin] = 0
THEN 100
ELSE round(1 - (sum([DownTimeMin]) / (1440 * count(*))), 4) * 100
END AS 'DBAvailability'
FROM #TempTable
-Vaibhav Chaudhari -
How to change code in SAP Query
Hi Experts !!
In SAP QUERY I am getting the PO with all delivey dates & deliveried Qty but I have to select only single PO with latest delivery date & qty. If there r more than one record for latest delivery date than deliveried QTY must be sum of all QTY (for the latest delivery date). for example :
this is coming
Po delivery date qty
10001 30.06.2009 4
10001 30.06.2009 5
10001 01.05.2009 4
we want
Po delivery date qty
10001 30.06.2009 9
Thanks in advance.
Thanks & Regards
Navneet Singhal>
navneet singhal wrote:
> There is an internal table %G00 in query generated program (AQCSZPCWMM======Z_PCW_ORDER_V2) when I use this table in Code section (END-OF-SELECTION ) system thro msg %G00 is not defined . if I define this table in DATA section than run the query , It gives the DUMP with error %G00 is already decleared.
>
> How can I use %G00 internal table in my code section.
I have the same problem as the OP. I need to get rid of the duplicates and have all sumarized in just one row. I was thinking about this same solution, but when I add code to the END-OF-SELECTION event, this doesn't appears anywhere (but if I add code to any calculated field, yes).
And the problem of the quoted message. I tried using field-symbols but I have errors saying that it's nos a valid table, etc...
Any ideas???
Thanks!!! -
How to put this condition in Query
Dear experts,
I have a scenario where in the calculation should be dynamic between key figures in query
For example i have a
Target Cost and Actualcost1, Actualcost2, Actualcost3
i need to findout the variance between the Target and Actual
but the catch is that i need to findout the variance with the latest actual cost
1. ) Target cost = 100
Actual cost1=10, Acutal cost2=0, actual cost3=0
then the formula should be Actual cost1-target cost
2. )But if
Target cost =100
Actual cost1=10, Actual cost2=5, Actual cost3=0
then the formula should be Actual cost2- Target cost
3. Target cost =100
Actual cost1=10, Actual cost2 = 5, Actual cost3= 15
then the formula should be Actual Cost3-Target cost
How to achieve this
Thanks and regards
NeelHi Neel,
Do you have indicator saying that a particular actual cost is the latest? If you have any indicator thsi would make the job easy. Else you need to create new formulas to derive the logic.
Else you can proceed with the belwo logic.
1.target cost
2. Actual Costs 1 - Hide
3. Actual Costs 2 - Hide
4. Actual Costs 3 - Hide
5. New formula whcih evaluates the latest.
Write the condition
If Actual costs3 = 0 and actual cost2 = 0 then actual cost1.
else if actual cost2= 0 then actual cost1
else if actual cost1 NE 0 and actual cost2 NE 0 then Actual cost3.
Then hide the above new formula.
And in a new formula you can find the diff between the Target cost and the latest cost derived in teh above new formula.
If the conditions is too big in the above new formula, you can split across two three new formulas and derive the logic.
Just make some changes to the above logic if it is not 100%.
I believe this logic will work. -
My just-finished site will depend on newletters & opt-in subscribers, & I've started with one of those email managers (Campaigner.com). Uploaded my iweb-made Contact Us page locally onto my browser & it still comes out as their html gibberish.
Was told by their support "You have to insert this coding in the **coding version of your application.** (??) I tested it and it works fine. Where did you insert it?"
iWeb seems to have no "code box" where you can add the code.
But. I found this conversation where they're discussing the same iWeb problem.
http://forums.macosxhints.com/archive/index.php/t-56252.html
I don't have Textwrangler, I have TextEdit.
Any help would be so appreciated.The "code box" in iWeb is the HTML Snippet.
You can paste custom code there.
iWeb provides the placeholder, but does nothing to your code. You are responsible.
[TextWrangler|http://www.barebones.com/products/textwrangler>
Working with TextEdit:
[Working with HTML in TextEdit|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te1003.ht ml]
[Opening an HTML document|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te48.html ]
[How to Set Up TextEdit as an HTML or Plain Text Editor|http://docs.info.apple.com/article.html?artnum=106212]
[I can't view the code in an HTML file|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te1007.html]
[Saving HTML files|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te58.html] -
How to insert code in ABAP program ( Z program) by ABAP coding.
Hello,
In ABAP is there any way to insert some code lines into an existing ABAP program (Z*) , We will insert in masse some code lines into a liste of program automatically ?
Thanks in advanceHi,
This thing you can achieve by using the Code Template . If you are using New ABAP editor you can in the bottom right side after the scrolling bar. Click on that add the code you need to insert .
Hope this might help you.
With Regards,
Sumodh.P -
How to insert code with Change Pointers (BATMAS)
Hello,
We make use of change pointers to notify our customer of changes on batches (BATMAS).
I would like to update a segment-field in the IDoc before sending it.
Is this possible?
And if Yes, where can I do this?
Thanks in advance!
Guido VerbruggenThe "code box" in iWeb is the HTML Snippet.
You can paste custom code there.
iWeb provides the placeholder, but does nothing to your code. You are responsible.
[TextWrangler|http://www.barebones.com/products/textwrangler>
Working with TextEdit:
[Working with HTML in TextEdit|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te1003.ht ml]
[Opening an HTML document|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te48.html ]
[How to Set Up TextEdit as an HTML or Plain Text Editor|http://docs.info.apple.com/article.html?artnum=106212]
[I can't view the code in an HTML file|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te1007.html]
[Saving HTML files|http://docs.info.apple.com/article.html?path=TextEdit/1.4/en/te58.html] -
*** How to add dynamic condition to Query ***
Hi All,
Could you please help me out logic
i need only query
There is tables emp, dept
SELECT E.ENAME,D.DNAME
FROM EMP E, DEPT D
WHERE d.DEPTNO = e.DEPTNO(+)
AND (DYNAMIC CONDITION)
DYNAMIC CONDITION LOGIC IS
IF D.DEPTNO IS THERE IN E.DEPTNO THEN [E.JOB = 'MANAGER'] --- CONDITIION SHOULD ADD IN THE PLACE OF (DYNAMIC CONDITION)
IF D.DEPTNO IS NOT THERE IN E.DEPTNO THEN [ D.LOC = 'LONDON'] --- CONDITIION SHOULD ADD IN THE PLACE OF (DYNAMIC CONDITION)
I tried below
select e.ENAME, e.SAL, d.dname from emp e, dept d
where CASE WHEN e.deptno = d.deptno then e.job = 'MANAGER'
else D.loc = 'LONDON'
END
But its giving error...
Please give a solution
Thanks in Advance
KCSELECT E.ENAME,D.DNAME, d.loc, e.job, e.deptno
FROM EMP E, DEPT D
WHERE d.DEPTNO = e.DEPTNO(+)
and (
(e.deptno is null and d.loc='LONDON')
or
(e.deptno is not null and e.job='MANAGER')
); (But thats no dynamic sql!) -
How to insert 10 rows at a time in the oracle
how ti insert r update 10 query at a time in the oracle
You can do a small test to find it out.
SQL> set serveroutput on
SQL> drop table t
2 /
Table dropped.
SQL> drop table s
2 /
Table dropped.
SQL> create table s(no integer, name varchar2(4000))
2 /
Table created.
SQL> create table t(no integer, name varchar2(4000))
2 /
Table created.
SQL> insert into s
2 select level, rpad('*',4000,'*')
3 from dual
4 connect by level <= 10000
5 /
10000 rows created.
SQL> commit
2 /
Commit complete.
SQL> declare
2 ltime integer;
3 begin
4 ltime := dbms_utility.get_time;
5
6 for i in (select * from s)
7 loop
8 insert into t(no, name) values(i.no,i.name);
9 end loop;
10
11 ltime := dbms_utility.get_time - ltime;
12
13 dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
14 commit;
15 end;
16 /
Exec Time:17.22 Seconds...
PL/SQL procedure successfully completed.
SQL> truncate table t
2 /
Table truncated.
SQL> declare
2 type my_type is table of s%rowtype;
3 lType my_type;
4 ltime integer;
5 begin
6 ltime := dbms_utility.get_time;
7
8 select * bulk collect into lType from s;
9
10 forall i in 1..lType.count
11 insert into t values lType(i);
12
13 ltime := dbms_utility.get_time - ltime;
14
15 dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
16
17 commit;
18 end;
19 /
Exec Time:6.27 Seconds...
PL/SQL procedure successfully completed.
SQL> truncate table t
2 /
Table truncated.
SQL> declare
2 ltime integer;
3 begin
4 ltime := dbms_utility.get_time;
5
6 insert into t select * from s;
7
8 ltime := dbms_utility.get_time - ltime;
9
10 dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
11
12 commit;
13 end;
14 /
Exec Time:3.26 Seconds...
PL/SQL procedure successfully completed.Thanks,
Karthick.
Maybe you are looking for
-
If that was confusing, I'll reexplain it: S, I bought 2 Lil Jon Kings of Crunk songs from itunes that were on the same album. The album was clean with no explicit sign on the artwork. Prior to buying those songs, before I had money in itunes, I got a
-
Plz help, how do i make .sis work on my phone
hey everyone i would be very grateful if you can help me on how to make .sis files work on my phone[k750i], i tried to convert it into a jar nd then put in on my phone but it still didnt work.im kinda new and i dont know how to make .sis files work o
-
Applying additional signatures after the first round of sign-offs
Here is a hypothetical use case. i am wondering how this might best be accomplished? A document gets distributed to 2 other people and everyone signs it. A bit later a new signature is required so that everyone knows that that additional person has "
-
Installation Trouble with Photoshop Disk
I'm trying to reinstall photoshop cs3 from the original disk. I have the correct serial number and it says it's invalid. Later, I had upgraded to cs5 and tried that serial number and that does not work either. I had to do a fresh reinstall after my c
-
I need a SQL to display Mon-sun in a week when enter a date. If i give '24-Mar-2011' i want Mon-sun dates displayed i.e from 21-Mar-2011 to 27-Mar-2011.