07-24-2008 4:19 PM
hi,
i have a requirement for credit memo,
if i have the duplicates of clearing doc and if the posting key of any one is 21 then i need to do some calculations.
my question is how to get or how to select the duplicates for documents in bsak.
previously im selectin based on selection criteria.
07-24-2008 4:52 PM
Hi,
In BSAK,
fetch all records, that have the same co.code (BUKRS), Vendor or Creditor (LIFNR), and clearing doc.no. (AUGBL), if you can pass the year that is good b'coz this will reduce the number of records.
Now sort this table and delete entries that does not have Posting Key (BSCHL) = '21'.
Now the internal table has entries with only posting key 21.
You can now do further processing for the remaining records.
Regard,
Subramanian
07-24-2008 4:23 PM
Try this,
Reference document number BSAK-XBLNR should have the same accounting document number BELNR for a particular clearing document number.
Thanks,
SKJ
07-24-2008 4:25 PM
i really didnt get it.
can u ellaborate?
i mean how to code it.
Edited by: Poonam Naik on Jul 24, 2008 5:25 PM
07-24-2008 4:52 PM
Hi,
In BSAK,
fetch all records, that have the same co.code (BUKRS), Vendor or Creditor (LIFNR), and clearing doc.no. (AUGBL), if you can pass the year that is good b'coz this will reduce the number of records.
Now sort this table and delete entries that does not have Posting Key (BSCHL) = '21'.
Now the internal table has entries with only posting key 21.
You can now do further processing for the remaining records.
Regard,
Subramanian
07-25-2008 7:44 AM
i don want to delete the entries, i want to calculate the discount of 31 and 21 posting key (31 - 21)
07-25-2008 6:31 AM
You need to get a query from bsak tables where documnet type (BSAK-BLART) is vendor Credit Memo (KG) and put it on an internal table. Once you fetch it, you can now get what you need by checking the rows of your internal table that have the same Document Number (BSAK-BLART) AND Line Item(BSAK-BUZEIT) AND Clearing Document (BSAK-AUGBL).
07-25-2008 7:33 AM
Hi Poonam,
Iam not sure about the exact field names but I think this will help in coding part:
lets say clearing doucument = field1 and
posting key = field2.
if itab1 is the internal table which contains all your records,
itab2 [ ] = itab1 [ ].
loop at itab1 into wa_itab1.
delete table itab2 from wa_itab1.
read table itab2 with key field1 = wa_itab1-field1
into wa_itab2.
if sy-subrc = 0 and wa_itab2-field2 = ' 21 ' .
do the required operations.
endif.
Hope this will help.
Regards,
Swarna Munukoti.
Edited by: Swarna Munukoti on Jul 25, 2008 8:34 AM
07-25-2008 7:58 AM
hi,
i don want to delete, but i want to compare the amount fields of both 31 and 21 posting keys.
07-25-2008 11:04 AM
hi,
i am trying to use this code but the second modify statement is not working
LOOP AT i1_bsak.
READ TABLE i2_bsak WITH KEY augbl = i1_bsak-augbl.
IF sy-subrc = 0.
i1_bsak-wskto = i1_bsak-wskto - i2_bsak-wskto.
MODIFY i1_bsak TRANSPORTING wskto.
MODIFY i_bsak FROM i1_bsak TRANSPORTING wskto WHERE bschl = '31' and augbl = i1_bsak-augbl.
DELETE i_bsak WHERE bschl = '21' and augbl = i1_bsak-augbl.
ENDIF.
ENDLOOP.