Application Development and Automation 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: 
Read only

selection criteria

Former Member
0 Likes
1,039

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
995

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

8 REPLIES 8
Read only

Former Member
0 Likes
995

Try this,

Reference document number BSAK-XBLNR should have the same accounting document number BELNR for a particular clearing document number.

Thanks,

SKJ

Read only

0 Likes
995

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

Read only

Former Member
0 Likes
996

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

Read only

0 Likes
995

i don want to delete the entries, i want to calculate the discount of 31 and 21 posting key (31 - 21)

Read only

Former Member
0 Likes
995

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).

Read only

former_member217544
Active Contributor
0 Likes
995

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

Read only

0 Likes
995

hi,

i don want to delete, but i want to compare the amount fields of both 31 and 21 posting keys.

Read only

0 Likes
995

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.