Get zuonr of table bsis and bsas
Hi All,
Tried getting the zuonr of bsas and bsis using bseg but got
Run time error long text. Exceeded the permitted time.
My condition is c_sales_pdc type bseg-hkont value u20180000102120u2019.
Need your advise on program optimization and rephrasing my program statements especially the case statements.
below is the code
Many thanks,
Aashta
SELECT bukrs
hkont
gjahr
belnr
budat
waers
blart
shkzg
wrbtr
dmbtr
augdt
xragl
FROM bsis
INTO TABLE it_bsis
WHERE hkont EQ c_sales_pdc
AND bukrs IN s_bukrs
AND belnr IN s_belnr
AND budat LE p_budat.
DELETE it_bsis WHERE blart NE 'DZ'
AND blart NE 'PD'.
DELETE it_bsis WHERE xragl NE ''.
SELECT augbl belnr bukrs gjahr buzei bschl
FROM bseg
INTO TABLE it_bseg
FOR ALL ENTRIES IN it_bsis
WHERE zuonr NE space
AND buzei = '01'
AND gjahr = it_bsis-gjahr
AND bschl IN ('01', '15')
AND qsskz = 'XX'
AND bukrs IN s_bukrs
AND zuonr IN s_zuonr
AND augbl IN s_belnr
AND augbl = it_bsis-belnr.
LOOP AT it_bseg.
CLEAR: it_bseg2-belnr, it_bseg2-zuonr, it_bseg2-kunnr.
CASE it_bseg-bschl.
WHEN '01'.
SELECT augbl zuonr kunnr
FROM bseg
INTO TABLE it_bseg2
FOR ALL ENTRIES IN it_bseg
WHERE augbl = it_bseg-augbl
AND augbl IN s_belnr
AND zuonr IN s_zuonr
AND kunnr IN s_kunnr.
WHEN '15'.
SELECT belnr zuonr kunnr
FROM bseg
INTO TABLE it_bseg2
FOR ALL ENTRIES IN it_bseg
WHERE belnr = it_bseg-belnr
AND belnr IN s_belnr
AND zuonr IN s_zuonr
AND kunnr IN s_kunnr.
WHEN OTHERS.
EXIT.
ENDCASE.
ENDLOOP.
SELECT zuonr prctr
FROM zfspbu
INTO TABLE it_zfspbu
FOR ALL ENTRIES IN it_bseg2
WHERE zuonr = it_bseg2-zuonr
AND zuonr IN s_zuonr.
Hi Aasta,
Obviously it will take the long time, because the fields you are retrieving in the select query are not in the proper order as of database fields and the same case in the where condition. Therefore I have corrected and kept in order. please check.
Select bukrs
hkont
gjahr
augdt
belnr
budat
waers
blart
shkzg
dmbtr
wrbtr
xragl
FROM bsis
INTO TABLE it_bsis
WHERE bukrs IN s_bukrs
AND hkont EQ c_sales_pdc
AND belnr IN s_belnr
AND budat LE p_budat.
Also please put the initial check before using for all entries.
i.e., if not it_bsis[] is initial.
SELECT bukrs
belnr
gjahr
buzei
augbl
bschl
FROM bseg
INTO TABLE it_bseg
FOR ALL ENTRIES IN it_bsis
WHERE bukrs IN s_bukrs
AND gjahr = it_bsis-gjahr
AND buzei = '01'
AND augbl = it_bsis-belnr
AND bschl IN ('01', '15')
AND qsskz = 'XX'
AND zuonr IN s_zuonr.
endif.
Please do the changes, hope will work fine.
Regards,
Md Ziauddin.
Similar Messages
-
Data recovery from BSIS and BSAS tables
Hi all,
The records in the tables BSIS and BSAS are deleted due to adhoc circumstances.
How do I recover this data in SAP?
Please help!!!
Thanks,
RaghavHello Raghav,
two possibilities without a complete restore (in a standard SAP environment):
1) Flashback Query (but it only works if your UNDO tablespace still contains all the data - parameter undo_retention):
http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_flashback.htm#ADFNS01003
2) LogMiner
http://docs.oracle.com/cd/E11882_01/server.112/e22490/logminer.htm#i1005553
Regards
Stefan -
BSAK link to BSIS and BSAS...
Hello Experts,
I am doing 2 FOR ALL ENTRIES to get records from BSIS and BSAS based on the records
that I got in BSAK. Currently, I only know of 3 fields to link which is BUKRS, BELNR, AND GJAHR
but I is still any more fields that I can link to BSAK from BSIS and BSAS? Because we are
experiencing performance issues in my program. I am using index for the 3 tables but still it gives us
performance issues. Below is my code:
* Get previous year
lv_year = p_gjahr - 1.
* Get records from PAYR
SELECT zbukr vblnr gjahr lifnr zaldt
FROM payr
INTO TABLE gt_payr
WHERE zbukr = p_bukrs
AND gjahr IN (lv_year, p_gjahr).
DELETE gt_payr WHERE zaldt+4(2) > p_monat.
SORT gt_payr BY zbukr vblnr gjahr lifnr zaldt.
DELETE ADJACENT DUPLICATES FROM gt_payr COMPARING zbukr vblnr gjahr lifnr zaldt.
IF NOT gt_payr[] IS INITIAL.
* Get records from BSAK
SELECT bukrs blart gjahr monat belnr lifnr dmbtr shkzg
FROM bsak
INTO TABLE gt_bsak
FOR ALL ENTRIES IN gt_payr
WHERE lifnr = gt_payr-lifnr
AND bukrs = gt_payr-zbukr
AND augdt = gt_payr-zaldt
AND augbl = gt_payr-vblnr
AND gjahr = gt_payr-gjahr.
ENDIF.
DELETE gt_bsak WHERE monat > p_monat.
DELETE gt_bsak WHERE shkzg <> 'H'.
gt_payments[] = gt_bsak[].
IF NOT gt_payments[] IS INITIAL.
* Get records from BSIS(Open items)
SELECT bukrs blart gjahr monat dmbtr hkont
FROM bsis
INTO TABLE gt_bsis
FOR ALL ENTRIES IN gt_payments
WHERE bukrs = gt_payments-bukrs
AND belnr = gt_payments-belnr
AND gjahr = gt_payments-gjahr
AND blart IN (lc_su, lc_px).
* Get records from BSAS(Cleared items)
SELECT bukrs blart gjahr monat dmbtr hkont
FROM bsas
INTO TABLE gt_bsas
FOR ALL ENTRIES IN gt_payments
WHERE bukrs = gt_payments-bukrs
AND belnr = gt_payments-belnr
AND gjahr = gt_payments-gjahr
AND blart IN (lc_su, lc_px).
ENDIF.
Hope you can help me guys. Thank you and take care!In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY
bsis
select MANDT
BUKRS
HKONT
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
bsak
select MANDT
BUKRS
LIFNR
UMSKS
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
bsas
select MANDT
BUKRS
HKONT
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
Message was edited by:
Karthikeyan Pandurangan -
Hi Experts
1) Is there any difference between BSIS and BSAS table?
2) What are open items and closed items?
pallaviBSIS : Open Items Available for GL
BSAS: Cleared Items Available for GL
Gl Acoount Open Line Items Available in Table BSIS,
GL Account Cleared Line Items Available in BSAS,
Ex: while Using T. Code F-02,
Dr 400500 Rs 1000
Cr 500100 Rs 1000
This Data Is Availeble In BSIS
Reverse Above Entry
Dr 500100 Rs 1000
Cr 400500 Rs 1000
This Data is Available In BSAS,
Regards,
Viswa -
Get value from table record and set Disabled property...
Hi! I have table in my JSPX page. I search for records and then press on one of the records with right click, see: http://my.jetscreenshot.com/2677/20120203-fas1-30kb
I set disabled property like this of my commandMenuItem:
#{row.GenResGrupa != 'true'}But as You can see from my picture above, the disabled property do not work. Where I am wrong with my code:
<af:commandMenuItem text="#{sampleBundle.pases}"
id="commandMenuItem1"
action="adfMenu_pasesDati"
actionListener="#{bindings.setCurrentRowWithKeyValue.execute}"
disabled="#{row.GenResGrupa != 'true'}"/> Please correct me! If You need some other information, please let me know.
Best regards, Debuger!Dear fedor! Popup is in facet contextMenu. contentDelivery="lazyUncached" for my popup:
<af:popup id="p1" contentDelivery="lazyUncached">
<af:menu text="menu 1" id="menu1">
<af:commandMenuItem text="#{sampleBundle.pases}"
id="commandMenuItem1"
action="adfMenu_pasesDati"
actionListener="#{bindings.setCurrentRowWithKeyValue.execute}"
disabled="#{row.bindings.GenResGrupa.inputValue != 'true'}"/>
</af:menu>
</af:popup>In my pageDef I have this code:
<bindings>
<tree IterBinding="LVAIMeklesanaIterator" id="LVAIMeklesana">
<nodeDefinition DefName="kokaugi.model.view.LVAIMeklesana"
Name="LVAIMeklesana0">
<AttrNames>
<Item Value="Accename"/>
<Item Value="LvaiKolekcijaPk"/>
<Item Value="Accenumb"/>
<Item Value="AvsGrupa"/>
<Item Value="Cropname"/>
<Item Value="EkspGrupa"/>
<Item Value="GenResGrupa"/>
<Item Value="Genus"/>
<Item Value="Species"/>
<Item Value="Sinonims"/>
</AttrNames>
</nodeDefinition>
</tree>
<action IterBinding="LVAIKolekcijaDatiIterator"
id="setCurrentRowWithKeyValue"
InstanceName="KokaugiModuleDataControl.LVAIKolekcijaDati"
DataControl="KokaugiModuleDataControl" RequiresUpdateModel="false"
Action="setCurrentRowWithKeyValue">
<NamedData NDName="rowKey" NDValue="#{row.LvaiKolekcijaPk}"
NDType="java.lang.String"/>
</action>
</bindings>And disabled property is like this:
disabled="#{row.bindings.GenResGrupa.inputValue != 'true'}"But it is still do not working. I am wrong somewhere? Maybe the only way to correct my problem is like Hohn said?
Best regards, Debuger! -
Hello
Can you please tell why do we need tables BSIS and BSAS. What kind kind of transactions they contain (practical example)?Hi,,
we need this tables at the time of making reports . based on requirement of client we take this tables,
what type of data is stored in that .i.e
BSIS is for open GL items.
BSAS is for closed GL items.
Regards,
R.N.Reddy. -
Urgent: BSIS and MSEG link
Hello,
I cannot get the material number of the GR line in FI documents.
I am using the tables BSIS and BSAS but cannot find any material number associated with them.
BSEG is an option but it is giving time-out dump when data of more than 10 days are selected.
Any suggestions will be appreciated.
Regards,
SukritiHi Sukriti,
Never use BSEG or MSEG directly to fetch data as they always have huge data and it takes lot of time to fetch data.
the link between BSIS and MSEG is as follows.
BSIS-BELNR = MSEG-BELNR
BSIS-GJAHR = MSEG-GJAHR
BSIS-BUZEI = MSEG-BUZEI
BSIS-BUKRS = MSEG-BUKRS
and filter in where condition based on MSEG-MATNR = materials from Select option or Parameters.
May be you can create an index with the above 4 fields and also BSIS-HKONT in BSIS table.
This would definitely give you the exact number of entries as in BSIS and MSEG.
You can notice that in MSEG the Fields are not Key fields but they will give you unique entries.
So you should be using join for BSIS and MSEG tables on the above 4 fields.
hope this will solve your problem.
If useful please dow reward
Thanks
Venugopal -
FM to get actual line items, budget and actual amounts for a given IO num.
Hello Experts,
I am currently doing a report to show the actual and budget amounts for a given internal
order number. Now, my processing takes a long time so I need to know if there are any
available FM's for this.
I am checking transactions: S_ALR_87013019 and KO03.
Hope you can help me guys.Thank you and take care!Hi Rob,
I am actually modifying my colleague's program and based on my checking, it is taking a very long time to fetch the relevant line items for a given IO(internal order) in tables BSIS and BSAS. Below is the code:
SELECT bukrs
belnr
budat
aufnr
dmbtr
shkzg
INTO TABLE it_pdate1
FROM bsis
WHERE bukrs IN s_bukrs
AND budat IN r_budat_p
AND aufnr IN s_aufnr.
SELECT bukrs
belnr
budat
aufnr
dmbtr
shkzg
APPENDING TABLE it_pdate1
FROM bsas
WHERE bukrs IN s_bukrs
AND budat IN r_budat_p
AND aufnr IN s_aufnr.
SORT it_pdate1 BY aufnr.
DELETE it_pdate1 WHERE aufnr EQ space. -
How table GLT0 work? (Different value between GLT0 and BSAS)
Anyone know about how the table GLT0 work?
After checked in sapenote sapnote 100273 which said "For an FI posting (for example, with Transaction FB01),
the balances resulting from the posting are updated twice in the G/L Account Monthly
Debits and Credits (table GLT0)."
So, Any change amount value of items in accounting doc. This problem should to update, correct?
For any change of amount value in item of accounting doc and currencies is change.
Need to reupdate this table with new currencies? or any logic
Now, I found a problem is "Account balance" value in currency group (USD) in transaction FS10
and total sum of "USD Amount" in transaction code FBL3 (If click to sum by currency)
are different for 17.79 USD.
I tried to get a logic of this 2 transaction code and found detail as below:
FS10 : Get data from table GLT0 and for group currency report. Program select data
from field KSLVT and KSLXX to display in report.
FBL3 : Get all data until selected period in table BSAS and sum total amount from field BSAS-DMBE2
(Amount of USD Currency)
Actually, This 2 report should to have the same account balance.
So, My question is
1. When the table (GLT0) update?
2. Can have a problem with the data in GLT0 (field KSLVT and KSLXX t)
and sum of amount USD curency BSAS-DMBE2 are differenct?
If can have, how is occur?
Many thank in advance.Hi,
Did you find any relationship between the data (sql data and Essbase)?
While you are loading fresh data, there is no discrepancy.
You find discrepancy at the time of incremental loading.
It might be possible in incremental loading data can be added to already existing value in dimension.
In that case you will find your Essbase data is 2times or 3 times more than base data (sql).
Then check there might be some setting.
Thanks
Dhanjit G -
Get Target table name and its count
Hi Experts,
I have created a Procedure where I want to get the Target table name and its count of the previous Interface in a Package and insert these values into the Audit table.
I am able to get the number of Inserts in previous step using getPrevStepLog() API, but I also want the Target table name and its total count of the previous Interface. Is there any generic way or code to bring these Information without hardcoding the table name. Kindly help to sort this issue.Thanks!
Warm Regards,
VBVHi VBV,
Please follow the below steps to audit ur execution.
Please note i coded in such a way that u can use ur existing procedure to capture the table name no need to query ur repository as its not advisable to query the repository as Oracle may change the structure in future which i personally feel right.
I created a Audit table with the below structure.
CREATE TABLE AUDIT_TABLE
INSERT_COUNT VARCHAR2(100 BYTE),
TABLE_NAME VARCHAR2(4000 BYTE)
Step 1 :
This step needs to be added in ur existing IKM after Commit step where i am using API to capture the target table name.
Step Name: Get Table Name
Command On Source
Technology: Oracle
Schema: Any Oracle related Schema
Command:
SELECT '<%=odiRef.getTargetTable("RES_NAME")%>' AS TGT_NAME FROM DUAL
Command On Target
Technology: Jython
Command:
TargetTable='#TGT_NAME'
Step 2:
In ur existing procedure add the below or add a new procedure.
Step Name: Audit Log
Command on Source
Technology : Oracle
Schema: Whichever schema holds the audit table
Command on Target
Technology : Jython
Command:
import java.sql as sql
import java.lang as lang
myCon =odiRef.getJDBCConnection("SRC")
MyStmt=myCon.createStatement()
myRs = MyStmt.executeQuery("INSERT INTO ODITGT.AUDIT_TABLE (INSERT_COUNT,TABLE_NAME) VALUES (<%=odiRef.getPrevStepLog("INSERT_COUNT")%>,'"+TargetTable+"')")
Thats it.
OTN doesnt allow me to put + sign in front of any word ( its assume its a Italic) so please add + (plus) sign before and after TargetTable in the above script.
This way u can capture the table name, insert count in to ur audit table.
Please note u need to call this Procedure after the successful completion of the interface in a package and make sure u selected the right IKM which capture the table name as in Step 1.
I tested in my local and its working fine. Let me know if u find any difficulties in implementation.
Thanks,
Guru -
How to get sum amount (wrbtr) from table BSIS group by gjahr hkont monat
Hello! I am new to this forum, and to ABAP. Hope my question is not obvious.
I want to get sum amount from table BSIS, group by year, period an account. Normally I will try a SQL select like this:
SELECT gjahr monat hkont sum( wrbtr ) as wrbtr INTO CORRESPONDING FIELDS OF TABLE itab FROM BSIS WHERE (itabcond) GROUP BY gjahr monat hkont .
The problem is that the amount in field wrbtr is all positive. The result gets wrong. The debet/credit indicator shkzg determines what is positive/negative. How to solve this in the most efficient way? Should I read all accounting documents into an internal table, and loop through them, changing the sign, and then make some new select, or is there a better way?
Regards Dag-Egil
Message was edited by:
Dag-Egil Bull SletholtHere are the objects in the trace list:
SKB1
USR05
TRDIR
SKA1
SKAT
SKB1
BSIS
PRPS
BSAS
V_LTDX
USR02
RFBLG
V_LTDX
LTDX
RTXTH
RTXTF
RTXTT
TRDIR
The most of this call to this tables returns 1-2 records, apart from BSIS, where it returns 10 records. This is the same as accounting documents in the transaction FBL3N. When i try this again with more records returned I still have no call to table GLT0. -
Dear Experts,
I m coding a Vendor GL report and using bsik and bsis table.
problem is when i check for a document ( say 1100000290 open document), i dont get any entry of prctr, bupla or secco in bsis and bsik tables. but when i chek same document in BSEG (which i don't want to use, because its a cluster table) , I get bupla, prctr and secco fields value.
Do i need to use some other tables also ?????????
Any suggestions.
Regards,
MaverickAfter selecting data from BSIS & BSIK you must be having the fields BUKRS, GJAHR, BELNR, BUZEI. Correct ?
These fields are key fields of BSEG. You can select data from BSEG using FOR ALL ENTRIES and in the WHERE condition pass the fields BUKRS, GJAHR, BELNR, BUZEI. I don't think selecting data based on key fields from cluster tables will give any performance issues.
Cheers,
Suhas -
Difference in amount in T code Fagll03 and Table BSIS, FAGLFLEXA
Dear Experts
There are three GL accounts which are maintained on Open item basis.
When I check the balance in T Code FAGLL03 I get some balance which matches with the trail balance. But when I check the balance at table level it does not match.
The table that I am checking is BSIS, FAGLFLEXA. I am checking these table as this table contains the data of GL open item. At the moment the table BSIS, FAGLFLEXA and T code FAGLL03 all given different figures.
Is there any other was that I should check the balance.
Your suggestion is much appreciated.
Regards
PaulHi
I was checking the document by clicking the general ledger view in FAGLL03.
I have chosen entry view and it is working.
Thanks -
Getting the original values in table maintenance and the new one and send t
Hello experts,
In table maintenance, I need to capture the original values in that selected column/field and
also the new one and send it to email. For example, I have a field in my z table named zaddress and whenever
the user changes the contents of that selected row I need to get/fecth the original value and the new and send it to email.
So the email will be something like this:
Dear Admin,
Changes were made to ztable. Here are the changes:
Customer : Customer 1
Order no : 1
Original Address : example address A
New Address : example address B
NOTE: Do not reply to this email.
Again, thank you guys and have a nice day!Hi Vijay,
<b>1</b>.
If u r using Modulepool programming to change the field contents ,u just capture field value into one variable .This is possible in <b>PBO</b>.before displaying .once u change the field value and press something ,now capture changed value in another variable .This is possible in <b>PAI</b>.After pressing something to modify Database.
I think u can get one idea after reading this .
<b>2</b>.
For sending mail it is not a problem.
You can check the following code.
*-------Mail related tables ,structures and variables
DATA:
w_subject LIKE sodocchgi1,
i_pack_list LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
i_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
i_contents_text LIKE solisti1 OCCURS 10 WITH HEADER LINE,
i_cont_bin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
i_objhex LIKE solix OCCURS 10 WITH HEADER LINE,
i_receiver LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
i_listobject LIKE abaplist OCCURS 1 WITH HEADER LINE,
pdf LIKE tline OCCURS 100 WITH HEADER LINE,
content_out LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA:
tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp,
obj_desc LIKE w_subject-obj_descr,
sent_to_all LIKE sonv-flag,
client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type,
is_otf TYPE c ,
no_of_bytes TYPE i,
pdf_spoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
pn_begda LIKE sy-datum,
val(1) TYPE c,
pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
cols TYPE pri_params-linsz,
spool_name TYPE pri_params-plist.
CLEAR :w_subject,
sent_to_all,
i_pack_list[],
i_objhead[],
i_cont_bin[],
i_contents_text[],
i_receiver[].
i_cont_bin = ' | '.
APPEND i_cont_bin.
Subject of the mail.
obj_desc = 'Outstanding Appraisals' .
w_subject-obj_name = 'MAIL_ALI'.
w_subject-obj_descr = obj_desc.
Body of the mail
DATA :head_desc LIKE i_contents_text,
body_desc LIKE i_contents_text.
i_contents_text = space.
APPEND i_contents_text.
CLEAR i_contents_text.
CONCATENATE
'Please refer to the attached list of appraisal(s) that require your'
'attention. Please log in to the eHR System and use the eAppraisal'
'function to work on it.'
INTO body_desc
SEPARATED BY space.
i_contents_text = body_desc.
APPEND i_contents_text.
CLEAR i_contents_text.
CLEAR body_desc.
i_contents_text = 'Thank You.'.
APPEND i_contents_text.
CLEAR i_contents_text.
i_contents_text = space.
APPEND i_contents_text.
CLEAR i_contents_text.
CONCATENATE '(Note: This is system generated message, please'
'do not reply'
'to this Email.)'
INTO i_contents_text
SEPARATED BY space.
APPEND i_contents_text.
CLEAR i_contents_text.
Write Packing List (Body)
DESCRIBE TABLE i_contents_text LINES tab_lines.
READ TABLE i_contents_text INDEX tab_lines.
w_subject-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
i_contents_text ).
CLEAR i_pack_list-transf_bin.
i_pack_list-head_start = 1.
i_pack_list-head_num = 0.
i_pack_list-body_start = 1.
i_pack_list-body_num = tab_lines.
i_pack_list-doc_type = 'RAW'.
APPEND i_pack_list.
CLEAR i_pack_list.
Create receiver list
i_receiver-receiver = g_email_next_man.
i_receiver-rec_type = 'U'.
APPEND i_receiver.
CLEAR i_receiver.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_subject
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
packing_list = i_pack_list
object_header = i_objhead
contents_bin = i_cont_bin
contents_txt = i_contents_text
receivers = i_receiver
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc NE 0.
ENDIF.
I think it helps u something.
<b>Thanks,
Venkat.O</b> -
Get a summary of items by a query with 2 tables (INV1 and RIN1)
Hi!
I have a question about SQL-queries.
When a customer pay an item (sum 100.- Euro), this is written in table INV1.
SELECT T0.DocEntry, T0.ObjType, T0.DocDate, T0.ItemCode, T0.Dscription, T0.LineTotal,T0.SlpCode FROM INV1 T0
show me all entries about all sold items. Thats fine!
When the same customer give back some of this sold item (sum 50.- Euro), this is written in RIN1.
SELECT T0.DocEntry, T0.ObjType, T0.DocDate, T0.ItemCode, T0.Dscription, T0.LineTotal,T0.SlpCode FROM RIN1 T0
shows me the sum of all items that get back.
For a statistc i want evaluate a sum of real sold items (sum of money).
Now, i want create a query that evaluate a sum of the table INV1 and RIN1 and want show the result.
Example for a result:
DocEntry ObjType DocDate ItemCode Descriton LineToal
1 13 01.01.06 11111 ItemOne 100.- Euro
2 14 05.01.06 11111 ItemOne - 50.- Euro
total sum: 50.- Euro
is there a way that show me this result (query, form, etc.)?
How can i realize it?
Thanks a lot!
JuergenI'm a SQLServer newbie from the Oracle world, so there may be a simpler way to do this, but the following will return all the data that you need, although it may not be pretty:
SELECT 'Detail' LineType, T0.DocEntry, T0.ObjType, T0.DocDate, T0.ItemCode, T0.Dscription, T0.LineTotal,T0.SlpCode FROM INV1 T0
union all
SELECT 'Detail' LineType, T0.DocEntry, T0.ObjType, T0.DocDate, T0.ItemCode, T0.Dscription, T0.LineTotal,T0.SlpCode FROM RIN1 T0
union all
select 'Total' LineType, null DocEntry, null ObjType, null DocDate, null ItemCode, null Dscription, sum(LineTotal) LineTotal, null SlpCode from
(SELECT T0.DocEntry, T0.ObjType, T0.DocDate, T0.ItemCode, T0.Dscription, T0.LineTotal,T0.SlpCode FROM INV1 T0
union all
SELECT T0.DocEntry, T0.ObjType, T0.DocDate, T0.ItemCode, T0.Dscription, T0.LineTotal,T0.SlpCode FROM RIN1 T0 ) x
order by 1,2
Maybe you are looking for
-
HP Help Number for Windows 7 not working
I have a problem with my Windows 7 upgrade. The instructions from HP say that in the US to call 1-888-447-0150. That number answers, there is a beep and the line is cut off. Why is the number given in the HP instructions not working?
-
1.6 Dynamic Photo Gallery
I previously used the 1.5 version to make a Photo Gallery and added the following piece of code to show captions to the photos: <div id="picture"> <div id="mainImageCaption" spry:detailregion="dsPhotos">{@caption}</div> <div id="mainImageOutline" sty
-
I cant connect to my home wifi
All of a sudden I cannot connect to my home wifi, nor home wifi at my daughters house. It finds the connection right away, but after putting in the password, I immediately get a message "unable to connect to ......" I have tried connecting to free wi
-
Topics found dialog results - unusual situation
Hi everybody, I'm having a pretty annoying situation. I'm building a HTML (.chm) help based on the imported microsoft word file. The structure of the file is something like: ==================== Header1 ..Header2 ..text text text ...Header3 ...text t
-
Connecting Xbox 360 to B540 through RF socket?
I am on a mission to connect an Xbox 360 to my B540 which does not have any inputs such as HDMI or even AV. My options seem to be using a video capture card or a RF Modulator/Adaptor (since the machine does have an aerial socket for the built-in TV