Out put problum
First Query
select prod_id,sum(total_qty) from
(SELECT prod_id,total_qty
FROM sale_order_detail
order by total_qty desc)
where prod_id like 'CA%' and rownum<11 and total_qty is not null
group by prod_id
order by sum(total_qty) desc
Result
PROD_ID SUM(TOTAL_QTY)
CA30151 60
CA40474 54
CA30164 50
CA40509 50
CA40436 50
CA40421 50
CA30174 50
CA20031 50
Second Query
SELECT prod_id,sum(total_qty)
FROM sale_order_detail where total_qty is not null and prod_id like'CA%'
group by prod_id
order by sum(total_qty) desc
PROD_ID SUM(TOTAL_QTY)
CA40133 175
CA30059 135
CA40474 132
CA40128 127
CA50133 123
CA60024 107
CA40402 95
CA60017 91
CA30164 87
CA30100 86
CA40510 83In First Query My result is diffrent then second but i think both the query give me same result for top ten
total_qty please rectify me
Thanks And Regards
Vikas Singhal
Hi,
No, the rownum is taking precedence in this query, try with this one:
with q1 as
(select 'a' c1,1 c2 from dual
union all
select 'a',2 from dual
union all
select 'a',3 from dual
union all
select 'a',4 from dual
union all
select 'b',5 from dual
union all
select 'b',6 from dual)
select c1,sum(c2) from q1
group by c1
with q1 as
(select 'a' c1,1 c2 from dual
union all
select 'a',2 from dual
union all
select 'a',3 from dual
union all
select 'a',4 from dual
union all
select 'b',5 from dual
union all
select 'b',6 from dual)
select c1,sum(c2) from
(select c1,c2 from q1)
where rownum<=5
group by c1Could you post the explain plan of your query (The 1st one)?
You've probably a 'count stop key' step before the aggregate ...
Similar Messages
-
XML PUBLISHER report in Excel out put problem
Hi Experts,
I have developed one XML report which output type is EXCEL in Oracle Application.
I am getting some -ve value in the report so I need to do the trailing sign
Menace for example I got a value -8645 I need to display the value like (8645).
This functionality is working in PDF output but in EXCEL out put it is not working.
Could any body please help me on this..
Its Urgent .
Thanks in Advance.Check this metalink notes, did you got any error..?
Note: 364547.1 - Troubleshooting Oracle XML Publisher For The Oracle E-Business Suite
https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=364547.1
Note: 359875.1 - Cannot View Xml Publisher Report Output In Excel Format
Note: 358296.1 - How To Produce Requests In Formats Of HTML, RTF, and Excel From XML Publisher
Note: 850685.1 - Wrong Output Format In Xml Publisher Output
Note: 727031.1 - XML Publisher Requests Always Get Defaulted to Output Format as PDF Whatever the Template Type is Set To
Note: 337343.1 - Unable to View Excel Output File Created by XML Publisher
Note: 401328.1 - Default Layout Format for XML Publisher Concurrent Request Is Always PDF
Re: XML Publisher Server on EBS 11.5.10.2 -
How to get the last seven days for out put of present day
Hi Experts,
we developed one query for 3 years data
1.user enter the current date (21-03-2014) but out put value should be last seven days (21-03-2014 - 7) (last one week data only)
2.some times user will enter the (20-03-2014 ) but out put value should be last seven days (20-03-2014 - 7) (last one week data only)
how to achieve the 2 different scenario?
is there any standard variable ? please suggest .
Thanks,
Bindu.Hi,
i created the Characteristic value variable not formula variable
in char variable i can't see the off set functionality but we can see off set function in formula variable
user requirement he wants enter the input value as date and he need last week data means one week data calday wise.
i tired the 0PREVWK , 0CWEEK these two variables these not asking the input and direct showing the out put.
these can achieve through the customer exit?
Thanks,
Bindu. -
Field Length in Alv Grid out put
hi,
How to increase the length of the filed in the output of alv grid,
Actually i am getting one blank field in the alv grid out put, my requirement is to increase the length through out the column how to do that
can anyone guide me plz
SIRIin your fieldcat of the field
wfieldcat-fieldname = '<your fieldname in caps>'
wfieldcat-outputlen = 10 (or the length you want for the field)
<you can define any other property also for that field>
append wfieldcat to ifieldcat.
now pass it in fm.
regards
shiba dutta -
Is it possible to display only dynamically selected fields in the out put?
Is it possible to display only dynamically selected fields in the out put? i need to display set of columns in the selection criteria, but in the output i have display only input given fields. because i need to convert it into .csv file. So i have to display selected fields from internal table. In oracle they are using"execute immediate". is there any equivalent in SAP?
thanks in advance.Hi Remya,
Are you talking about dynamic programming in ABAP ?
If yes, there are concepts like RTTS which facilitates it.
Yes, the select query also supports dynamic selection of fields. ( Please care about ( ) in dynamic sql ).
Do more research on Field Symbols and statements like ASSIGN COMPONENT OF.
Regards,
Philip. -
MRP Out Put Schedule lines date format to month
Hi Friends,
I am working on SAP4.7 Version.
I have maintained all the relavent MRP datas in material master.
Like MRP type - PD,
Lot Size- MB ( Monthly Lot size).
I have created planned independent requirement in MD61 monthly wise for that material.
I have given Schedule agreement number in Source in List with MRP indicator - 2.
I am running MRP for a material with MD02 with MRP parameter Delivery schedules -3 (Schedule lines) .
The MRP running succesfully and creating delivery Lines with delivery dates.
But the requirement by the client is..
The delivery lines should be generated in month wise.
How to convert the schedule lines generated in day format to Month format in MRP run out put?
While creating schedule lines with ME38. we have option to select the day format / month format/ week wise?
But the MRP out put always generated in date wise?
Any one knows what changes i should make?
Guide me ..
Thanks & Best Regards
GiriHai Boss
Can you throw some light , how you set default mrp indicator month wise with the help of ABAPER.
My client requirement also same like you. Yours is month, mine is week. Pl help me out.
regards
ssp -
MRP Schedule line out put format
Hi Friends,
I am working on SAP4.7 Version.
I have maintained all the relavent MRP datas in material master.
Like MRP type - PD,
Lot Size- MB ( Monthly Lot size).
I have created planned independent requirement in MD61 monthly wise for that material.
I have given Schedule agreement number in Source in List with MRP indicator - 2.
I am running MRP for a material with MD02 with MRP parameter Delivery schedules -3 (Schedule lines) .
The MRP running succesfully and creating delivery Lines with delivery dates.
But the requirement by the client is..
The delivery lines should be generated in month wise.
How to convert the schedule lines generated in day format to Month format in MRP run out put?
While creating schedule lines with ME38. we have option to select the day format / month format/ week wise?
But the MRP out put always generated in date wise?
Any one knows what changes i should make?
Guide me ..
Thanks & Best Regards
GiriHi there,
idealy its not possible in standard sap.
but you can do one thing that...
copy original programme of MD04 and create ZMD04 transaction or you can search a usefull function mdule. Here you can convert date in months by using some abap code of function module if available.
i know this is a very rough idea about solution bu it will help definitely help you
Regards
Hemant -
Print out put of Invoice Verification
How to get print output of Invoice verification? How to get print output of subsequent credit/debit of Invoice?
Hi
You need to create a new Message type copying any relevant message type.(tCode M806). Maintain the processing routines with medium as print out put.
Create the form required for Print out put & assign it to the routine.
Maintain the message schemas , Assign the new Message type to the existing schema.
Now create the conditoin record using transaction MRM1 with th required key combination. Invoicing party & Company code.
Now when ever you create the invcoie with combination the Message will be created.
Execute transaction MR90 for the print out put. If you want the print after saving the invoice , maintain the despatch time as Send immediately when saving the application.
Reward points if useful
Thanks & Regards
Kishore -
How to get default lay out set in my ALV out put.
I need to have default layout in my ALV output.
My functional consultant idea was to make sure they have an ALV variant selected.
When he first run the program, how will need to get a "/DEFAULT" variant created.
How can I do that ?
Initialization - For ALV variant
INITIALIZATION.
ws_repid = sy-repid.
g_save = 'A'.
CLEAR g_variant.
g_variant-report = ws_repid.
Get default variant.
gx_variant = g_variant.
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
&--F4 HELP - FOR ALV VARIANT GET--
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = gx_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 g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
&--AT SELECTION-SCREEN.- For ALV Variant--
AT SELECTION-SCREEN.
*Getting variant Existence
PERFORM get_exist_variant.
*& Form GET_EXIST_VARIANT *
text *
FORM get_exist_variant .
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
CLEAR g_variant.
g_variant-report = ws_repid.
ENDIF.
ENDFORM. " GET_EXIST_VARIANT
*& Form alv_display *
This subroutine is to display the out put in ALV. *
FORM alv_display .
Local data
DATA: y_x LIKE boole VALUE 'X'.
DATA: lh_index LIKE lf_fieldcat-col_pos.
For variant
DATA: ws_repid LIKE sy-repid,
g_save TYPE c VALUE 'A',
g_exit TYPE c,
g_variant LIKE disvariant,
gx_variant LIKE disvariant.
For 1st field.( RPT_LOC )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'RPT_LOC'.
lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
lf_fieldcat-ref_tabname = 'ZGXMIT'.
lf_fieldcat-ref_fieldname = 'RPT_LOC'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 2nd field.( BAL_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'BAL_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
lf_fieldcat-ref_tabname = 'ZGXMIT'.
lf_fieldcat-ref_fieldname = 'BAL_XMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
4,5,....fields appening
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = v_alv_layout
it_fieldcat = lt_fieldcat
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'A'
IS_VARIANT =
it_events = events[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
TABLES
t_outtab = gt_zgxmit_l
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.
ENDFORM. " alv_displayHello SAm,
U have to set like DATA: IT_VARIANT LIKE DISVARIANT,
G_S_SORT LIKE LINE OF IT_SORT.
DATA : G_R_DISP_VARIANT TYPE DISVARIANT.
SORT G_T_OUTTAB BY PSPID POSID.
CLEAR: G_R_DISP_VARIANT.
For storing the variant layout
IT_VARIANT-REPORT = SY-REPID.
IF NOT P_VARIAN IS INITIAL.
G_R_DISP_VARIANT-VARIANT = P_VARIAN.
ELSE.
IT_VARIANT-VARIANT = '/Z48M'.
ENDIF.
CLEAR G_T_OUTTAB.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = IT_VARIANT-REPORT
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'A'
IS_VARIANT = IT_VARIANT
IS_LAYOUT = IT_LAYOUT
IT_SORT = IT_SORT[]
TABLES
T_OUTTAB = G_T_OUTTAB
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.
If u want F4 help in the selection screen then do like this.
SELECTION-SCREEN BEGIN OF BLOCK VARIANT WITH FRAME TITLE TEXT-013.
PARAMETERS: P_VARIAN LIKE DISVARIANT-VARIANT DEFAULT '/STANDARD'.
SELECTION-SCREEN END OF BLOCK VARIANT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARIAN.
PERFORM SHOW_EXISTING_DISPLAY_VARIANTS.
FORM SHOW_EXISTING_DISPLAY_VARIANTS.
DATA: G_R_DISP_VARIANT TYPE DISVARIANT.
G_R_DISP_VARIANT-REPORT = SY-REPID.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_R_DISP_VARIANT
I_SAVE = 'A'
IMPORTING
ES_VARIANT = G_R_DISP_VARIANT
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC = 0.
P_VARIAN = G_R_DISP_VARIANT-VARIANT.
ENDIF.
ENDFORM. " SHOW_EXISTING_DISPLAY_VARIANTS
If useful reward.
Vasanth -
EXCEL out put is not showing data
Hi All,
My report is working fine it is showing data in XML but it is not showing data in Excel output. Excel output is empty.
i have attached excel and xml files. please help me.
FYI: these are migrated reports from 10g to 11g.
Thanks in advance for your timeUsing ua.bat we upgraded 10g to 11g., we got sucessfully message.
after upgrade if i try to open excel it is not showing opening and showing action instead of excel name . I though excel out put has corrupted. i downloaded excel layout from 10g and uploaded in 11g report using upload layout.
we did not make any changes in database.
below one is not related to this one but .. after upgraded reports multi parametrs did not work if i select more than one column ( i opened as different topic) then i have removed
( (coalesce(null, :P_PPD_REGION) is null) and kept(region.X_REGION in (:P_PPD_REGION) from following statement then i did report is working with multi parameters.
my doubt is is it correct thing i did ? if not how can my multi parameter will work . we are using oracle as database.
AND ( (coalesce(null, :P_PPD_REGION) is null) or (region.X_REGION in (:P_PPD_REGION)) )
AND ( (coalesce(null, :P_COUNTRY) is null) or (region.REGION_CD in (:P_COUNTRY)) )
AND ( (coalesce(null, :P_SITE_NUM) is null) or (ptcl_site.site_num in (:P_SITE_NUM)) )
I really appreciate for your support. -
Hi:
I used 10g forms and reports for my application. When I run a report .rdf file in form used
web.show_document(v_parameter_string ,'_blank');
build in function, the v_parameter_string include all parameter for server and application.
Everything is ok and the report file appears in the browser window. But maybe the size of each row is too long, the words in the report body with font size =1 -- the smallest size of letter. So the color of words in report body part is dark gray but the title part is normal black color (words' font size is 2 or upper). This make I looking at report body very difficult in web browser. When I print the report from browser, the print out paper is good and no color different between body and title part.
Do some people know why this gray color issue happened and how to fix it making the black color words appear in the report body.
Thanks.
LWUHi Madhu,
Yes, I did but out put is not coming.
Regards,
Pradeep Krishnamurthy -
Out put problem in Ad hoc query reports
Hi Gurus,
I am tryting to generate a report through Ad hoc query in S_PH0_48000510 - Ad Hoc Query SAP/Query/HR_ADM - > Selected several options like personnel number / employee name / entry date / leaving date.
But when we select it shows the input details but when i try for output the entry date / leaving date even the names of the employees are not reflecting.
But the age/date of birth other fields are coming in output.
Kindly let me know the solution to get a out put. If there is any changes need to be done in the back end. Pls advice with the path details.
Thanks & Regards,
Pradeep KrishnamurthyHi Madhu,
Yes, I did but out put is not coming.
Regards,
Pradeep Krishnamurthy -
Out put in Background (SM37) not showing All columns
Hi Folks,
Im creating an out put display for my query in background , we have define an output device , after submitting the query in back ground it just showing me only 10 columns . I mean I its not showing me all columns when I went to SE37-> select job->spool ->view (display).
Why its happening?
Please help me
Cheers
UsmanWhen you are submitting the job in background by exexuting your query from Sq01 or Tr.code , a screen will pop-up ask for you device name, on the same screen youll see properties hit that, itll take you to another screen and change the report format 65 and 200 or 65 and 200. It depends on your out put device . You can only display report till 255 . If you want to active ALV functional enable in background spool job you have to use extracts for that . So you can download your data in correct format.
You can also decrease the length of variables in query so within 255 characters you can see all report columns.
Hope thisll help you .
Hope thisll give you idea!!
<b>P.S award the points.</b>
Good luck
Thanks
Saquib Khan
"Some are wise and some are otherwise" -
Reg: Out put could not be issued
Dear All,
when i am excute VL03N to get output of smartform i am getting message like Out put could not be issued message vl086Hi Reshma p,
For that U have to assign output type...
Check out in NACE transaction whether it has been made or not...
In VL03N>Give a document number and enter the tcode then in, Menu>Extras>Choose Delivery Output>Header/Item(choose one), and here you have to give the output type in general.
Have a look on similar issue with VF03
VF03 smartform: Output could not be issued
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7 -
hi,
i am not able to get the print preview for delivery output, i have checked delivery output has got determined, when i goto vl02n, and issue out put then i am able to get the delivery output type, when i select the output type and click on the print preview i get the error "output could not be issued" errormessage no. vl086.
please suggestHi,
1) Kindly check what output type is assisgned to the Delivery Type at OVLK.
2) Then goto Tcode-> NACE.
Select V2-> 'Shipping' and click on Condition Record.
Then select the approprieate Access sequence and check whether condition record is maintained or not.
3) If condition record does not exit create , if created then select the approprieate method and Select the condition record and click on the communication button. Here Output Device, Print immediately should be checked.
Thank You,
RB
Maybe you are looking for
-
Additional Material Showing in CN52N report after MRP MD51
Dear All, I am attaching a FG material component to the internal activity and exploding bill of material for same. When I am seeing component overview report in CN52N I am getting material list which is attached to activity in Project. I am
-
Connecting MBP to HDTV.
How can I make my MBP 13" display onto DYNEX 40" HDTV without the left and right borders being blacked out? Using HDMI cable to connect. I have the picture up but I would prefer to have the full screen filled.
-
hi all As Daniel has explained content version will retain the files in same doc. How the content version will work for assemblies i mean if i create an assembly asm/iam/000/01 it will take the activated content vesion of individual parts. Now lets c
-
IPhone 5 shuts down at 10%
Am running ios 7.04. The battery meter will show 10% but then the phone will shut down and wont power back on. Something is buggy with ios 7. Is there a fix, or do we need to wait for apple to resolve?
-
There is no skype icon after i go onto application...
i downloaded skype on my macbook pro. after i did it told me to move my cursor to the applications icon and double click on it. after i did, i was unsure on what to do. it doesnt show a skype icon to go on and login and start using it. it had nothing