Need Logic in Read statement
Hi guys,
I have an intenal table for suppose say 5 records with duplicate entrys.
My ITAB looks some thing like
TKNUM weight volume
1 10 5
1 8 6
1 15 10
2 30 15
2 20 9
I need to calculate total weight and volume for each TKNUM (Shipment number) i.e,
After calculation my new internal table should look like
TKNUM Total Weight Total Volume
1 33 21
2 50 24
How to do this.
Thanks in Advance.
Prasad.
Hi guys,
I have an intenal table for suppose say 5 records with duplicate entrys.
My ITAB looks some thing like
TKNUM weight volume
1 10 5
1 8 6
1 15 10
2 30 15
2 20 9
I need to calculate total weight and volume for each TKNUM (Shipment number) i.e,
After calculation my new internal table should look like
TKNUM Total Weight Total Volume
1 33 21
2 50 24
How to do this.
Thanks in Advance.
Prasad.
Hi Prasad,
You can use following code.
SORT itab BY tknum weight volume.
DATA: lv_itab LIKE itab ,
lv_weight LIKE itab-weight,
lv_volume LIKE itab-volume.
LOOP AT itab.
move itab to lv_itab.
lv_weight = lv_weight + itab-weight.
lv_volume = lv_volume + itab-volume.
AT END OF
itab1-tknum = lv_itab-tknum.
itab1-weight = lv_weight.
itab1-volume = lv_volume.
append itab1.
clear: itab1 ,
lv_weight,
lv_volume.
ENDAT.
ENDLOOP.
Hope this help you.
Regards,
Anil
Similar Messages
-
Logic behind read statement and material
SORT IT_EKBEF BY EBELN EBELP.
READ TABLE IT_EKBEF INTO WA_EKBEF
WITH KEY EBELN = WA_FINAL-EBELN
EBELP = WA_FINAL-EBELP BINARY SEARCH.
IF SY-SUBRC = 0.
WA_FINAL-MENGE = WA_EKBEF-MENGE.
ENDIF.
the above is my code............
i am not able to read data frfom inetrnal table to WA_ekbef .......if i am not giving material in the selection screen.......
If i give material for specific po then i am getting data........Pls solve this problem........
how this read statement is linked with material........
any suggetions pls??Hi,
I am fetching data inTO IT_EKBE..............
FROM IT_EKBE I AM MOVING TO WA_EKBE.......
FROM WA_EKBE I AM MOVING TO IT_EKBEF..............
THEN I AM USING READ STATEMENT WITH KEYWORDS EBELN, EBELP..........
BUT WHEN I AM FETCHING IT_EKBE I AM FETCHING DATA BASED ON MATERIAL ALSO.........
IS THAT THE PROBLEM??? -
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 -
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 -
Need FM or Logic to read the Classification of Production Order
Hi All,
I am going to CO03 transaction and display Production Order . ThenI am following path: Header-->Classification Controlling. Now i can see the General Characterstic descritpton and Value.
Can some one give me the FM or logic, to read the Controlling Classification of Production Order.
Thanks,
Suresh kUmar.Hi,
If the need is to read those values, then you can do that directly from the table.
Pass production order number to AUFK-AUFNR, then read OBJNR.
Pass AUFK-OBJNR to AUSP-OBJNR, read values from AUSP-ATWRT.
If you want the characteristic description as well, then pass AUSP-ATINN to CABNT-ATINN & read CABNT-ATBEZ. (Ensure you also specify the language key).
Hope it clarifies.
Regards,
Vivek -
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. -
Need Help ASAP my State tax form is in a PDF file and the attachment in my email says Please wait
Need Help ASAP my State tax form is in a PDF file and the attachment in my email says Please wait...
I tried downloading updates like it said to but it still will not display the document. How do I print the PDF file ASAPCan you give us a LOT more info?
What email client? What version of Reader (I can only assume you even have Reader at this point)?
Please wait? I'm sure it says more than that, right?
Have you tried simply saving the PDF (it IS a PDF correct?) to your desktop and opening it from there?
Did you get this form from the IRS or did it come from somewhere else? If the IRS again, what version of Reader?
Help us help you. -
Do I need Logic Pro 8.0.1 Update, and if so, how do I get it now?
Do I need Logic Pro 8.0.1 Update, and if so, how do I get it now?
Tuesday, 2008-07-29
Due to prolonged illness, I purchased the Logic Studio Upgrade version (I already had Logic Pro 7.2.3, with dongle) only last week. Logic Studio Upgrade version initially installs Logic Pro version 8.0.0. I then dutifully set out to download both the Logic Pro 8.0.1 Update and the Logic Pro 8.0.2 Update.
As of this week, all attempts and maneuvers to simply get the Logic Pro 8.0.1 Update have failed. I cannot even find it, let alone download it!
Yes, I've tried the relabeling juggling act to fool Software Update into eventually listing and providing both the Logic Pro 8.0.1 Update and the Logic Pro 8.0.2 Update—but no luck, not any longer. These moves may have worked up until relatively recently, but they do not work now, at least as of this week.
All searching of Apple's site(s) and Support pages results in nada—Apple itself no longer lists any such file/dmg/download/update anywhere! All previous links are either dead or just dump one back on to the Logic Pro 8.0.2 Update page.
(In my many searches, I noted what seemed to me to be a majority of opinion that the Logic Pro 8.0.1 Update was a dog, especially in Mac OS X Leopard 10.5.2 or 10.5.3. Many users reported crashes, panics, and.or freezes. Is this why Apple has pulled the update and rendered it extinct?)
I Googled, I Asked Why, I Cuiled—but no Logic Pro 8.0.1 Update, except as that which lurked in the murky warez waters. Still, frustrated as I was, I did even try all such I could find . . . but no third party-hosted update worked at all.
I am concerned because in all my previous experience with Apple and its applications, ample information is made readily available about the contents of any update and an explanation of its relationship to previous updates. By this latter I mean: Apple indicates that update "x" incorporates the previous updates "u" and "v"; therefore one can proceed safely to install update "x" even if one missed updates "u" and "v" or for whatever reason did not install them.
So . . . do I need Logic Pro 8.0.1 Update, if I am then going to further update with the Logic Pro 8.0.2 Update? Does Logic Pro 8.0.2 Update incorporate the changes made in Logic Pro 8.0.1 Update? Will I be missing (critically?) something(s) in Logic Pro 8.0.1 Update if I in fact do not ever get it or install it? And how would I know? Apple has not only removed the update and all traces of it, but Apple has also removed all information about Logic Pro 8.0.1 Update—it is now literally as if it never existed.
So what's a po' boy to do? Logic Pro 8.0.1 Update cannot now be found on VersionTracker or MacUpdate or anywhere else. To date, no user group or organization or educational institution or program or audio-related company posted it or archived it.
Where/how can I get a copy of the Logic Pro 8.0.1 Update?
If I can't, what do I do?
If I can't, what do I miss?
And where is Apple's support for Logic Studio/Logic Pro in all of this?
Earnestly hoping,
j.Rodger,
Thank you for your gracious welcome . . .
and thank you for your swift response . . .
and thank you for your information (and encouragement!).
Yes, I read that too, but searched in vain for the specifity of, say, your direction:
"Go ahead and update to 8.0.2, as it contains the 8.0.1 update."
So I shall!
Again, many thanks. -
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 -
Being new to iBook publishing I need to know if stats are available to determine how many times my iBook has been downloaded. Can anyone help please? I need to persuade someone that this really is worthwhile. Mr Ignorant.
The only people who can possibly assist you with this is Apple Customer Relations, call your local Apple contact number and ask for Customer Relations then explain your situation clearly and politely (be firm but don't rant).
You might want to investiage what the local laws are regarding defective goods and 'fit for use' definitions on warranties etc. Consumer Protection can be a useful tool to use or bargain with if needed ... -
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 -
I have doubt in Read statement
Hi All.
I have doubt in Read statement .i need to convert following select statement as read statement .how can i change help me.
IF p_field1 IS INITIAL
AND p_field2 IS INITIAL
AND p_field3 IS INITIAL
AND p_field4 IS INITIAL
AND p_field5 IS INITIAL.
SELECT *
FROM zdbt
INTO TABLE itab
WHERE field5 = p_field5
ORDER BY PRIMARY KEY.
IF sy-subrc <> 0.
MESSAGE s035.
ENDIF.
ENDIF.
regards,
Jay.hi
The READ statement is as below:
When u have a table already with values and to improve the performance u need to use this.
Reading Lines of Tables
To read a single line of any table, use the statement:
READ TABLE <itab> <key> <result>.
For the statement to be valid for any kind of table, you must specify the entry using the key and
not the index. You specify the key in the <key> part of the statement. The <result> part can
specify a further processing option for the line that is retrieved.
If the system finds an entry, it sets SY-SUBRC to zero, if not, it takes the value 4, as long as it is
not influenced by one of the possible additions. If the internal table is an index table, SY-TABIX
is set to the index of the line retrieved. If the table has a non-unique key and there are duplicate
entries, the first entry is read.
Thanks
Shiva -
Can't I use Field NE SPACE in READ statement ?
What is wrong with the below statments
READ TABLE t_zdadp_rpt WITH TABLE KEY t_zdadp_rpt-zdesc NE SPACE.
READ TABLE t_zdadp WITH TABLE KEY zdesc NE SPACE.
Could you pleae helpHi,
In the first statement u have to specify only field name also in read statement no need for table key its just key..U cannot use NE symbol for read statement.
READ TABLE t_zdadp_rpt WITH TABLE KEY t_zdadp_rpt-zdesc NE SPACE.
READ TABLE t_zdadp WITH TABLE KEY zdesc NE SPACE.
plz correct the code like this
READ TABLE t_zdadp WITH KEY zdesc Eq SPACE.
if sy-subrc ne 0.
do what ever u want.
endif.
reward if helpful.
Regards,
nagaraj
Maybe you are looking for
-
Stock transfer with excise duty
Hi Experts, i have to do stock transfer from one plant to other plant when excise duty is invloved. and both plants comes under one company code.and receiving plant not paying any thing to supplying plant.please suggest me which process shall i follo
-
IOS opens the wrong HTML select
I've got two simple HTML dropdowns menu using the <select>-tag. One is called 'dropdown1' and the other's called 'dropdown2'. But, when you tap on 'dropdown2' using an iPhone or iPad, it magically opens up 'dropdown1'. So basically you're unable to c
-
How to get dateformat from Control Panel? Please help
Hi, I need to get the date format as per displayed in the Control Panel's Regional Options tab. May i know how to achieve this in java? Please help.
-
Hello - We would like to add two data columns to this Query below -- 1. Foreign Name and 2. BP Properties #1 (all accounts that have BP Properties #1 selected, regardless of transaction). Help? SELECT T0.CardCode 'Acct #', T0.CntctPrsn, T0.CardName C
-
Hi, In a report we can click on a invoicenumber(SD) (hotspot) which leads us to tcode VF03-Display billing document. This is quite simple en works ofcourse fine. However the requirement is not to show VF03 but to display the invoice in print-preview