11-07-2007 3:01 AM
Hello Experts,
I am getting records from BSIS and BSAS, now I need to know those records(from BSIS and BSAS)
which are for customers or for vendors since that is my filter. Thank you and take care!
11-07-2007 3:19 AM
BSIS and BSAS are for GL entries, not customers or vendors. You would have to read the BSIS/BSAS entries and using the document number, retrieve the corresponding line items from BSEG. They may be for customers, vendors, GLs or any combination.
Rob
11-07-2007 3:03 AM
Hi,
You have different tables for them
BSIK/BSAK - Vendor
BSID/BSAD - Customer.
Regards,
Atish
11-07-2007 3:06 AM
11-07-2007 3:07 AM
11-07-2007 3:19 AM
BSIS and BSAS are for GL entries, not customers or vendors. You would have to read the BSIS/BSAS entries and using the document number, retrieve the corresponding line items from BSEG. They may be for customers, vendors, GLs or any combination.
Rob
11-07-2007 3:26 AM
Hi Guys,
Sorry I can't see my radiobuttons so I can't assign points but I will do so later.
Anyway, What I did was based from the records that I got from BSIS/BSAS, I did
a select statement from BSID and BSAD. Please see my code below:
* Get G/L line items(Open items)
SELECT bukrs hkont belnr
buzei gjahr budat
blart dmbtr shkzg
FROM bsis
INTO TABLE gt_bsis
FOR ALL ENTRIES IN gt_t012k
WHERE bukrs = gt_t012k-bukrs
AND hkont IN lr_hkont
AND budat <= p_budat.
* Get G/L line items(Cleared items)
SELECT bukrs hkont belnr
buzei gjahr budat
blart dmbtr shkzg
FROM bsas
INTO TABLE gt_bsas
FOR ALL ENTRIES IN gt_t012k
WHERE bukrs = gt_t012k-bukrs
AND hkont IN lr_hkont
AND budat <= p_budat.
APPEND LINES OF gt_bsis TO gt_bsis_bsas.
APPEND LINES OF gt_bsas TO gt_bsis_bsas.
IF NOT gt_bsis_bsas[] IS INITIAL.
* Get customer line items(Open items)
SELECT bukrs belnr gjahr blart
buzei budat dmbtr shkzg
FROM bsid
INTO TABLE gt_bsid_bsad
FOR ALL ENTRIES IN gt_bsis_bsas
WHERE bukrs = gt_bsis_bsas-bukrs
AND gjahr = gt_bsis_bsas-gjahr
AND belnr = gt_bsis_bsas-belnr.
* Get customer line items(Cleared items)
SELECT bukrs belnr gjahr blart
buzei budat dmbtr shkzg
FROM bsad
APPENDING TABLE gt_bsid_bsad
FOR ALL ENTRIES IN gt_bsis_bsas
WHERE bukrs = gt_bsis_bsas-bukrs
AND gjahr = gt_bsis_bsas-gjahr
AND belnr = gt_bsis_bsas-belnr.
ENDIF.
Then later on, I will loop through GT_BSIS_BSAS then I will check the current document
if it exists in GT_BSID_BSAD by using READ statement. Is this correct? Thank you guys!
11-07-2007 3:45 AM
Hi,
I think you confused yourself with the secondary index tables.
BSIS/BSAS for G/L line items not for customers/vendors.
So the record will always be different in those tables.
BSEG is the one which store all the conbined data.
Regards,
Atish
11-07-2007 2:50 PM
No - not yet. You shouldn't use the secondary index tables bsid and bsad unless you know the customer numbers. You don't know that here, but you do know the document numbers. So try:
* Get G/L line items(Open items)
SELECT bukrs hkont belnr
buzei gjahr budat
blart dmbtr shkzg
FROM bsis
INTO TABLE gt_bsis
FOR ALL ENTRIES IN gt_t012k
WHERE bukrs = gt_t012k-bukrs
AND hkont IN lr_hkont
AND budat <= p_budat.
* Get G/L line items(Cleared items)
SELECT bukrs hkont belnr
buzei gjahr budat
blart dmbtr shkzg
FROM bsas
INTO TABLE gt_bsas
FOR ALL ENTRIES IN gt_t012k
WHERE bukrs = gt_t012k-bukrs
AND hkont IN lr_hkont
AND budat <= p_budat.
APPEND LINES OF gt_bsis TO gt_bsis_bsas.
APPEND LINES OF gt_bsas TO gt_bsis_bsas.
IF NOT gt_bsis_bsas[] IS INITIAL.
* get customer line items
SELECT bukrs belnr gjahr "<===== Changes
buzei dmbtr shkzg kunnr
FROM bseg
INTO TABLE gt_bsid_bsad
FOR ALL ENTRIES IN gt_bsis_bsas
WHERE bukrs = gt_bsis_bsas-bukrs
AND gjahr = gt_bsis_bsas-gjahr
AND belnr = gt_bsis_bsas-belnr
AND kunnr <> space.
* Get BLART and BUDAT from BKPF
ENDIF.
Rob
11-07-2007 4:13 AM
Hi,
Table BSIK (open items) & BSAK (closed items).
Best regards,
Prashant