How to give read statement checking condition
hi,
i am trying to give like this, but it throws an error can u tell me how to give a read statement checking two conditions.
READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR
AND GJAHR = WA_TAB_RBCO-GJAHR
AND BUZEI = WA_TAB_RBCO-BUZEI.
Hi Anitha,
READ statement wont have 'AND's in them. Your statement will work fine without having 'AND's. Lets try by omitting 'AND's in ur statement.
Please change the code as follows.
1)
READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR
GJAHR = WA_TAB_RBCO-GJAHR
BUZEI = WA_TAB_RBCO-BUZEI.
2)sort i_resg by belnr gjahr buzei.
READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR
GJAHR = WA_TAB_RBCO-GJAHR
BUZEI = WA_TAB_RBCO-BUZEI binary search.
The above statement will fetch u particular record faster than the above READ statement.
Thanks,
Vinay
Message was edited by: Vinaykumar Gorrela
Similar Messages
-
How to use read statement on a select options
Hi all,
I am trying to read the all the values on user selection screen select options.
I have an internal table loaded with data.
So while looping this internal table, I need to check the table certain tank field (lgort) against the select options tank values entered by user.
It is fine when user uses the multiple values on the select options since I use the "READ" statement on the select options and get the matching values.
Example: when user uses the multiple value selection on a select-options to enter values A554 and A555
The select-options table will be:
sign option low high
I EQ A554
I EQ A555
LOOP AT gt_output_location INTO gw_output.
READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
IF sy-subrc = 0.
* append row to another table.
ENDIF.
ENDLOOP.
Problem:
Example: when user uses range on a select-options to enter values A554 and A555
sign option low high
I BT A554 A555
The read statement can only get matching value A554.
LOOP AT gt_output_location INTO gw_output.
READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
IF sy-subrc = 0.
* append row to another table.
ENDIF.
ENDLOOP.
Anyone have any idea on this?? Thanks!!Hi all, I need to consider each and every lines of the gt_output_location as there are other fields need to consider also. Basically I am checking each and every lines of this table to see which lines I need to append to another table.
That is why I did not use "LOOP AT gt_output_location INTO gw_output WHERE lgort IN s_lgort"
The full gt_output_location:
LOOP AT gt_output_location INTO gw_output.
* IF p_lgort = space AND p_umlgo = space.
IF gv_lines_lgort = 0 AND gv_lines_umlgo = 0.
* only append those from tank <> to tank
IF gw_output-lgort <> gw_output-umlgo.
APPEND gw_output to gt_output.
CLEAR gw_output.
ELSE. "from tank == to tank
* append those from plant <> to plant
IF gw_output-werks <> gw_output-umwrk.
APPEND gw_output to gt_output.
CLEAR gw_output.
ENDIF.
ENDIF.
* ELSEIF p_lgort = space AND p_umlgo <> space.
ELSEIF gv_lines_lgort = 0 AND gv_lines_umlgo > 0.
* IF gw_output-umlgo = p_umlgo.
READ TABLE s_umlgo INTO gw_umlgo WITH KEY low = gw_output-umlgo.
IF sy-subrc = 0.
* only append those from tank <> to tank
IF gw_output-lgort <> gw_output-umlgo.
APPEND gw_output to gt_output.
CLEAR gw_output.
ELSE. "from tank == to tank
* append those from plant <> to plant
IF gw_output-werks <> gw_output-umwrk.
APPEND gw_output to gt_output.
CLEAR gw_output.
ENDIF.
ENDIF.
ENDIF.
* ELSEIF p_umlgo = space AND p_lgort <> space.
ELSEIF gv_lines_umlgo = 0 AND gv_lines_lgort > 0.
* IF gw_output-lgort = p_lgort.
READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
IF sy-subrc = 0.
* only append those from tank <> to tank
IF gw_output-lgort <> gw_output-umlgo.
APPEND gw_output to gt_output.
CLEAR gw_output.
ELSE. "from tank == to tank
* append those from plant <> to plant
IF gw_output-werks <> gw_output-umwrk.
APPEND gw_output to gt_output.
CLEAR gw_output.
ENDIF.
ENDIF.
ENDIF.
ELSE.
* IF gw_output-lgort = p_lgort AND gw_output-umlgo = p_umlgo.
READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
IF sy-subrc = 0.
* only append those from tank <> to tank
IF gw_output-lgort <> gw_output-umlgo.
APPEND gw_output to gt_output.
CLEAR gw_output.
ELSE. "from tank == to tank
* append those from plant <> to plant
IF gw_output-werks <> gw_output-umwrk.
APPEND gw_output to gt_output.
CLEAR gw_output.
ENDIF.
ENDIF.
ENDIF.
READ TABLE s_umlgo INTO gw_umlgo WITH KEY low = gw_output-umlgo.
IF sy-subrc = 0.
* only append those from tank <> to tank
IF gw_output-lgort <> gw_output-umlgo.
APPEND gw_output to gt_output.
CLEAR gw_output.
ELSE. "from tank == to tank
* append those from plant <> to plant
IF gw_output-werks <> gw_output-umwrk.
APPEND gw_output to gt_output.
CLEAR gw_output.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CLEAR gw_lgort.
CLEAR gw_umlgo.
ENDLOOP. -
How to give reader extensions to a form created with LiveCycle designer
Hello,
I make forms with "Adobe LiveCycle Designer ES 8.1" and then I give them somes rights.
I use the link http://172.16.1.35:8080/ReaderExtensions/index to give my forms rights, like (Basic form filling, Import and export form data, Submit outside web browser, Digital Signatures)
Since 2 weeks, this link doesn't work. I called Adobe Belgium and give them my licence key and they couldn't help me becasue they sayed that it's an old application.
Can someone help me please, it's an emergency.
Thanks a lot.Hi,
Why do you need to change the connection string? What are you calling "connection string for a form"???
The only connection string I now about is the one used to connect to the UI API... and this one is fixed for all apps in debug mode and given as parameter when your addon is registered in B1.
The connection string is filled in the code of your generated addon.
Please go to the main class of your addon, in the main method you have the following code where the connection string is filled either with the command line parameters (release mode) or with the fixed value given by SAP. This code doesn't need to be changed...
public static void Main()
int retCode = 0;
string connStr = "";
bool diRequired = true;
// CHANGE ADDON IDENTIFIER BEFORE RELEASING TO CUSTOMER (Solution Identifier)
string addOnIdentifierStr = "";
if ((System.Environment.GetCommandLineArgs().Length == 1)) {
connStr = B1Connections.connStr;
else {
connStr = System.Environment.GetCommandLineArgs().GetValue(1).ToString();
try {
// INIT CONNECTIONS
retCode = B1Connections.Init(connStr, addOnIdentifierStr, diRequired);
Regards
Trinidad. -
How to disable/read-only check box in Receiavbles receipt application forms
HI,
1- I am trying to freeze the check box of apply in receipt application form but it is not working properly some times its working fine and some time it is not. I am using when new record instance when I am using up arrow and down arrow key it is working fine, but if I am on first record and click the mouse on second row or third row using mouse It is not working and user can un- apply the receipt
2- Due to 1 point I tried using disable that check box but it is show some error 'frm-41017 cannot set update allowed attribute of non-enabled item'.
Please advice how can I achieve this.
Requirement is if a receipt is related to some order then user should not allow to un apply this line from applications if it is manually applied to some invoice or credit memo then user can un apply this line from receivable application lines.
Thanks & RegardsLooks like your question is about the E-Business Suite version of Receivables. As this forum is dedicated to the Fusion line of applications, please repost your question in the EBS forums to increase your chances of getting a helpful reply.
thanks,
Oliver
Fusion Apps Developer Relations -
How can I use a READ statement for the checking date =sydatum?
Hello,
I need use a READ statement on an internal table ITAB (with feild var1) and check whether feild var1<= sydatum(i.e. var1 greater than or equal to sy-datum)....how can I implement this??
Regards,
Shashank.Hi,
try this short example.
DATA: BEGIN OF ITAB OCCURS 0,
DATE LIKE SY-DATUM,
END OF ITAB.
ITAB-DATE = '20000101'. APPEND ITAB.
ITAB-DATE = '20010101'. APPEND ITAB.
ITAB-DATE = '20020101'. APPEND ITAB.
ITAB-DATE = '20030101'. APPEND ITAB.
ITAB-DATE = '20040101'. APPEND ITAB.
ITAB-DATE = '20050101'. APPEND ITAB.
ITAB-DATE = '20060101'. APPEND ITAB.
ITAB-DATE = '20070101'. APPEND ITAB.
ITAB-DATE = SY-DATUM. APPEND ITAB.
ITAB-DATE = '20080101'. APPEND ITAB.
LOOP AT ITAB WHERE DATE < SY-DATUM.
WRITE: / 'before', ITAB-DATE.
ENDLOOP.
LOOP AT ITAB WHERE DATE = SY-DATUM.
WRITE: / 'equal ', ITAB-DATE.
ENDLOOP.
LOOP AT ITAB WHERE DATE > SY-DATUM.
WRITE: / 'after ', ITAB-DATE.
ENDLOOP.
Regards, Dieter -
Can put condition in read statement for a particular fild please suggest?
hi i have a requirement as belo
1 ) i am reading a table with read statement now i want to read with one more condition like
where status<> Z
to add to this read statement as below can i add the above condition to the below statement?? let me know
how to check on this one more condition in below read statement
loop at itrecord1 into wa_Record
READ TABLE it_main INTO wa_inv_master WITH KEY
/' CUSIP = wa_record-primarykeyfield1 BINARY SEARCH.
here one more condition i need to put whilereading that where statu <>z which is best way todo
IF SY-SUBRC = 0.
APPEND wa_record TO itrecord1.
clear wa_record.
else.
APPEND wa_record TO itrecord2.
clear : wa_record.
ENDIF.
ENDLOOP.
so how to put the condition in above statment can put in the read statement as that is most convinient will that work?
regards
aroraHello arora.
You can restrict the READ to an internal table, using "n" conditions in WITH KEY statement.
Use:
READ TABLE it_main INTO wa_inv_master
WITH KEY cusip = wa_record-primarykeyfield1
field2 = wa_record-field2
fieldn = wa_record-fieldn
BINARY SEARCH.
Remember that if you want restrictions like ">=", "<=", "<" or "<", must use LOOP, not READ.
Regards.
Valter Oliveira. -
Checking conditions in SELECT statement
Hi All,
I am relative new to ABAP and I would like to ask a question about checking conditions in SELECT statement in the "WHERE" part.
There are two checkboxes at the selection screen and each should disable one of conditions (marked with two stars) in the SELECT mentioned below.
My question is, whether there exists an option how to solve this problem without using solution like:
IF checkobx1.
SELECT (without one condition)
ELSEIF checkbox2.
SELECT(without other condition).
ELSE.
SELECT (with both conditions)
SELECT qprueflos qherkunft qaufnr qsa_aufnr qmatnr qwerkvorg
qpastrterm qpaendterm
qverid qobjnr vobjnr AS objnr_fa vauart
FROM qals AS q INNER JOIN vkaufk AS v
ON qaufnr = vaufnr
INTO CORRESPONDING FIELDS OF TABLE gt_qals
WHERE q~prueflos IN s_pruefl
AND q~stat35 EQ space
AND q~werk EQ loswk
AND q~herkunft IN s_herk
AND q~offennlzmk EQ 0
AND q~offen_lzmk EQ 0
AND q~pastrterm IN s_startt
AND q~paendterm LE s_endt
AND v~auart IN s_auart. "('ZCPA', 'ZCPK', 'ZCBA').Hi,
With this, I think u can directly read into WHERE clause
IF checkbox1.
v_where = '& BETWEEN ''&'' AND ''&'' '.
REPLACE '&' WITH key_field INTO v_where.
REPLACE '&' WITH field_LOW INTO v_where.
REPLACE '&' WITH field_HIGH INTO v_where.
CONDENSE v_where.
ELSEIF checkbox2.
v_where = '& BETWEEN ''&'' AND ''&'' '.
REPLACE '&' WITH key_field INTO v_where.
REPLACE '&' WITH field_LOW INTO v_where.
REPLACE '&' WITH field_HIGH INTO v_where.
CONDENSE v_where.
ENDIF.
select * into corresponding fields of table ITAB
from (table_name)
where (v_where).
In this key_field is your fieldname in the where clause and field_low, field_high are range of values.
If i write static query it looks like this
RANGES: MATNR1 FOR MARA-MATNR.
MATNR1-LOW = MATNR_LOW.
MATNR1-HIGH = MATNR_HIGH.
MATNR1-SIGN = 'I'.
MATNR1-OPTION = 'BT'.
APPEND MATNR1.
select * into corresponding fields of table itab
from mara where matnr BETWEEN 'M100' AND 'M200'.
Hope it helps u
thanks\
Mahesh
Edited by: Mahesh Reddy on Jan 30, 2009 11:23 AM -
Read table and checking condition in PAI
Hi,
I have a requirement where I need to check and compare with (Custom table) Bankn with Partner Bank`s bankn.
I have wrote a code in PAI like this.
MODULE CHECK_BANKN INPUT.
Data: l_bankn like (Custom table)-bankn.
select bankn from (Custom Table) into l_bankn
where recno = g_recno.
IF NOT g_head-bankn IS INITIAL.
Read table i_bvtyp with key bankn = i_bvtyp-bankn .
IF l_bankn <> i_bvtyp-bankn.--------->" Comparison of (custom table) Bankn with internal table I_BVTYP-BANKN
MESSAGE w022 WITH text-w06.
ENDIF.
ENDIF.
ENDMODULE.
My Read Table statement is seems to be wrong and my checking condition is also wrong.
So, how to resolve this?
regards,
KiranHi Kiran,
If you observe your read statement, you are comparing the field with it's own table field.
Read table i_bvtyp with key bankn = i_bvtyp-bankn .
Untill unless you read I_BVTYP, i_bvtyp-bankn will be initial and you cannot find the matching record with Null-Value.
So, I think you need compare with l_bankn.
Read table i_bvtyp with key bankn = i_bankn .
Then you can directly raise a message using SY-SUBRC value.
Read table i_bvtyp with key bankn = i_bankn
if SY-SUBRC <> 0 .
<MESSAGE>
endif.
Regards,
Vijay -
How to give two values of same field in read Statment
Hi,
Please Tell me how to give the two values of same field in read statements Condition.
i.e
Read table it_tab with key matnr = '1' or matnr = '2'.
With Regards
KesavaperumalHi Kesavaperumal,
<li>You can not use OR operator with READ TABLE statement.
<li>You have to use different fields of the internal table in where condition.
<li>If you want to compare with two values, you need to use LOOP statement.
LOOP AT it_mara WHERE matnr = '1' or matnr = '2'.
"Write code
ENDLOOP.
Thanks
Venkat.O -
How to give authorization for create and change particular Condition Type
Hi...
In my requirement is , Only one user can be authorized to create and change a particular condition type 'ZABC' in vk11 and vk12 .
For remaining condition type can be used as in normal .
How to do this ? How to give authorization for a particular user for particular condition type ?
Plz guide me ..
Thanks in advance .
Deepa .Hi Deepa ,
u can check A.Object V_KOND_VEA, in user profile u can assign condition type or tables.
have a word with ur basis guy , so he can help u in better way.
aand also ref FM SD_COND_AUTH_CHECK
Regards
Prabhu -
Hi all,
I need to write a READ statement for the below req.
I have one internal table as ITAB.
Loop at Itab1.
Read table ITAB2 with key ( CAN = Itab1-Value1 ) or
( CAN = Itab1-Value2 ).
endloop.
this is not working.How to give OR condn in Read statementYou can also use another LOOP statement :
LOOP AT Itab1.
LOOP AT ITAB2 WHERE CAN = Itab1-Value1
OR CAN = Itab1-Value2.
ENDLOOP.
ENDLOOP. -
How to update Ztable from Excel file and how to check conditions ,
HI this uday,
pls help me how can i update Ztable from Excel file and how to check conditions .
regards
uday
Moderator message: please (re)search yourself before asking.
Edited by: Thomas Zloch on Jul 13, 2010 12:00 PMHi
Use Fm : ALSM_EXCEL_TO_INTERNAL_TABLE.
L_INTERN : internal table with your fields .
make sure that the fields in the Excel should be formatted (as numeric , characher ) depending upon the data types .
LOOP AT L_INTERN INTO WA_LINTERN .
MOVE WA_LINTERN-COL TO L_INDEX.
ASSIGN COMPONENT L_INDEX OF STRUCTURE WA_INREC TO <FS> .
IF SY-SUBRC = 0.
MOVE WA_LINTERN-VALUE TO <FS>.
ENDIF.
AT END OF ROW . "#EC *
APPEND WA_INREC TO IT_DATA. "
CLEAR WA_INREC.
ENDAT.
ENDLOOP.
Regards
Swapnil -
How can I put check conditions when using Function 'LDB_PROCESS'
Hy experts,
I am using LDB_PROCESS and I don't know how to use check conditions in the callback forms.
for example:
FORM CALLBACK_QALS USING NAME TYPE LDBN-LDBNODE
WA TYPE QALS
EVT TYPE C
CHECK TYPE C.
CASE EVT.
WHEN 'G'.
MOVE-CORRESPONDING wa to ITAB_QALS.
APPEND ITAB_QALS.
ENDCASE.
endform. " CALLBACK_QALS
Have anyone an example of how I can use check conditions in this type of form???
thx in advanceHi
U should indicate in which node (the GET) you need to check the condition, you form should have the following interface:
FORM <formname> USING <nodename> LIKE LDBCB-LDBNODE
<workarea> (LIKE ...)
<mode>
<selected>.
So the code should be:
CHECK <WORKAREA>-FIELD = ............
Max -
How to change select upto 1 rows into read statement
Dear all,
Table A contains many dates for given salesdocumentnumber and
Table B contains many dates for given salesdocumentnumber .
Table A and Table B contains same entries .II need maxdate for all salesdocument in Table A comparing Table A and Table B
TableA_alias was sorted and deleted adjacent duplicates.
loop at TableA_alias
select pdate into variable_1 from table Table_A
UP TO 1 ROWS order by pdate descending
where
it_pdate-salesdoc = TableA_alias-salesdoc and
it_pdate-salesitem = TableA_alias-salesitem and
it_pdate-sline = TableA_alias-sline .
select pdate into variable_2 from table Table_B
UP TO 1 ROWS order by pdate descending
where
it_pdate-salesdoc = TableA_alias-salesdoc and
it_pdate-salesitem = TableA_alias-salesitem and
it_pdate-sline = TableA_alias-sline .
if variable_1 > variable_2.
TableA_alias-pdate = variable_1.
else.
TableA_alias-pdate = variable_2.
endif.
endloop.
Could anyone help me to make this code more performance tuned by using Read statement
Regards
Bala
Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting - post locked
Edited by: Rob Burbank on Nov 16, 2009 9:19 AMhi Siegfried,
i need to make this code ,performance wise more optimized. could you please suggest how can i improve this
loop at it_pdate_temp into wa_pdate_temp.
select /bic/zpviewdt from /BIC/AZVFOSDP100 into variable_1
UP TO 1 ROWS
where
doc_number = wa_pdate_temp-salesdoc and
s_ord_item = wa_pdate_temp-salesitem and
sched_line = wa_pdate_temp-sline
order by /bic/zpviewdt descending .
endselect.
select /bic/zpviewdt from /bic/azvfosp1w00 into variable_2
UP TO 1 ROWS
where
doc_number = wa_pdate_temp-salesdoc and
s_ord_item = wa_pdate_temp-salesitem and
sched_line = wa_pdate_temp-sline
order by /bic/zpviewdt descending .
endselect.
if variable_1 > variable_2.
wa_pdate_temp-pdate = variable_1.
else.
wa_pdate_temp-pdate = variable_2.
endif.
endloop. -
How to write read dataset statement in unicode
Hi All,
I am writing the program using open dataset concept .
i am using follwing code.
PERFORM FILE_OPEN_INPUT USING P_P_IFIL.
READ DATASET P_P_IFIL INTO V_WA.
IF SY-SUBRC <> 0.
V_ABORT = C_X.
WRITE: / TEXT-108.
PERFORM CLOSE_FILE USING P_P_IFIL.
ELSE.
V_HEADER_CT = V_HEADER_CT + 1.
ENDIF.
Read dataset will work for normal code.
when it comes to unicode it is going to dump.
Please can u tell the solution how to write read dataset in unicode.
Very urget.
Regards
VenuHi Venu,
This example deals with the opening and closing of files.
Before Unicode conversion
data:
begin of STRUC,
F1 type c,
F2 type p,
end of STRUC,
DSN(30) type c value 'TEMPFILE'.
STRUC-F1 = 'X'.
STRUC-F2 = 42.
Write data to file
open dataset DSN in text mode. ß Unicode error
transfer STRUC to DSN.
close dataset DSN.
Read data from file
clear STRUC.
open dataset DSN in text mode. ß Unicode error
read dataset DSN into STRUC.
close dataset DSN.
write: / STRUC-F1, STRUC-F2.
This example program cannot be executed in Unicode for two reasons. Firstly, in Unicode programs, the file format must be specified more precisely for OPEN DATASET and, secondly, only purely character-type structures can still be written to text files.
Depending on whether the old file format still has to be read or whether it is possible to store the data in a new format, there are various possible conversion variants, two of which are introduced here.
After Unicode conversion
Case 1: New textual storage in UTF-8 format
data:
begin of STRUC2,
F1 type c,
F2(20) type c,
end of STRUC2.
Put data into text format
move-corresponding STRUC to STRUC2.
Write data to file
open dataset DSN in text mode for output encoding utf-8.
transfer STRUC2 to DSN.
close dataset DSN.
Read data from file
clear STRUC.
open dataset DSN in text mode for input encoding utf-8.
read dataset DSN into STRUC2.
close dataset DSN.
move-corresponding STRUC2 to STRUC.
write: / STRUC-F1, STRUC-F2.
The textual storage in UTF-8 format ensures that the created files are platform-independent.
After Unicode conversion
Case 2: Old non-Unicode format must be retained
Write data to file
open dataset DSN in legacy text mode for output.
transfer STRUC to DSN.
close dataset DSN.
read from file
clear STRUC.
open dataset DSN in legacy text mode for input.
read dataset DSN into STRUC.
close dataset DSN.
write: / STRUC-F1, STRUC-F2.
Using the LEGACY TEXT MODE ensures that the data is stored and read in the old non-Unicode format. In this mode, it is also possible to read or write non-character-type structures. However, be aware that data loss and conversion errors can occur in Unicode systems if there are characters in the structure that cannot be represented in the non-Unicode codepage.
Reward pts if found usefull :)
Regards
Sathish
Maybe you are looking for
-
OK, I buy movies from the TV and they download to the TV. Then they sync to my iTunes Library on my iMac (I now have 2 copies?) I change the sync settings to only sync the latest un-watched movie and they disappear from the TV... My iTunes Library
-
Hi, I have implemented Access Control Engine for the authorizations over Business Activities and works fine. Now, I'm implementing authorizations over Business Partners in the same way. The problem is that the system does not the checks in BP transac
-
Rate My Graphic Design Projects
If a freelance graphic designer would like to get feedback from other (hopefully knowledgeable) designers concerning their own designs, is there a website(s) that allows one to upload their works and have people comment? There are many times the peop
-
Deleting project tabs - and whole projects in FCP
Hi, I am in the process of cleaning up my hard-drive of finished projects and want to make as muh space as possible. With finished projects which I have backup and hard copy, how do I erase the projects from FCP, or at least avoid having them take up
-
Need hotkey utility for my Satellite L505-138
Please send me link for hotkey utility. I need it for my Satellite L505-138. I cannot find it. Windows 7 x64