cancel
Showing results for 
Search instead for 
Did you mean: 

Get the original clearing document type

Former Member
0 Kudos

HI,

What i want to achieve here is to get the original payment method for a clearing document type by coding them in a program.

For example:-

I have an invoice 1100923421 that has the document type RV and what I need to see it to tells me is that the RV (Invoice) has been cleared by a Bacs Payment (ZB) / Cheque Payment (ZQ).

I created a table type rfposxext and has all the value collected into that table. But with all that information, how can i achieve what I want?

Any feedback / advise are highly appreciated.

Thanks,

Loo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey Loo,

I hope I'm understanding your question. Have you tried looking at table BSAD? That would give you the RV number (doc type) and if it has been cleared, that number would be stored in this table. Once you have that clearing number, you can get its doc type by using table BSID.

Cindy

Former Member
0 Kudos

Hi Cindy,

Thanks Cindy. Unfortunately, when i checked the table BSID for the particular document that has been cleared, there's no result stored in table BSID.

Hi everyone,

I'm closing this thread as it seems that there's no direct way of getting the original document type for RV.

Thanks.

Cheers,

loo

0 Kudos

Hi ~loObie

When customer items are first created (open item), it will be in BSID. But once it is paid (or cleared items), the items will be 'move' from BSID into BSAD -- you should look into BSAD instead.

hope it helps.

Regards

CH

dominic_holdstock
Active Contributor
0 Kudos

Hi,

You would have to add code to select the doc.type of the clearing document.

eg Select single BLART from BKPF into NEWFIELD

where

BUDAT = BSAD-AUGDT

BELNR = BSAD-AUGBL

BUKRS = BSAD-BUKRS .

Kind regards

Former Member
0 Kudos

Hi Guys,

Thank you for the reply and I managed to resolve them myself as i found out that there's no direct way to get the original document type for each RV. What i did was to loop at table BSAD for each RV, and get the document type for the clearing document and putting that document type as the original clearing document.

The following is the piece of code that I've done and i hope it will help others as well.


...
  TYPES: BEGIN OF ty_zzaugblart,
          belnr      TYPE belnr_d,  
          blart      TYPE blart,  
         END OF ty_zzaugblart.

  DATA: ls_zzaugblart TYPE ty_zzaugblart.
  DATA: lt_zzaugblart TYPE STANDARD TABLE OF ty_zzaugblart.

  IF wa_pos-augbl IS NOT INITIAL.
    SELECT SINGLE blart FROM bkpf INTO wa_pos-zzaugblart
                       WHERE bukrs EQ wa_pos-bukrs
                         AND belnr EQ wa_pos-augbl
                         AND gjahr EQ wa_pos-auggj.

    IF wa_pos-zzaugblart = 'AB'.
      REFRESH : lt_zzaugblart.
      SELECT belnr blart FROM bsad INTO TABLE lt_zzaugblart
                  WHERE kunnr EQ wa_pos-konto
                    AND bukrs EQ wa_pos-bukrs
                    AND augdt EQ wa_pos-augdt
                    AND augbl EQ wa_pos-augbl
                    AND auggj EQ wa_pos-auggj.

      IF lt_zzaugblart[] IS NOT INITIAL.

        SORT lt_zzaugblart.

        DELETE lt_zzaugblart WHERE blart = 'RV'
                             OR blart = 'RC'
                             OR blart = 'AB'.

        IF lt_zzaugblart[] IS NOT INITIAL.
          READ TABLE lt_zzaugblart INTO ls_zzaugblart
              WITH KEY belnr = wa_pos-belnr.

          IF sy-subrc = 0.
            wa_pos-zzaugblart = ls_zzaugblart-blart.
          ELSE.
            CLEAR : ls_zzaugblart.
            READ TABLE lt_zzaugblart INTO ls_zzaugblart INDEX 1.
            wa_pos-zzaugblart = ls_zzaugblart-blart.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
...

Cheers,

Loo

Answers (0)