Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to know if records in BSIS/BSAS are for customers or vendors?

aris_hidalgo
Contributor
0 Kudos

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!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

8 REPLIES 8

Former Member
0 Kudos

Hi,

You have different tables for them

BSIK/BSAK - Vendor

BSID/BSAD - Customer.

Regards,

Atish

gopi_narendra
Active Contributor
0 Kudos

Check the tables BSID, BSAD as well.

Regards

Gopi

Former Member
0 Kudos

Reward points...

Former Member
0 Kudos

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

0 Kudos

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!

0 Kudos

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

0 Kudos

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

former_member223537
Active Contributor
0 Kudos

Hi,

Table BSIK (open items) & BSAK (closed items).

Best regards,

Prashant