Skip to Content

Picking open items and cleared items from BSID and BSAD

Hi

I have to pick the open items and cleared items from BSID and BSAD.

But the case is for the month of september. I.e the items that are open on 30 september 2013 according to FBL5n

But those items are cleared by the user but they are open at that date. how are they picked and displayed in fbl5n.

Regards

Nikhil Jain

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Dec 09, 2013 at 10:34 AM

    Hii Nikhil,

    The following query will work : -

    Suppose your open item date in selection screen is p_date and internal table it it_data.

    select * from bsid

    appending corresponding fields to table it_data

    where budat <= p_date.

    select * from bsad

    appending corresponding fields to table it_data

    where augdt > p_date and

    budat <= p_date.

    Regards,

    Haresh Manani.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2013 at 08:59 AM

    Hi Nikhil,

    I faced the same problem few days back.

    Try below BAPI it will surely help you.

    CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
    EXPORTING
    COMPANYCODE = PA_BUKRS
    CUSTOMER = PA_KUN
    KEYDATE = D1
    NOTEDITEMS = 'X'
    * SECINDEX = ' '
    * IMPORTING
    * RETURN =
    TABLES
    LINEITEMS = LT_ITMES.

    PA_BUKRS = company code

    PA_KUN = customer

    date = date for which you want to fetch the open line item

    if you to select the the line item for range of date eg : 01.04.2013 to 30.04.2013

    then use below code :

    WHILE D1 LE D2.
    CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
    EXPORTING
    COMPANYCODE = PA_BUKRS
    CUSTOMER = PA_KUN
    KEYDATE = D1
    NOTEDITEMS = 'X'
    * SECINDEX = ' '
    * IMPORTING
    * RETURN =
    TABLES
    LINEITEMS = LT_ITMES.

    DELETE LT_ITMES WHERE PSTNG_DATE NE D1.
    APPEND LINES OF LT_ITMES TO LT_ITMES1.
    D1 = D1 + 1.
    ENDWHILE.

    LOOP AT LT_ITMES1 INTO WA_ITMES.

    MOVE WA_ITMES-CLEAR_DATE TO WA_BSID-AUGDT.
    IF WA_BSID-AUGDT = '00000000'.
    MOVE WA_ITMES-COMP_CODE TO WA_BSID-BUKRS.
    MOVE WA_ITMES-FISC_YEAR TO WA_BSID-GJAHR.
    MOVE WA_ITMES-REF_DOC_NO TO WA_BSID-XBLNR.
    MOVE WA_ITMES-ALLOC_NMBR TO WA_BSID-ZUONR.
    MOVE WA_ITMES-DOC_NO TO WA_BSID-BELNR.
    MOVE WA_ITMES-DOC_TYPE TO WA_BSID-BLART.
    MOVE WA_ITMES-DOC_DATE TO WA_BSID-BLDAT.
    MOVE WA_ITMES-PSTNG_DATE TO WA_BSID-BUDAT.
    MOVE WA_ITMES-CLR_DOC_NO TO WA_BSID-AUGBL.
    MOVE WA_ITMES-ITEM_TEXT TO WA_BSID-SGTXT.
    MOVE WA_ITMES-ENTRY_DATE TO WA_BSID-CPUDT.
    MOVE WA_ITMES-SP_GL_IND TO WA_BSID-UMSKZ.
    * MOVE WA_ITMES-SP_GL_IND TO WA_BSID-HKONT.
    MOVE WA_ITMES-CUSTOMER TO WA_BSID-KUNNR.
    MOVE WA_ITMES-DB_CR_IND TO WA_BSID-SHKZG.
    MOVE WA_ITMES-ITEM_NUM TO WA_BSID-BUZEI.
    MOVE WA_ITMES-PMNTTRMS TO WA_BSID-ZTERM.
    MOVE WA_ITMES-LC_AMOUNT TO WA_BSID-DMBTR.
    MOVE WA_ITMES-DOC_STATUS TO WA_BSID-BSTAT.
    APPEND WA_BSID TO IT_BSID1.
    ENDIF.

    IF WA_BSID-AUGDT NE '00000000'.
    IF WA_BSID-AUGDT > D2.
    MOVE WA_ITMES-COMP_CODE TO WA_BSID-BUKRS.
    MOVE WA_ITMES-FISC_YEAR TO WA_BSID-GJAHR.
    MOVE WA_ITMES-REF_DOC_NO TO WA_BSID-XBLNR.
    MOVE WA_ITMES-ALLOC_NMBR TO WA_BSID-ZUONR.
    MOVE WA_ITMES-DOC_NO TO WA_BSID-BELNR.
    MOVE WA_ITMES-DOC_TYPE TO WA_BSID-BLART.
    MOVE WA_ITMES-DOC_DATE TO WA_BSID-BLDAT.
    MOVE WA_ITMES-PSTNG_DATE TO WA_BSID-BUDAT.
    MOVE WA_ITMES-CLR_DOC_NO TO WA_BSID-AUGBL.
    MOVE WA_ITMES-ITEM_TEXT TO WA_BSID-SGTXT.
    MOVE WA_ITMES-ENTRY_DATE TO WA_BSID-CPUDT.
    MOVE WA_ITMES-SP_GL_IND TO WA_BSID-UMSKZ.
    * MOVE WA_ITMES-SP_GL_IND TO WA_BSID-HKONT.
    MOVE WA_ITMES-CUSTOMER TO WA_BSID-KUNNR.
    MOVE WA_ITMES-DB_CR_IND TO WA_BSID-SHKZG.
    MOVE WA_ITMES-ITEM_NUM TO WA_BSID-BUZEI.
    MOVE WA_ITMES-PMNTTRMS TO WA_BSID-ZTERM.
    MOVE WA_ITMES-LC_AMOUNT TO WA_BSID-DMBTR.
    MOVE WA_ITMES-DOC_STATUS TO WA_BSID-BSTAT.
    APPEND WA_BSID TO IT_BSID1.
    ENDIF.
    ENDIF.

    CLEAR WA_BSID.
    CLEAR WA_ITMES.
    ENDLOOP.


    here d1 = 01.04.2013

    d2 = 30.04.2013


    Hope it helps.


    Thanks


    Harsh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2013 at 08:23 AM

    Hi Nikhil

    The BSID table store all uncleared items

    The BSAD table contains all Cleared Items.

    there is field AUGDT - stores teh Clearing Date.

    The Report FBL5N - baed on the clearing date you choose, it displays.

    Regards,

    Venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2013 at 10:14 AM

    Hi Nikhil,

    Based on Clearing Date and Fiscal Year BSID-AUGDT BSID-GJAHR You can fetch it .

    Regards,

    Hiriyappa

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.