Read Statement Issue
HI,
I am facing problem with read statement, please find below my code and provide the solution.
My Internal Tables.
TYPES: BEGIN OF TYP_BSAK,
BUKRS TYPE BSAK-BUKRS,
LIFNR TYPE BSAK-LIFNR,
AUGDT TYPE BSAK-AUGDT,
GJAHR TYPE BSAK-GJAHR,
BELNR TYPE BSAK-BELNR,
BUZEI TYPE BSAK-BUZEI,
BUDAT TYPE BSAK-BUDAT,
BLART TYPE BSAK-BLART,
DMBTR TYPE BSAK-DMBTR,
SGTXT TYPE BSAK-SGTXT,
AUGBL TYPE BSAK-AUGBL,
HKONT TYPE BSAK-HKONT,
END OF TYP_BSAK.
DATA : IT_BSAK TYPE STANDARD TABLE OF TYP_BSAK WITH HEADER LINE,
WA_BSAK TYPE TYP_BSAK.
READ STATEMENT :
LOOP AT IT_BSIS INTO WA_BSIS. -> I am getting data in wa_BSIs
READ TABLE IT_BSAK INTO WA_BSAK -> I am Getting record in IT_BSAK bu the same is not populated in WA_BSAK
WITH KEY BUKRS = S_BUKRS.
IF SY-SUBRC = 0.
WA_OUTPUT-SAPSYS = 'PROBE'.
WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.
WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.
WA_OUTPUT-BELNR = WA_BSAK-BELNR.
WA_OUTPUT-SGTXT = WA_BSAK-SGTXT.
WA_OUTPUT-BUDAT = WA_BSAK-BUDAT.
WA_OUTPUT-AUGBL = WA_BSAK-AUGBL.
WA_OUTPUT-LIFNR = WA_LFA1-LIFNR.
WA_OUTPUT-NAME1 = WA_LFA1-NAME1.
WA_OUTPUT-STRAS = WA_LFA1-STRAS.
WA_OUTPUT-ORT01 = WA_LFA1-ORT01.
WA_OUTPUT-REGIO = WA_LFA1-REGIO.
WA_OUTPUT-PSTLZ = WA_LFA1-PSTLZ.
WA_OUTPUT-STCD2 = WA_LFA1-STCD2.
ENDIF.
APPEND WA_OUTPUT TO IT_OUTPUT.
ENDLOOP.
Thanks and Regards
VB
Hi,
I hope You have use below code solved your problem.
LOOP AT IT_BSIS INTO WA_BSIS
READ TABLE IT_BSAK INTO WA_BSAK
WITH KEY BUKRS = WA_BSIS-BUKRS.
IF SY-SUBRC = 0.
WA_OUTPUT-SAPSYS = 'PROBE'.
WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.
WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.
WA_OUTPUT-BELNR = WA_BSAK-BELNR.
WA_OUTPUT-SGTXT = WA_BSAK-SGTXT.
WA_OUTPUT-BUDAT = WA_BSAK-BUDAT.
WA_OUTPUT-AUGBL = WA_BSAK-AUGBL.
WA_OUTPUT-LIFNR = WA_LFA1-LIFNR.
WA_OUTPUT-NAME1 = WA_LFA1-NAME1.
WA_OUTPUT-STRAS = WA_LFA1-STRAS.
WA_OUTPUT-ORT01 = WA_LFA1-ORT01.
WA_OUTPUT-REGIO = WA_LFA1-REGIO.
WA_OUTPUT-PSTLZ = WA_LFA1-PSTLZ.
WA_OUTPUT-STCD2 = WA_LFA1-STCD2.
ENDIF.
APPEND WA_OUTPUT TO IT_OUTPUT.
ENDLOOP.
Thanks
Regards
I.Muthukumar.
Edited by: I.Muthukumar on Jun 25, 2010 12:43 PM
Similar Messages
-
Issue with read statement with one more key missing in mapping
Hi All ,
I have such data in two internals table :
IT_bdc
vbeln posnr
90000593 10
90000576 10
90000672 10
90000672 20
90000672 30
it_konv
kbetr vbeln
6250 90000576
12160000 90000593
500000 90000672
600000 90000672
700000 90000672
My current program statement is :
LOOP AT it_bdc.
READ TABLE it_konv WITH KEY
vbeln = it_bdocs-vbeln.
currency = it_konv-waers.
endloop.
as you can see the posnr is missing in it_konv how can i modify this read statement so
that vbeln posnr from it_bdc should get correct kbetr from it_konv.
Kindly help in this mapping.Hi
sort it_konv by vbeln
then
loop at it_bdc.
read table it_konv with key vbeln = it_bdc-vbeln binary search.
if sy-subrc = 0.
perform your logic/task.
endif.
endloop.
also it depends what you want to do after reading it_konv.
in my logic if there is a vbeln in it_konv which s present in it_bdc then sy-subrc will be 0
and you can perform your logic.
and if there will be no matching vbeln in it_konv then sy-subrc will not be 0.
check the values in debugging.
Thanks
Lalit -
Hi,
AM using Read statement to read internal table as below.
Read itab into wa with key x = y.
if sy-subrc eq 0.
do some thing.
endif.
However the work area wa is not useful to me in my program. when am doing extended check it is issueing warning saying wa is not used. HOW TO CLOSE THIS WARNING.
Regards,
AAkashjust before read statement do
CLEAR WA.
This should remove the error.
Cheers
VJ -
Read statement with repeated key field
Hi Experts ,
We are in the process of UCCHECK in an upgrade program and come across an issue with read statement using repeated key fields which is not allowed in a unicode compatable environment.
READ TABLE it_vbpa WITH KEY
vbeln = l_vbeln
parvw = '0'
parvw = 'ZN'.
I checked this in 4.6c environment and observed that the Read statement uses the last key value for reading and doesnt consider other values even if the last value is not present in the table .
I want to know if I can use only that last value for read statement ? If so, what was the use of the repeated key fields in a read statement?
Thanks and Regards
SanuHi,
Your main aim in a upgrade would be to successfully replicate the 4.6x functionalities in the ECC 6 version with the unicode checks. So it would be a safe option to only consider the last key condition. I dont have access to a 4.6C environment. May be it was a mistake corrected by SAP in the new version.
Vikranth -
Hello Gurus,
I need a help.
The below code is used in a BI-FIGL custom user exit.
BSIS read statement.
ABAP Code:
Get Cost Center Accounting from BSIS table
SELECT bukrs "Company Code
gjahr "Fiscal Year
monat "Fiscal Period
hkont "General Ledger Account
prctr "Profit Center
budat "Posting Date in the Document
gsber "Business Area
zuonr "Assignment Number
belnr "Accounting Document Number
kostl "Cost Center Accounting
FROM bsis
INTO TABLE pt_kostl_acc
FOR ALL ENTRIES IN pt_gl_data
WHERE bukrs EQ pt_gl_data-bukrs
AND gjahr EQ pt_gl_data-gjahr
AND monat EQ pt_gl_data-monat
AND hkont EQ pt_gl_data-hkont
AND prctr EQ pt_gl_data-prctr
AND budat EQ pt_gl_data-budat
AND gsber EQ pt_gl_data-gsber
AND zuonr EQ pt_gl_data-zuonr
AND belnr EQ pt_gl_data-belnr.
The extractor literally stops at the above select statement.
Please advise how to solve it.
I created an index . Actually it wroked fine in Q. When I moved to production it is not working. Did I do anything wrong ?
Let me know. ThanksThanks to all.
here is my problem. I had the same issue in QA few weeks back. QA was refreshed with PRD data and almost the no of records are same. Around 13.1 million records. This is a user exit in standard BI extractor. It used to hang at the sequential read from BSIS. I created a secondary index and moved to QA and updated the statistics. it worked fine. I can extract almost 2 quarters of data to BW without any issue. I moved all the transports to production couple of days back and again started the extractor. The same problem it got stuck at the BSIS select. I have the same index in production and also updated the statistics. I don't have the ST05 access and I have asked the basis to give to find oout what index it is using to select from BSIS. I can change the code accorind to the suggestions above. In BI each packet size is 15 K records. So for each packet it will do the select each time. So I don't think 15 K records are too high.I though of asking the basis to look into this issue. Since it is working fine in QA. Do you guys have any suggestion. Again thanks for your help.
Edited by: Senthil Esakkiappan on Nov 5, 2009 7:31 PM -
Read statement on dynamic internal tables
Hello All,
I have a dynamic internal table <G_T_ITAB> with fields F1, F2, F3 & F4 .
I want to read the internal table <G_T_ITAB>. So im using the below code.
LOOP AT G_T_DATA.
READ TABLE <G_T_ITAB> INTO <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.
IF SY-SUBRC <> 0.
ELSE.
ENDIF.
ENDLOOP.
But this is giving syntax error that F1 is not the field of <G_T_ITAB>. But the field is there in <G_T_ITAB>.
Can you suggest me to solve this issue. Or is there any other approach to use READ statement on dynamic internal tables.
Thanks in advance.
Best Regards,
Sasidhar Reddy Matli.Hi ,
Read this way....
FIELD-SYMBOLS:
<fs_str> type any,
<fs_lf_fval> type any,
<fs_lt_result_rate> type any table,
<fs_ls_result_rate> type any.
DATA:
lv_fname type string.
lv_fname = 'MATNR'.
assign component 'matnr' of structure <fs_str> to <fs_lf_fval>.
READ TABLE <fs_lt_result_rate> INTO <fs_ls_result_rate>
WITH KEY (lv_fname) = <fs_lf_fval>.
Thanks,
Shailaja Ainala. -
Dear Experts,
I am making monthly consumption report, In which i am getting monthly data column wise for different month , here firstly i am fetching header mblnr date according to date from mkpf then i am fetching data from mseg.....
I have same mblnr in both tables..... Now i am using read statement like this.......
sort lt_mkpf by mblnr.
SORT lt_mseg BY mblnr.
LOOP AT lt_mkpf INTO lw_mkpf.
READ TABLE lt_mseg INTO lw_mseg WITH KEY mblnr = lw_mkpf-mblnr
mjahr = lw_mkpf-mjahr
BINARY SEARCH.
When I am debugging i am getting data in lw_mkpf but sy-subrc = 4 is coming and getting wrong data in final table by using these above statements..........
where as if i am using loop like this:
SORT lt_mkpf BY mblnr.
SORT lt_mseg BY mblnr.
LOOP AT lt_mkpf INTO lw_mkpf.
v_mkpf = lw_mkpf-mblnr.
LOOP AT lt_mseg INTO lw_mseg WHERE mblnr EQ v_mkpf.
with this i am getting right data........ But it takes lot of time to execute..........
Can you please guide me am i using read statement by wrong method. which one is the correct method which one shoul be used.........Hello Shelly,
To solve the issue of read table being failed, Sort the internal table by mblnr and mjahr. say sort lt_mseg by mblnr mjahr but read the internal table mseg will give you only one data. What about the other line items. MSEG is material document line item table. So for one record in MKPF there can be more than one record in MSEG. So to consider all the line items, you need to loop on the MSEG internal table instead of read table.
LOOP AT lt_mkpf INTO lw_mkpf.
v_mkpf = lw_mkpf-mblnr.
LOOP AT lt_mseg INTO lw_mseg WHERE mblnr EQ v_mkpf.
This statement will take time and create performance issue. So rewrite the statement as
LOOP AT lt_mseg INTO lw_mseg.
read table lt_mkpf with key lw_mkpf binary search.
Regards
Farzan -
How to monitor SQL statements issued by SIEBEL ?
Hi,
We have developed BI Siebel 10.1.3.3. application.
One of the requirement is to persist/store in the database real SQL statement issued by BI Dashboards/Answers.
The best solution would be having acces on-line to cursor cache.
Could someone please tell me how to achive this ?
Regards,
CezarySounds like you're looking for Usage Tracking.
OBIEE Server Administration Guide – Pages: 220
OBIEE Installation and Configuration Guide – Pages: 229
And this post here;
http://oraclebizint.wordpress.com/2007/08/14/usage-tracking-in-obi-ee/
A. -
Trace SQL statement issued by BC4J
Is there a way to see at runtime (in the console window or in a log file) the SQL statements issued by the BC4Js to the database?
Perhaps there is a switch or a -D option to set to the OC4J startup command. This would be really helpfull during development.
Thanks,
Marco.Yes, you are right. that will be done by specify a Java virtual parameters - -Djbo.debugoutput=console.
-
Finding Delete statement issued in particular object
Dear All,
Please let me know how to find what are all the delete statement issued against a object in oracle. some one is deleted some data from one table i want to find when the delete statement fired in my schema.
With Regards
Rameshyou have audit turn on right? there should be a report for DML in audit vault.
-
Logical expression( = , =, , ) in read statement
Hi All,
Is it possible to use the logical expressions like (<= , >=, <, >) in the read statement?While you can only use "=" with the READ statement, you can use the READ statement to position the cursor at the first record you want and then use the LOOP with your operators to get only those records you want (assuming standard tables that have been correctly sorted). This can be very efficient.
There have been many discussion about this in the forums. Please search and you'll see them.
Rob -
Problem with READ Statement in the field routine of the Transformation
Hi,
I have problem with read statement with binary search in the field routine of the transformation.
read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
Code in the start routine
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp <> 3.
delete it_zcam where end_dt initial.
sort it_zcam by surce accno.
endif.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif.
this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
this field i am using in the report filter.
please let me know if anybody has the soluton or reason for this strage behaviour.
thanks,
Rahim.i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
1. is the key of zcam_o11 source and accno ?
2. you need to get the sortout of if endif (see code below)
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp 3.
delete it_zcam where end_dt initial.
endif.
sort it_zcam by surce accno.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif. -
Error: unexpected XML reader state. expected: END but found: START:
I am getting following error while invoking method 'GetVersionInfo' (.net web service over dll) which takes one input parameter(string) and gives two output parameters(both short):
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception: deserialization
error: unexpected XML reader state. expected: END but found: START:
{UPPLink}pnVersionMajor
ORA-06512: at "SYS.UTL_DBWS", line 388
ORA-06512: at "SYS.UTL_DBWS", line 385
ORA-06512: at line 40
Expected Request is as follows:
POST /UPPLink/UPPLink.asmx HTTP/1.1
Host: 172.16.1.38
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "UPPLink/GetVersionInfo"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetVersionInfo xmlns="UPPLink">
<ignore>string</ignore>
</GetVersionInfo>
</soap:Body>
</soap:Envelope>
EXpected Response is as follows:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetVersionInfoResponse xmlns="UPPLink">
<GetVersionInfoResult>
<pnVersionMajor>short</pnVersionMajor>
<pnVersionMinor>short</pnVersionMinor>
</GetVersionInfoResult>
</GetVersionInfoResponse>
</soap:Body>
</soap:Envelope>
The PL/SQL code I am using is as follows:
DECLARE
service_ sys.utl_dbws.SERVICE;
call_ sys.UTL_DBWS.call;
service_qname sys.utl_dbws.QNAME;
port_qname sys.utl_dbws.QNAME;
operation_qname sys.utl_dbws.QNAME;
string_type_qname sys.utl_dbws.QNAME;
number_type_qname sys.utl_dbws.QNAME;
retx ANYDATA;
strEntry VARCHAR2(100);
retx_string VARCHAR2(100);
majorVersion NUMBER;
minorVersion NUMBER;
params sys.utl_dbws.ANYDATA_LIST;
v_outputs sys.utl_dbws.anydata_list;
BEGIN
dbms_output.put_line('Starting Function');
service_qname := sys.utl_dbws.to_qname(null, 'UPPLink');
strEntry := 'vab';
dbms_output.put_line('Creating Service');
service_ := sys.utl_dbws.create_service(HTTPURITYPE('http://172.16.1.38/UPPLink/UPPLink.asmx?WSDL'), service_qname);
dbms_output.put_line('Creating Operation');
operation_qname := sys.utl_dbws.to_qname(null, 'GetVersionInfo');
dbms_output.put_line('Calling Service');
call_ := sys.utl_dbws.create_call(service_, null, operation_qname);
sys.utl_dbws.set_property(call_, 'SOAPACTION_USE', 'true');
sys.utl_dbws.set_property(call_, 'SOAPACTION_URI', 'UPPLink/GetVersionInfo');
sys.utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
string_type_qname := sys.utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
number_type_qname := sys.utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'short');
sys.utl_dbws.add_parameter(call_, 'ignore', string_type_qname, 'ParameterMode.IN');
sys.utl_dbws.add_parameter(call_, 'pnVersionMinor', number_type_qname, 'ParameterMode.OUT');
sys.utl_dbws.set_return_type(call_, number_type_qname);
params(0) := ANYDATA.convertvarchar2(strEntry);
dbms_output.put('Invoking with Input Parameter: ');
dbms_output.put_line(ANYDATA.ACCESSVARCHAR2(params(0)));
retx := sys.utl_dbws.invoke(call_, params);
dbms_output.put_line('Invoke complete');
majorVersion := retx.accessnumber;
dbms_output.put_line('Major Version ' || majorVersion);
v_outputs := SYS.utl_dbws.get_output_values(call_);
minorVersion := ANYDATA.AccessNumber(v_outputs(1));
dbms_output.put_line('Minor Version ' || minorVersion);
sys.utl_dbws.release_service(service_);
END;
/Actually, the name needs to match what is specified in the WSDL file.
-
M or P master data table to be used in routine read statement
Hi
I update of a DSO i had a requirment for a routine to get the Attribute of a Infoobject.
So which master data table M or P table i need to use in my read statement and why
ThanksUse M table as it it the view on time dependent(P table) and time independent(Q table) tables.
M table is view on time dependent and time independent attributes, you can see characteristic values and all the attributes for the Characteristic.
The tables that go in the view are the Master Data Table and the Time-Dependent Master Data Table. If the characteristic only has time-dependent attributes, only the time-dependent master data table goes in. If the characteristic has only non-time-dependent attributes, only the master data table goes in. -
hi,
my code is ;
select vbeln audat kunnr auart
from vbak
into table t_vbak2
for all entries in t_vbfa2
where vbeln = t_vbfa2-vbelv
and audat in r_daterange
and kunnr = partner_number.
if not t_vbak2[] is initial.
sort t_vbak2 by vbeln audat auart.
endif.
now if i use read statement :
read table t_vbak2 into wa_vbak2
with key vbeln = wa_vbfa1-vbelv
audat in r_daterange
kunnr = partner_number binary search.
i get a syntax error.
can any one help me with this..
Thanks,
Challa.You can't use the IN operator in your READ statement, only = as you are trying to read with key. In your case, you must use the LOOP statement.
Loop at t_vbak2 into wa_vbak2
where vbeln = wa_vbfa1-vbelv
and audat in R_daterange
and kunnr = Partner_Number.
* Do whatever you need to do
Exit. " This is so you only read one record.
Endloop.
Regards,
RIch Heilman
Maybe you are looking for
-
Windows 8.1 is not detecting blank/recorded cds
I tried serveral ways to fix this problem but the CD/DVD rom still did not recocognize my recorded cds. movie DVD and antivirus software installation DVD work perfectly. I read some topics online and they said that windows 8 and 8.1 won't allow lapto
-
Printing to a printer from iPhone
If your printer does not have "air print capability", but has Wi-Fi, what can be done?
-
Changing track order in Library
I recently purchased 6 songs from the Bowie "Heroes" album from the iTunes Store. But looking at them in my iTunes Library, the title track had the wrong album information. It said it was from somebody's iMix, and had that person's photo in the artwo
-
Disable blinking cursor in Leopard
I would like to disable the blinking cursor that appears in the currently selected mac text field. Can this be done in MacOSX? to do this is vista is easy: http://www.microsoft.com/enable/training/windowsvista/blink.aspx The reason I need this is bec
-
Need help with incompatible InDesign file?
I need a favor guys, I have this file that I've been working on at school using CS5.5, the problem is that I have CS5 at home, so when I try to open it I get an error message. I need to be able to work on this project at home, it's very important. Is