Amount getting rounded to hundreds in BSEG table
Hi,
I am passing an entry in TWD currency for 1000, but in BSEG table the field WRBTR gets updated as 10.
Any idea why this is happening so?
My conversion rate and exchange rate factors for this currency is 1:1 only
Regards
Malathi
Hi
The decimal notation is correct in su3 under default tab. For other currency my value is getting displayed with comma's and decimals.
Also the amount entered is only 1000 and not 10. For all the entries we have passed in TWD, BSEG-WRBTR is getting rounded to hundred's
Let me know on why this is happening
Regards
Malathi
Similar Messages
-
Adding Amount field in BSEG table and display it single line item?
hi experts,
I am doing credit / debit form now my requirement is
According to BELNR , GJAHR,BUKRS i want to find credit amount for this selection cretiria.
so i want to add all the lines of amount filed for a particular BELNR and display it as single line.
so i am getting data from print program like this
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 2.
PARAMETERS: p_belnr LIKE bkpf-belnr OBLIGATORY,
p_bukrs LIKE bkpf-bukrs OBLIGATORY,
p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b0.
SELECT SINGLE *
FROM bkpf
INTO i_bkpf
WHERE belnr = p_belnr
AND ( blart = 'DG' OR blart = 'ZG' )
AND bukrs = p_bukrs
AND gjahr = p_gjahr.
IF sy-subrc = 0.
SELECT *
FROM bseg
INTO table it_bseg
WHERE belnr = i_bkpf-belnr .
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_CREDIT_DEBIT' " p_name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = v_form_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION v_form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
i_bkpf = i_bkpf
i_bseg = i_bseg
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
so my I_BSEG containing all line items of particular BELNR . with the field SHKZG iam getting only credit line items .
now i want to do is add all credited amount and display like this in a table.
against ref# (BSEG-REBZG) ! details (BSEG-SGTXT)! amount
124569 10%discount 950.00(total amount ie sum of all lines amount for a BELNR)
10.00(total tax amt ie sum of all lines of tax amount for a BELNR)
960.00hi arun,
i used collect in smartform my procedure is like this .
i am getting data into i_BSEG because i declared like this in TABLES parameter
i created a loop .
in that i mentioned like I_BSEG into WA_BSEG.
then i created a program lines here i mentioned like this.
COLLECT WA_BSEG INTO IT_BSEG.
but because of BUZEI "Number of Line Item Within Accounting Document .it is not same it is varying for every credited time that means for every line of BELNR. thats why it is not adding it is just appending .
so pls tell me any other chance to find sum .
because i want to sum up all credted amount and display it in single line
ie first column REBZG "Number of the Invoice the Transaction Belongs to(against ref) i want to display once .
And Second column SGTXT "item text(details) for amount once and for tax amount once
And Third column Amount first line consists total amount & second line consists total for tax amount
regards,
satheesh.
[email protected]
any doubts chat me regarding this post. -
XREF3 field not getting populated in BSEG table while posting MIRO
Hi,
I have one query in MIRO tcode.I have activated xref3 field in MIRO tcode using enhancement LMR1MF6Q.Now when i try to post document with some values in xref3 field on screen ,value is not getting populated in BSEG table.Please tell me what else needs to be done to achieve this ?
any hint on this?
Thanks & Regards,
Soniya S.Hi,
1.- According to SAP Note 904652 - MIRO: Different from FB60
https://service.sap.com/sap/support/notes/904652
MIRO is an independent Materials Management (MM) transaction that does not
claim to be the same as the accounting transactions (such as FB60 or FB01).
MIRO was developed to allow users to process vendor invoices within the
context of the MM procurement processes as simply as possible.
For this reason, among other differences, the field selection was limited
to the absolutely necessary. For example, the following fields from the
accounting document are not available in Transaction MIRO (this list is not
complete):
Reference key (BSEG-XREF1, -XREF 2, -XREF 3)
2.- SAP Note 1156325 - BAdIs in the Logistics Invoice Verification environment
https://service.sap.com/sap/support/notes/1156325
Have a look at badi MRM_ITEM_CUSTFIELDS.
This badi will create a new tab at item level in order to display the new fields.
I haven´t used this badi so i cannot talk from experience here.
Think twice before deciding.
Best regards. -
Need code for calculation of amount field(DMBTR)of BSEG table conditionally
Hi all,
I am selecting data for fields belnr(A/c doc.), dmbtr(Amount), hkont(G/L acc) from bseg cluster table giving the particular value for hkont in the selection screen.now there are some records fetched out of which there are few records in which same A/c no.(belnr) .So my requirement is to collect those same belnr records and do following calculation:
1. suppose for some record of same belnr , if all the value for field SHKZG is 'H' then summing up the values of field DMBTR.
2. suppose for some record of same belnr , if few value for the field SHKZG is 'H' and few are 'S' then the (summation the values of field DMBTR for all 'H' in field SHKZG -summation the values of field DMBTR for all 'S') and both the case the single record will fetched with belnr, sum(DMBTR) according to the condition, and hkont. Please provide me the reqd. code for the above problem.Thanks in advance.
regards
Anand.Hi Anand,
We can do like this.
This will take into account 'S', 'H' (debit/credit indicator) and BELNR wise sum.
1. Create new internal table, STAB with only two fields. (with header line)
BELNR "<------- refer below statement
HKONT "<------ Whatever unique combination of field(s) you want, you can put here 1,2,
DMBTR "<----
Numeric field
If you want only HKONT wise SUM, then remove BELNR
2. Now write this code.
Loop at Itab.
Clear STAB.
IF ITAB-SHKZG = 'H'.
STAB-DMBTR = ITAB-DMBTR.
else.
STAB-DMBTR = - ITAB-DMBTR. "<----- Negative Sign
endif.
STAB-BELNR = ITAB-BELNR.
STAB-HKONT = ITAB-HKONT.
COLLECT STAB. "<------ Important.
Endloop
Note:
Based upon the alphanumeric fields combination (BELNR and HKONT), the sum will be done.
Similar to group by in a select query
regards,
amit m.
Edited by: Amit Mittal on Jan 22, 2010 2:14 PM -
How do i get rounded corners on a table?
How do I get rounded corners on a table in Robobhelp9 for WebHelp output?
Hi there
Personally, I'd be tempted to just use a background image to produce the rounded corners. Then overlay that with the cell data.
Just thinking out loud... Rick
Helpful and Handy Links
RoboHelp Wish Form/Bug Reporting Form
Begin learning RoboHelp HTML 7, 8 or 9 within the day!
Adobe Certified RoboHelp HTML Training
SorcerStone Blog
RoboHelp eBooks -
How to get rounding diffrence for agreement?
I am passing 3 parameters to this function
1.Agreemnt number
2.Start date
3.End date
I want to calculate Rounding difference for the each agreement.
Here Problem is, when executing this function; I am getting correct value first time.
While executing second time it thing, it shows different value as result.
Can anybody solve this?
Or give me another idea to get rounding difference instead of using this function?
FUNCTION ysdf_rebate_settlement_amount.
""Local Interface:
*" IMPORTING
*" VALUE(IV_AGREEMENT) TYPE KNUMA
*" VALUE(IV_FROM_DATE) TYPE DATUM
*" VALUE(IV_TO_DATE) TYPE DATUM
*" EXPORTING
*" REFERENCE(EV_ACCRUED_AMOUNT) TYPE KWERT
*" REFERENCE(EV_SETTLED_AMOUNT) TYPE KWERT
*" REFERENCE(EV_ACCR_REV_AMOUNT) TYPE KWERT
*" EXCEPTIONS
*" NO_AGREEMENT
*" NOT_SALES_VOL_DEPENDENT
*" OTHER_ERRORS
DATA:
lv_accrued_amt TYPE kwert,
lv_settled_amt TYPE kwert,
lv_reversal_amt TYPE kwert,
lv_kawrt TYPE kawrt,
lv_kbetr TYPE kbetr,
lv_kstbs TYPE kstbs,
lv_kwert TYPE kwert,
lv_datab TYPE datum, "Start date
lv_datbi TYPE datum, "End date
lw_kona TYPE kona,
lw_t6b1 TYPE t6b1,
lw_konp TYPE konpdb,
lw_s060 TYPE s060,
lt_konp TYPE STANDARD TABLE OF konpdb,
lt_s060 TYPE STANDARD TABLE OF s060,
lt_scales TYPE STANDARD TABLE OF condscale,
lt_xvakes TYPE STANDARD TABLE OF vakevb.
CLEAR :
ev_accrued_amount,
ev_settled_amount,
ev_accr_rev_amount.
Validate agreement number and get agreement details.
SELECT SINGLE *
INTO lw_kona
FROM kona
WHERE knuma = iv_agreement
AND abtyp = c_abtyp_a. "Rebate Agreement
IF sy-subrc NE 0.
Rebate agreement & does not exist!
MESSAGE e061(yfr2sd) WITH iv_agreement
RAISING no_agreement.
ENDIF.
SELECT SINGLE * FROM t001
WHERE bukrs = lw_kona-bukrs.
Start date = later of the requested start date
and the agreement start date.
IF iv_to_date > lw_kona-datbi.
lv_datbi = lw_kona-datbi.
ELSE.
lv_datbi = iv_to_date.
ENDIF.
End date = earlier of the requested end date
and the agreement end date.
IF iv_from_date < lw_kona-datab.
lv_datab = lw_kona-datab.
ELSE.
lv_datab = iv_from_date.
ENDIF.
Retrieve configuration data once and keep in global variables
for better performance when repeated calls are made.
IF r_kobog_excl[] IS INITIAL.
PERFORM get_global_data.
ENDIF.
Agreement must be completely dependent on sales volume.
IF lw_kona-kobog IN r_kobog_excl.
MESSAGE e062(yfr2sd) WITH iv_agreement
RAISING not_sales_vol_dependent.
ENDIF.
Get a list of condition record numbers for the given agreement
PERFORM get_condition_numbers USING lw_kona iv_from_date iv_to_date.
Read condition records and scales.
CALL FUNCTION 'SD_KONP_SELECT'
EXPORTING
scale_read = 'X'
TABLES
condition_item = lt_konp
condition_number = r_knumh
condition_scale = lt_scales.
Accrual amount calculation for all conditions.
LOOP AT lt_konp INTO lw_konp.
konp = lw_konp.
CLEAR lw_s060.
Determine the turnover for rebate
CALL FUNCTION 'SD_BONUS_TURN_OVER'
EXPORTING
agreement_waers = lw_kona-waers
condition_krech = lw_konp-krech
condition_item = lw_konp-kopos
condition_number = lw_konp-knumh
period_datab = lv_datab
period_datbi = lv_datbi
agreement_knuma = lw_kona-knuma
IMPORTING
turn_over = lw_s060.
Errors?
IF NOT lw_s060 IS INITIAL AND
lw_s060-krech IS INITIAL.
MESSAGE e779(vk) RAISING other_errors.
ENDIF.
If condition is active (not logically deleted).
IF lw_konp-loevm_ko = space.
record found?
IF lw_s060-knumh IS INITIAL.
lv_kstbs = 0.
lv_kawrt = 0.
ELSE.
lv_kawrt = lw_s060-kawrt_k.
lv_kstbs = lw_s060-kstbs.
ENDIF.
IF lw_konp-stfkz = 'D'.
Tiered scales calculation
CALL FUNCTION 'SD_GRADUATED_SCALE_EVALUATION'
EXPORTING
i_arrangement = lw_kona
i_condition_record = konp
i_scale_base = lv_kstbs
i_condition_base = lv_kawrt
i_bukrs = lw_kona-bukrs
i_currency_date = lv_datbi
i_value_rounding = c_yes
i_t001 = t001
IMPORTING
e_arrang_value = lv_kwert
TABLES
t_condition_scale = lt_scales
EXCEPTIONS
error_message = 1.
ELSE.
Determine condition rate (non-tiered calculation)
CALL FUNCTION 'SD_BONUS_RATE_FROM_SCALE'
EXPORTING
condition_record = konp
scale_base = lv_kstbs
IMPORTING
bonus_rate = lv_kbetr
TABLES
condition_scale = lt_scales.
Determine rebate amount for the condition
CALL FUNCTION 'SD_BONUS_VALUE_CALCULATION'
EXPORTING
calculation_rule = lw_konp-krech
condition_base = lv_kawrt
condition_type = lw_konp-kschl
currency = lw_kona-waers
currency_date = lw_kona-datbi
price_currency = lw_konp-konwa
price_unit = lw_konp-kpein
price_uom = lw_konp-kmein
cumul_currency = lw_konp-kwaeh
rate = lv_kbetr
sales_organization = lw_kona-vkorg
IMPORTING
bonus_value = lv_kwert
EXCEPTIONS
error_message = 01.
ENDIF.
IF sy-subrc <> 0.
Error?
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING other_errors.
ENDIF.
Percentage?
lv_accrued_amt = lv_accrued_amt + lv_kwert.
clear lv_kwert.
IF lw_s060-krech NE c_krech_a.
lv_reversal_amt = lv_reversal_amt + lw_s060-rrwrt.
ENDIF.
ELSE.
Clear the values
CLEAR: lv_kawrt, lv_kstbs, lv_kwert, lv_kbetr.
ENDIF.
ENDLOOP.
SELECT SUM( vbap~netwr )
INTO lv_settled_amt
FROM vbak
INNER JOIN vbap
ON vbapvbeln EQ vbakvbeln
INNER JOIN vbkd
ON vbkdvbeln EQ vbakvbeln
WHERE vbak~knuma = lw_kona-knuma
AND vbak~auart IN (c_auart_b1,c_auart_b3)
AND vbap~abgru EQ space
AND vbkd~fbuda BETWEEN iv_from_date
AND iv_to_date
ev_accrued_amount = - lv_accrued_amt.
ev_settled_amount = lv_settled_amt.
ev_accr_rev_amount = lv_reversal_amt.
ENDFUNCTION.
Regards,
RonnCan you provide more details that's a very vague question. You research industry vendors such as MobileIron, Zenprise, AirWatch, BoxTone, etc. or configure your own server and push configuration profiles. Apple themselves do not offer any services of their own that they resell.
-
Dear All
i have sales order number from that i am able to get the billing document number from VBFA table.
i am passing input to the BSEG table billing documnet number and customer number and to get the Advance payment
and also the Actual payment so is it suffiicient to read the BSEG Table.
and make clear how can i get the Outstanding amount related to that salesorder. i mean hear i want to get it from table with out doing manual calculation.
and also guide me BSEG is Cluster table if i use selct statement na it is database cost so any function modules available for read it
please guide me.
thanks ........................Hi,
Try with function AC_DOCUMENT_RECODS
CALL FUNCTION 'AC_DOCUMENT_RECORD'
EXPORTING
i_awtyp = 'MKPF'
i_awref = awref
i_aworg = aworg
i_awsys = awsys
i_awtyp_incl = 'BKPF'
i_valutyp = '0'
x_dialog = ' '
TABLES
t_documents = docs_fi
EXCEPTIONS
no_reference = 1
no_document = 2
OTHERS = 3.
where
DATA: docs_fi LIKE acc_doc OCCURS 10 WITH HEADER LINE.
and
DATA: awref LIKE acchd-awref,
aworg LIKE acchd-aworg,
awsys LIKE acchd-awsys.
I hope this helps you
Regards
Eduardo
PD: I think that I havent read properly your post.
Surely you must work with tables BSID and BSAD, better that with BSEG. Remember that one is open items. Surely the document from the first funcion was cleared. So, you must rebuild the flow of documents.
Edited by: E_Hinojosa on Nov 11, 2010 9:37 AM -
Error while activating the BSEG table
hi guys ,
today i joined SAP SCN . I have this error
First i appended a structure of 5 fields in BSEG table .Then i tried to delete this append structure.
But while deletiing it took nearly 20-25 minutes to process and timed out.So the structure is deleted
from BSEG table but those 5 fields are still present in view V_QCMBSEG .Because of this BSEG table
is now partially active .what should i do other than access key .Dear Deepak,
welcome to SCN.
How did you append structure in BSEG without access key, if you had appended you must have done it will access key as it is a standard table.
secondly, the time out error is because BSEG is a cluster table, and the data volume in Bseg is very large as all the accounting document from various module is stored in this table, hence while deleting it system will check each line item wise before activating the table.
Now the workaround is to check with your basis team to increase the memory index so that time out dump is eradicted and BSG becomes Active.
Best practice: Don't append structure to standard table unless it is very crucial. if you are doing it for some report, kindly do a table join ( BSEG cannot be used as it is a cluster), you will get the same data in various secondary index table, by doing this the performance of the report will be better.
Regards,
M S Lokesh -
PO Line Item Number not filled in BSEG Table
HI,
While posting to goods receipt through MIGO FI documents are generated.
For these FI documents , in BSEG table the corresponding PO line item numbers (EBELP )are not getting filled up,
How can they be filled. can it be done through any standard configuration?Hi,
Check if you are doing the summarization of FI doc. You can check reading these notes:
SAP Note 36353 - AC interface: Summarizing FI documents
SAP Note 77161 - Summarization of FI postings w.ref.to purchase orders
I hope this helps you
Regards
Eduardo -
FBL5N t code and BSEG table is showing wrong contract number
Hi,
The proces flow is contract number>sales order>DMR-->Invoice
Now when I am checking the VBFA table it's showing correct contract number against invoices but FBL5N t code and BSEG table are showing wrong contract numbers.
Why FBL5N and BSEG table is showing wrong contract number?
Currently we are using one enhancement and user exit is used to incorporate one customized field as identifier for bill type.
1. During the billing document release to accounting VFX3, The user exit triggering and it is update the customized fields and Net settlement indicator.
2. Using the Invoice number, get the fields VGBEL(Document number of the reference document) and VGPOS (Item number of the reference item) from VBRP and read table VBAP with VBELN and POSNR, to get DMR number (Sales Document) that created for the Invoice.
3. Use fields VGBEL and VGPOS on table VBAP to get the sale order number.
4. By using the Sales order number, get the Distribution channel to update Net indicator field
In accounting table BSEG-UZAWE = JF must be updated on the customer line.
5. Retrieve the sale order number and item level to get customized field from table VBAP
Any pointers.
Thanks
AshuHi Reazuddin,
Thanks for your reply,
I am concercerned about BSEG table and using user exit EXIT_SAPLV60B_008 to post the document in FI.
Now in we have enhanced this user exit for contracts and included in this way.
SELECT SINGLE ZZ_CONTRACT FROM VBAK INTO (LC_CONTRACT) WHERE VBELN EQ cvbrp-vgbel.
Endloop.
*Moving the values to final accounting table
loop at xaccit.
xaccit-vertn = lc_contract.
xaccit-VBEL2 = xaccit-AUBEL.
xaccit-xref3 = lc_vbel2.
MODIFY xaccit .
ENDLOOP.
Clear: lc_contract,lc_vgbel,lc_vgpos,lc_vbel2.
But I am getting correct data when checked other clients( development and quality), this problem I am getting in production.
Do I need to ask the ABAP'er to debug this enhancement in production?
Thanks
Ashutosh -
Hi,
How to update PERNR Field BSEG Table?
My scenario is to update the (Personnel Number ) PERNR Field in FB50 Transaction.
I get the following fields details from a third party system
Document Information
o I_BUKRS (Company Code) u2013 example: 0010
o I_BELNR (Document Number) u2013 example: 1700006041
o I_GJAHR (Fiscal Year) u2013 example: 2008
u2022 Final Approver ID
o I_PERNR (Personnel No.) u2013 example U0050049
For all line items of the document (represented by the key (I_BUKRS, I_BELNR, I_GJAHR)) need to update the BSEG-PERNR field in FB50.
Please let me know if you have any ideas like BAPI's or any alternative.
Thanks & Regards,
SatyaHi
Try to use below the FM's
FMUDBSEGH_UPDATE
FMUDBSEG_UPDATE
G_BKPF_BSEG_UPDATE
before to that you need to read data from FM READ_BSEG. then update.
hope it helps you
Thanks!
Edited by: Prasanth Maddela on Apr 21, 2009 6:26 PM -
Hi,
Below is my code, it taking much time to get the data from BSEG table and even after executing for long time it not populating the data into internal table. If i pass single account in selection screen, it is displaying the data.
Please help me out.
SELECT hkont lkorr FROM t030hb INTO CORRESPONDING FIELDS OF
TABLE gt_tr_t030hb
WHERE ktopl = 'ZCOA'
AND bwber = 'TR'
and hkont in so_hkont.
IF gp_pprct IS INITIAL.
loop at gt_tr_t030hb.
SELECT hkont prctr bewar dmbe2 FROM bseg INTO CORRESPONDING
FIELDS OF table gt_hkont for all entries
in gt_tr_t030hb
WHERE bukrs IN so_bukrs
AND prctr IN so_prctr
AND saknr = gt_tr_t030hb-hkont
AND vbund IN so_vbund
and gjahr in so_gjahr
and xauto = 'X'.
Thanks,
Pavan.
Message was edited by: Pavan PanduruHi
Try to select the items from BSIS/BSAS:
- One solution can be:
TABLES: BSIS.
DATA: GT_TR_T030HB LIKE STANDARD TABLE OF T030HB.
SELECT-OPTIONS: SO_BUKRS FOR BSIS-BUKRS,
SO_HKONT FOR BSIS-HKONT,
SO_GJAHR FOR BSIS-GJAHR,
SO_PRCTR FOR BSIS-PRCTR,
SO_VBUND FOR BSIS-VBUND.
DATA: BEGIN OF GT_HKONT OCCURS 0,
BUKRS LIKE BSIS-BUKRS,
HKONT LIKE BSIS-HKONT,
GJAHR LIKE BSIS-GJAHR,
BELNR LIKE BSIS-BELNR,
BUZEI LIKE BSIS-BUZEI,
PRCTR LIKE BSIS-PRCTR,
BEWAR LIKE BSIS-BEWAR,
DMBE2 LIKE BSIS-DMBE2,
END OF GT_HKONT.
DATA: XAUTO.
SELECT * FROM T030HB INTO TABLE GT_TR_T030HB
WHERE HKONT IN SO_HKONT
Open Items (BSIS)
SELECT BUKRS HKONT GJAHR BELNR BUZEI
PRCTR BEWAR DMBE2
FROM BSIS INTO TABLE GT_HKONT
FOR ALL ENTRIES IN GT_TR_T030HB
WHERE BUKRS IN SO_BUKRS
AND HKONT = GT_TR_T030HB-HKONT
AND GJAHR IN SO_GJAHR
AND PRCTR IN SO_PRCTR
AND VBUND IN SO_VBUND.
Cleared items
SELECT BUKRS HKONT GJAHR BELNR BUZEI
PRCTR BEWAR DMBE2
FROM BSAS APPENDING TABLE GT_HKONT
FOR ALL ENTRIES IN GT_TR_T030HB
WHERE BUKRS IN SO_BUKRS
AND HKONT = GT_TR_T030HB-HKONT
AND GJAHR IN SO_GJAHR
AND PRCTR IN SO_PRCTR
AND VBUND IN SO_VBUND.
If you need to check if the item is automatically loaded:
LOOP AT GT_HKONT.
SELECT SINGLE XAUTO FROM BSEG INTO XAUTO
WHERE BUKRS = GT_HKONT-BUKRS
AND BELNR = GT_HKONT-BELNR
AND GJAHR = GT_HKONT-GJAHR
AND BUZEI = GT_HKONT-BUZEI.
IF XAUTO = SPACE.
DELETE GT_HKONT.
ENDIF.
ENDLOOP.
Other solution can be
TABLES: BSIS.
DATA: GT_TR_T030HB LIKE STANDARD TABLE OF T030HB.
SELECT-OPTIONS: SO_BUKRS FOR BSIS-BUKRS,
SO_HKONT FOR BSIS-HKONT,
SO_GJAHR FOR BSIS-GJAHR,
SO_PRCTR FOR BSIS-PRCTR,
SO_VBUND FOR BSIS-VBUND.
DATA: BEGIN OF T_DOCUMENT OCCURS 0,
BUKRS LIKE BSIS-BUKRS,
GJAHR LIKE BSIS-GJAHR,
BELNR LIKE BSIS-BELNR,
BUZEI LIKE BSIS-BUZEI,
END OF T_DOCUMENT.
DATA: BEGIN OF GT_HKONT OCCURS 0,
HKONT LIKE BSIS-HKONT,
PRCTR LIKE BSIS-PRCTR,
BEWAR LIKE BSIS-BEWAR,
DMBE2 LIKE BSIS-DMBE2,
END OF GT_HKONT.
DATA: XAUTO.
Open Items (BSIS)
SELECT BUKRS GJAHR BELNR BUZEI
FROM BSIS INTO TABLE T_DOCUMENT
FOR ALL ENTRIES IN GT_TR_T030HB
WHERE BUKRS IN SO_BUKRS
AND HKONT = GT_TR_T030HB-HKONT
AND GJAHR IN SO_GJAHR
AND PRCTR IN SO_PRCTR
AND VBUND IN SO_VBUND.
Cleared items
SELECT BUKRS GJAHR BELNR BUZEI
FROM BSAS INTO TABLE T_DOCUMENT
FOR ALL ENTRIES IN GT_TR_T030HB
WHERE BUKRS IN SO_BUKRS
AND HKONT = GT_TR_T030HB-HKONT
AND GJAHR IN SO_GJAHR
AND PRCTR IN SO_PRCTR
AND VBUND IN SO_VBUND.
Auto items
SELECT HKONT PRCTR BEWAR DMBE2
FROM BSEG INTO TABLE GT_HKONT
FOR ALL ENTRIES IN T_DOCUMENT
WHERE BUKRS = T_DOCUMENT-BUKRS
AND BELNR = T_DOCUMENT-BELNR
AND GJAHR = T_DOCUMENT-GJAHR
AND BUZEI = T_DOCUMENT-BUZEI
AND XAUTO = 'X'.
Try
Max -
Select statement using BSEG table
Hello SAPinas,
I am using the following lines of code in one of my program. Becuase of that code I am getting Performance issue.
Note : BSEG is Cluster Table.
Could you please help me how I will use in another way
loop at t_hdr.
select buzei buzid koart shkzg mwskz dmbtr hwbas sgtxt vbund kostl
aufnr anln1 anln2 hkont kunnr lifnr matnr werks ebeln ebelp
zekkn rewrt prctr txjcd projk
into (t_item-buzei, t_item-buzid, t_item-koart, t_item-shkzg,
t_item-mwskz, t_item-dmbtr, t_item-hwbas, t_item-sgtxt,
t_item-vbund, t_item-kostl, t_item-aufnr, t_item-anln1,
t_item-anln2, t_item-hkont, t_item-kunnr, t_item-lifnr,
t_item-matnr, t_item-werks, t_item-ebeln, t_item-ebelp,
t_item-zekkn, t_item-rewrt, t_item-prctr, t_item-txjcd,
t_item-projk)
from bseg
where bukrs = t_hdr-bukrs
and belnr = t_hdr-belnr
and gjahr = t_hdr-gjahr
and hkont in s_hkont
and mwskz in s_mwskz
and kostl in s_kostl
and prctr in s_prctr
and werks in s_werks.
Skip record if not in selection screen range for state
check t_item-txjcd(2) in s_state.
if t_item-shkzg = c_debit. "S
endif.
if t_item-shkzg = c_credit. "H
t_item-dmbtr = t_item-dmbtr * ( -1 ).
t_item-rewrt = t_item-rewrt * ( -1 ).
t_item-hwbas = t_item-hwbas * ( -1 ).
endif.
**&MWB 04/08/2005 ... add additional US Bayer Tax dept requested fields
clear: t_item-basetax, t_item-accrtax, t_item-vendtax,
t_item-taxrate, t_item-invbase, t_item-invtax.
**&MWB ... end insert 04/08/2005
clear t_item-hwbas.
move-corresponding t_hdr to t_item.
append t_item.
clear t_item.
endselect.
endloop.
Thank you very much Advance.............:-)As BSEG is in a cluster table RFBLG, the only index available is the primary one, so only BUKRS, BELNR and GJAHR keys are actually available. So for other criteria resolution, the program will read the whole cluster, unpacking the records and executing the selection. When most criteria come from BKPF header, you may select from BKPF and then from BSEG using the full key of the cluster, and using a [FOR ALL ENTRIES|http://help.sap.com/abapdocu/en/ABENOPEN_SQL_PERFO.htm] IN a table with the keys from BKPF.
Try to use one or more of the secondary indexes provide by SAP
- BSAD Accounting: Secondary Index for Customers (Cleared Items)
- BSAK Accounting: Secondary Index for Vendors (Cleared Items)
- BSAS Accounting: Secondary Index for G/L Accounts (Cleared Items)
- BSID Accounting: Secondary Index for Customers
- BSIK Accounting: Secondary Index for Vendors
- BSIM Secondary Index, Documents for Material
- BSIS Accounting: Secondary Index for G/L Accounts
These indexes are actual tables, so you may create/use indexes, they are also easily appended, as they are filled via move-corresponding statements.
Try a little search at sdn on keywords like [BSEG, cluster and performance|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bsegclusterperformance&adv=false&sortby=cm_rnd_rankvalue].
Regards -
Dear all,
Can anyone plz tell me when does KUNNR of 2nd line item of a particular document number (BELNR) get updated.Anywas,can the KUNNR from 1st line item be moved to the 2nd line item of that BELNR.
What will I have to do for this?.Basically i will have to modify BSEG table.But as many tables will be logically connected,how can this be done?
Edited by: Rahul Bhat on Jan 28, 2008 10:09 AMHi,
The KUNNR does not get updated for 2nd and subsequent line items of an accounting document no.
The reason being, in an accounting doc, since the 1st line is a debit entry it always belong to the customer code. Hence fo any acc. doc, the KUNNR will be available for 1st line item. Whereas the subsequent line items are credit items and will get recorded against a G/L account and not against a customer code.
This is designed as per std SAP. Also FYI, since BSEG is a cluster table and any changes to an acc. doc gets recorded in this table, its not advisable to change this std SAP table. It will lead to data in consistency in your system and lead to accounting errors during reporting.
Regards,
JLN -
hi ,
why sap stored BSEG table as cluster table ,
is there any specific reason .
plz tell me if any body knows ,
thanks in advance ,
regards ,
srinivashii
see this article
http://blogs.ittoolbox.com/sap/db2/archives/select-from-bsegrfblg-performance-problem-14247
read last paragraph.i hope you will get your answer
thx
twinkal
Maybe you are looking for
-
MacBook Pro audio not working. Help?
I bought a MacBook Pro this summer and just last week the audio out stopped working. I tried resetting PRAM and have all the latest updates. All the sound control panel settings are correct, it's not muted. Any suggestions would be greatly appreciate
-
Itunes not syncing with ipod touch
hey guys need help here i just reformated my laptop and also decided to upgrade ipod touch firmware to 4.3.5 now i plug into itunes, itunes recognise my ipod touch but it wont sync the songs no matter hw many times i clicked on the word 'Sync' i upda
-
Newbie help with editing files in DW CS3
I am new to using Dreamweaver, and I am having trouble with trying to edit existing files using DW CS3. When I open an existing file on my local site, DW converts some of the code using &. This is a problem because I need to edit the file just as it
-
ISR_PROCESS_EVENT assert fails
I'm trying to call ISR_PROCESS_EVENT as an RFC, passing in the data for a form, and trying to validate the fields. To do this i first call ISR_PROCESS_EVENT with mode "CREATE" and get back the fields I need. So far so good. Later, I call the same R
-
I recently upgraded my iphone to ios 6.0 sicne then I cannot see new music to load from my PC to my iphone 4. The music is in the cloud and plays on my PC but not my iphone.