Code order in sq02, Problem in the selection fields in sq01
Hi all,
I'm writing a query with sq01 and sq02.
In sq02 I have some joined tables, and 2 extras fields named: "TIME" and "LEFT_ER".
in this fields I wrote a code to calculate something from fields in the tables.
The problem is:
1. When I write the code in the coding section "Additional field/structure" for each field, If I want to use this fields in the selection fields (in sq01) the query can't find any record.
But if I run this query without any selection in this fields, I get all the records, with my calculated fields.
2. I tried to write this code in the coding section "Record processing", and it seems that I can use this fields in the selection fields (in sq01), and get all the records I wanted.
But in the sq02 I get a Warning messages:
"Access error in code for additional field *GET******
*GET****** has sequence number 00
Access to LEFT_ER with sequence number 00"
In this case my field LEFT_ER has no code.
And when I change the order of the sequence number, I didn't get the Warning message, but I could not use my fields in the selection fields (in sq01), like at the beginning.
HELP ME PLEASE.
Itzhak.
Message was edited by: Itzhak Tanami
Hi,
i've an idea .
pls define your help-fields :
1) as sel-option : s_f1 for bseg-dmbtr
and
2) as calculate-field : c_f1 for bseg-dmbtr
so for event e.g. GET BSEG .
you <b>1st</b> calculate your field .
e.g.
if bseg-shkzg = 'H'.
c_f1 = Bseg-wrbtr * -1.
else.
c_f1 = Bseg-wrbtr.
endif.
and 2nd your restriction from sel-screen:
<b>check c_f1 in s_f1.</b>
good luck
Andreas
Similar Messages
-
Problem with the selection screen in submit program
Hi Friends,
i am facing the problem wih the selection screen in submit program. in my Module pool program i am using the submit program statement, When i execute the program , The module program display the submit program selections creen.
I have implemented the code same as below.
submit ztest with tknum =p_tknum and return.
Can you pleaes help me how to avoid the submit program selection screen.
Thanks,
CharanHi Charan,
You have to give the selection screen values when you submit a job.
Press F1 on submit and you will see more details.
Here is an example from ABAP Documentation.
Program accessed
REPORT report1.
DATA text(10) TYPE c.
SELECTION-SCREEN BEGIN OF SCREEN 1100.
SELECT-OPTIONS: selcrit1 FOR text,
selcrit2 FOR text.
SELECTION-SCREEN END OF SCREEN 1100.
Calling program
REPORT report2.
DATA: text(10) TYPE c,
rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab,
range_tab LIKE RANGE OF text,
range_line LIKE LINE OF range_tab.
rspar_line-selname = 'SELCRIT1'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = 'ABAP'.
APPEND rspar_line TO rspar_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'H'.
APPEND range_line TO range_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'K'.
APPEND range_line TO range_tab.
SUBMIT report1 USING SELECTION-SCREEN '1100'
WITH SELECTION-TABLE rspar_tab
WITH selcrit2 BETWEEN 'H' AND 'K'
WITH selcrit2 IN range_tab
AND RETURN.
Regards,
Jovito. -
In a query, for the selection field 'KNB1-ZWELS' a match-code isn't availab
Hi All,
Creating a query, for the selection field 'KNB1-ZWELS' a match-code isn't available.
Could anyone tell me the reason?
Thanks
GandalfHi,
Match Code Object is not available for the field ZWELS. If required, You need to contact a Developer for creating one . -
Order of the selection fields in SAP QUERY
Hello All,
How can we set the order of the selection fields in SAP QUERY!
Regards!
AshishHi,
You can go into infoset and change the order.
Or you can select 1 by 1 in the same order, you want to display.
Below is the link which might help you:
help.sap.com/printdocu/core/Print46c/EN/data/.../BCSRVQUE.pdf
Please revert, if needed more clarifications
Regards,
Yashwin -
Foreign key cannot be created for the selected field A907-MWSKZ
Dear Guru's,
I am having the requirement for creation of access sequence having country/Plant/vendor/tax code but during creation of condition table i am getting the error as
Foreign key cannot be created for the selected field A907-MWSKZ.
Anything i am missing please let me know.
Regards,
UmeshHi Umesh,
Actually i am also facing exactly the same problem as mentioned by you that is "Foreign key cannot be created for the selected field A769-MWSKZ ".
I think you found some solution regarding this..can you please help me to solve it.
Looking forward for your prompt reply..
Thanks & Regards,
Sandeep Sharma -
I need use conditions in the select fields of a query.
Hello,
Is possible, that I can have conditions in the select fields of a query? In a invoice when the type is cancellation I want to put *-1 to price and if is other type the price is normally.
If VBRK.FKART = 'S1' THEN KWERT*-1 else KWERT .
Thank you very much.you can do two things:
1. select the data into internal table and loop through the internal table and do the necessary changes
SELECT fkart kwert
FROM vbrk
INTO TABLE itab
WHERE ...
LOOP AT itab.
IF itab-fkart EQ 'S1'.
itab-kwert = itab-kwert * -1 .
MODIFY itab.
ENDIF.
ENDLOOP.
2. use select-endselect and change the data acc. to your needs inbetween and append the internal table.
SELECT fkart kwert
FROM vbrk
INTO wa
WHERE ...
IF wa-fkart EQ 'S1'.
wa-kwert = wa-kwert * -1 .
ENDIF.
APPEND wa TO itab.
ENDSELECT.
(The first approach is probably faster.) -
While creating Process Order system has to validate the Batch field
Hi All,
While creating the Process Order system has to validate the Batch field which comes under Goods Receipt tab. Please let me know is there any standard user-exit is there for this requirement.
Regards
NaveenDear Swapnil,
Thanks for the reply,
At the time of creation of process order I am entering the External Batch no as per the logic i.e. first two letters as 08 (for year), next two letter as section 51 (for solid mfg section, which i am planning to maintained in the Z table) and last three letters as 001 (for serial no in this section). so batch no is 0851001.
Now i want to validate these all letters as per the above logic i.e first two letter should be cross check with current year, and next two letter with Z table for section and last three letters for sr no with previous batch, which is already created for this section.
Now can you please help me to find out the function exit or screen exit to validate the above requirement at the time of creation of process order i.e. COR1, under the Goods receipt tab.
Thanks in advanced
Naveen -
Problem with the quantity field
hi every one
i am facing a problem with the quantity field (vbap-kwmeng)
as per my requirement i need to display this quantity field along with some other item fields from VBAP in an alv grid.
among all the fields displayed in the alv grid only this quantity field is editable(end user can change this quantity)
once end user changes this quantity and press save button i need to capture this new quantity in my internaltable.
problem is input of length of quantity is 15 and the output length is 19
so when i am pressing save
say my quantity is 50 when i am pressing save '0.050' is coming because of the length difference
how can i capture the original changed value.
vamsiwhat about define two fields in you inner table ,one as char and the other as vbap-kwmeng, you can show the char one in the ALV gird , when user input value and press SAVE ,you can move the value to vbap-kwmeng.
you can test it,mybe some one has one better idea. -
Hiding the Selected field in the Crystal reports 2011
Hi Experts,
I am new to the Crystal reports. How to hide the Selected Field in the Crystal report 2011.
Thanks,
Kavya.CHi Kavya,
You can right click on the field, go to Format Field -> Common Tab. Select/Check the option "Suppress". Or if you want to hide/ Suppress the entire section in a Crystal Report, for e.g. Detail section, right click on Details Section and select Section expert. You can select Hide/Supress accordinly.
That should hide the filed/Section when you run the report.
- Kuldeep -
SAP Query; change the name of the selection fields
Hi,
I created a SAP query using SQ01. When I execute the report, the selection field are the names of the table fields. As an example, I would like to change the selection field name «Customer number 1» for «Customer number». How can I change this selection field name in a SAP Query?
Thanks,
JulienCheck Page Number 8 of this below mentioned document
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40bec8da-4cd8-2910-27a9-81f5ce10676c
a® -
Hi.
i am having problem during execution in the select query and its taking time.what is to be done and do i need to add line of code.
plz reply
sort i_aufk by aufnr.
delete adjacent duplicates from i_aufk comparing aufnr.
IF NOT i_aufk[] is INITIAL.
SELECT aufnr "Order number
budat "Posting date
INTO TABLE i_afru
FROM afru "Order Confirmations
FOR ALL ENTRIES IN i_aufk
WHERE aufnr = i_aufk-aufnr.
IF sy-subrc EQ 0.
SORT i_aufk BY aufnr.Hi,
Table AFRU is not indexed on AUFNR (as standard) so it will be performing multiple full table scans.
Create a secondary index on the table including MANDT & AUFNR and the performance will improve.
Regards,
Darren -
How can i use index in select query.. facing problem with the select query.
Hi Friends,
I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
Here is the query:
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelat LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelatrprctr
WHERE rldnr = c_telstra_accounting
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
And rzzlstar in r_lstar
AND rpmax = c_max_period.
There are 5 indices present for Table ZTFTELAT.
Indices of ZTFTELAT:
Name Description
0 Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)
005 Profit (RCLNT,RPRCTR)
1 Ledger, company code, account (RLDNR,RBUKRS, RACCT)
2 Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)
3 Account, cost center (RACCT,RCNTR)
4 RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR
Z01 Activity Type, Account (RZZLSTAR,RACCT)
Z02 RYEAR-RBUKRS- RZZZBER-RLDNR
Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
Thanks in advance.Hi Shiva,
I am using two more select queries with the same manner ....
here are the other two select query :
***************1************************
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelpt LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelptrprctr
WHERE rldnr = c_telstra_projects
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
and rzzlstar in r_lstar
AND rpmax = c_max_period.
and the second one is
*************************2************************
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelnt LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelntrprctr
WHERE rldnr = c_telstra_networks
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
and rzzlstar in r_lstar
AND rpmax = c_max_period.
for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables. if i will not use it will delete all the data fetched earlier.
Thanks on advanced......
Sourabh -
Short code causes a strange problem - About the list again -- please read!
Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
*1. Load the list, no problem with that.*
*2. Show the elements of the list, that match the selected group in the combo box,no problem.*
*3. Search thru the list using the text field,no problem.*
4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
The code is very simple:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
FileReader reader;
String data_base[][];
String first_pass[];
int number_of_elements;
DefaultListModel dflm = new DefaultListModel();
JList list;
JTextField text_field = new JTextField();
JTextField info_field = new JTextField();
String groups[] = {"1. group" , "2. group"};
JComboBox groups_cmbx = new JComboBox(groups);
the_window(){
super("the Window!");
JPanel panel = new JPanel(null);
Container c = this.getContentPane();
c.add(panel);
text_field.setBounds(10,10,170,25);
text_field.getDocument().addDocumentListener(this);
panel.add(text_field);
groups_cmbx.setBounds(10,45,170,25);
groups_cmbx.addItemListener(this);
panel.add(groups_cmbx);
list = new JList(dflm);
list.setBounds(10,90,170,190);
list.setFixedCellHeight(20);
list.addListSelectionListener(this);
panel.add(list);
info_field.setBounds(10,280,170,25);
panel.add(info_field);
load_the_base();
refresh();
this.setSize(190,350);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.setVisible(true);
public void itemStateChanged(ItemEvent e){
refresh();
public void valueChanged(ListSelectionEvent e){
String str = (String) dflm.getElementAt(list.getSelectedIndex());
int index = 0;
for(int i = 0; i < number_of_elements; i++){
if(str.equals(data_base[0])){
index = i;
break;
info_field.setText(data_base[index][1]);
private void load_the_base(){
String data = "";
try{
reader = new FileReader("data.txt";);
int r = 0;
while((r = reader.read()) != -1){
char c = (char) r;
data += c;
reader.close();
}catch(IOException e){}
first_pass = data.split(";");
number_of_elements = first_pass.length;
data_base = new String[number_of_elements][];
for(int i = 0; i<number_of_elements; i++){
data_base[i] = first_pass[i].split("#");
private void refresh(){
String search_str = text_field.getText();
int selektovano = groups_cmbx.getSelectedIndex();
dflm.clear();
for(int i = 0; i < number_of_elements; i++){
int grupa = Integer.parseInt(data_base[i][2]);
if(grupa == selektovano){
String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
if(at_the_moment.startsWith(search_str)){
dflm.addElement(at_the_moment);
public void changedUpdate(DocumentEvent e){
refresh();
public void removeUpdate(DocumentEvent e){
refresh();
public void insertUpdate(DocumentEvent e){
refresh();
public class Main {
public static void main(String[] args) {
JFrame f = new the_window();
Now, can you please tell me whats wrong with this?
For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
_1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_Darryl.Burke wrote:
Keith, thanks for making that readable. So here's the diagnosis -
In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown. public void valueChanged(ListSelectionEvent e) {
infoField.setText(""); // do this unconditionally
if (list.getSelectedIndex() != -1) {
String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
for(int i = 0; i < numFields; i++){
if(value.equals(matrix[0])){
infoField.setText(matrix[i][1]);
break;
db
Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
That was some *clear()* thinking :-) Thank you!
corlettk wrote:
I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
ps. Thanks to all that gave some help to answering this strange question :-) -
Facin problems in the 'Select... for all entries'
I am facing problem with this piece of code, please share ur thoughts on it. I have specified the inputs.
I am extracting the open items from the BSIS table for specified 3 account number.
Inputs to the prg:
field No. of values
r_bukrs 1
r_hkont 2
r_blart 6
r_budat date range of 1 yr
r_bldat nil
v_tosdef contain 1 account number
" In each FI document posted, one line will have the 'v_tosdef' account number and one account from the 'r_hkont' values."
So will this query efficient.
SELECT bukrs
hkont
gjahr
belnr
budat
bldat
xblnr
blart
shkzg
dmbtr
FROM bsis
INTO TABLE i_bsis
WHERE bukrs IN r_bukrs " Company code
AND hkont = v_tosdef " Account number
AND budat IN r_budat " Posting date
AND bldat IN r_bldat " Document date
AND blart IN r_blart. " Document type
IF sy-subrc <> 0.
MESSAGE i003.
STOP.
ENDIF.
*@ Collecting the BELNR & GJAHR From the extracted records
li_bsis[] = i_bsis[].
SORT li_bsis BY bukrs gjahr belnr.
DELETE ADJACENT
DUPLICATES FROM li_bsis
COMPARING bukrs gjahr belnr.
IF NOT li_bsis[] IS INITIAL.
SELECT bukrs
hkont
gjahr
belnr
budat
bldat
xblnr
blart
shkzg
dmbtr
FROM bsis
APPENDING TABLE i_bsis
FOR ALL ENTRIES IN li_bsis
WHERE bukrs = li_bsis-bukrs " Company code
AND hkont IN r_hkont " Account number
AND gjahr = li_bsis-gjahr " Fiscal year
AND belnr = li_bsis-belnr. " Document num
BSIS table size around 86GB
primary index size aroung 33GB
and the index quality is 54%
the CBO shows less cost, but the actual runs takes too much disk read's / bgets..
Message was edited by:
SandyHi Sandy,
You indicated the size of the tables and index, what is the total number of records in your BSIS?
In your range tables, make sure they are postive formed.
Ex. r_bukrs : I EQ '1001', and not I NE '1000'.
You should consider coding your statements to check for input for bldat, code it with r_bldat and then another set without. It should be better performance to not have empty where conditions. So two routines, Selects with bldat and without.
Don't know if you have a Basis person to help analyze the performance, but you should look at the indexes in BSIS. You may have several indexes that contain some of your input fields but they may be spread across several indexes or there may be none. But say you have 5 indexes and it happens that just one of your parameters are in each of those indexes. Well, it can only use one index so while you think you are providing alot of parameters to help performance only one field is being used to access the index. What you need to do then is to find an index that has the most fields in your where clause and see if you can add to that, so long it's not an SAP index. If it's a z index consider adding additional fields to it, or consider creating a new index.
You can at least analyze the first Select in your DEV client. Run a trace, ST05 and then execute your code. It will show you which index it has used if any.
Also, look at the query values it is passing to the database. You said you get 6 M records on the first Select. This just seem like a lot of records, which is for just one account number (v_tosdef) along with the other parameters. I'm wondering if there's a problem with your input data. With 6M in your first table, your FOR ALL ENTRIES statement will be executed 1.2 million times. Tyically the database interface breaks down your Select-For All entries statement into 5 records per query. Again, run ST05 and you will see this.
In SE16, on your BSIS table, what is your count of records if you enter only the account number?
As a test, you might want to try entering all your parameters in SE16, run ST05 to trace the SQL to see what it is doing. You may have to kill your SE16 session or it may time out on you. You can stop your ST05 trace before your SE16 finishes and it will still show how SAP is going after the data and what index it used.
Let me know if this helped any.
Regards,
Filler -
Function module based generic extractor - Problem with the selection
Hi all
The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT MARA~MANDT
MARA~MATNR
MARC~WERKS
MARD~LGORT
MARA~MEINS
MARD~LABST
MARD~EINME
MARD~SPEME
MARD~RETME
MARD~INSME
MARD~UMLME
MARD~VMLAB
MARD~VMEIN
MARD~VMSPE
MARD~VMRET
MARD~VMINS
MARD~VMUML
MARC~XCHPF
MARD~KLABS
MARD~KEINM
MARD~KSPEM
MARD~KINSM
from MARA inner join MARC on
MARAMANDT = MARCMANDT AND
MARAMATNR = MARCMATNR
inner join MARD on
MARAMANDT = MARDMANDT AND
MARAMATNR = MARDMATNR
AND MARCWERKS = MARDWERKS
for all entries in gt_werks
where MARC~werks EQ gt_werks-werks
AND MARA~MATNR in LS_MATNR.
ENDIF. "First data package ?
Fetch records into interface table.
named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.try this
select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
where werks EQ gt_werks-werks and lvorm = space.
if t_marc is not initial.
select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
MARD~KEINM MARD~KSPEM MARD~KINSM MARA~MEINS from
mard inner join MARA on mard~matnr = mara~matnr
for all entries in t_marc where mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
and mard~lvorm = space.
Maybe you are looking for
-
Billed for iTunes and iPad purchases, not showing up in account
I realize I'm talking to fellow users here and not Apple support, but while I'm waiting for an answer from them, I'd like to find out if anyone else is currently having this problem. I've spent maybe ten bucks on iTunes purchases via my iPad in the l
-
How to format hard drive with mac air for use on mac and pc
I'm new to MAC and can't make much sence of what has been said to do in other questions. All I want to be able to do is use my 500gb My Passport hard drive on my MAC and other PC's. I have saved all the data that I want to keep on another hard drive
-
How to Get Outlook 2010 RDA or OWA as the Default Mail handler for Windows 7
I use remote desktop apps which is my primary method of using Outlook 2010. however I use many applications in Windows 7 that I need to be able to send email from. Logic tells me the Default Mail application MIME needs to be mapped. However I do not
-
I'm trying to display images within mx:Text components using htmlText. However, no matter what I try, I can't get an image to display. The application just displays whitespace where the <img> tag is. My current code looks something like:
-
After only 2 weeks of owning this notebook 2000, the audio was hit or miss whether it worked or not. After another 2 weeks, it refused to work at all. I have tried ; updating the realtek audio driver ; a system restore