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: 

Logic for adding...

Former Member
0 Kudos

hkont waers shkzg wrbtr

0001200120

USD

H

6688.96

0001000100

USD

S

6688.96

0001200105

EUR

H

6688.96

0001000250

EUR

S

100000.00

0007991110

EUR

H

100000.00

0001000100

CAD

S

100000.00

0007991300

CAD

H

100000.00

0001000250

EUR

S

20000.00

0007991110

EUR

H

20000.00

|0001000100|GBP |S | 20000.00

hi,

Have an requirement to add the wrbtr field based on the gl account number(HKONT)

Currency(WAERS) and debit/credit indicator(SHKZG).

If the accounts are same then currency needs to be checked and it the currency is also the same

then the indicator has to be checked and the wrbtr value has to be calulated... WRBTR = S - H.

Example: For a glaccount if there are 4 currencies with 3s and 1H then the final record will be a single

record with the gl account number, currency and debit indicator and WRBTR = SSS-H.

if the account and currency are not similar ...the values can be appended direclty...

..was trying to use field-symbols..please help on this ...how to do it.

1 ACCEPTED SOLUTION

valter_oliveira
Active Contributor
0 Kudos

Hello,

Do something like this (itab1 has your 4 fields, itab2 has 3 fields - doesn't have shkzg):


LOOP AT itab1 INTO wa_1.
  CLEAR wa_2.
  wa_2-hkont = wa_1-hkont.
  wa_2-waers = wa_1-waers.
  IF wa_1-shkzg EQ 'S'.
    wa_2-wrbtr = wa_1-wrbtr.
  ELSE.
    wa_2-wrbtr = - wa_1-wrbtr.
  ENDIF.
  COLLECT wa_2 INTO itab2.
ENDLOOP.

Best regards.

Valter Oliveira.

2 REPLIES 2

valter_oliveira
Active Contributor
0 Kudos

Hello,

Do something like this (itab1 has your 4 fields, itab2 has 3 fields - doesn't have shkzg):


LOOP AT itab1 INTO wa_1.
  CLEAR wa_2.
  wa_2-hkont = wa_1-hkont.
  wa_2-waers = wa_1-waers.
  IF wa_1-shkzg EQ 'S'.
    wa_2-wrbtr = wa_1-wrbtr.
  ELSE.
    wa_2-wrbtr = - wa_1-wrbtr.
  ENDIF.
  COLLECT wa_2 INTO itab2.
ENDLOOP.

Best regards.

Valter Oliveira.

0 Kudos

Cheers mate....points awarded...