‎2006 Nov 08 3:53 PM
Hi all...
iam new to this group. i am writing a sub-rotuine for a form. But in that one select query was bouncing. and one more thing is there any way to get BUKRS based on KUNNR.
And please correct my code.
PROGRAM ZDUNNING_TEST.
FORM DUNNING_TEST TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
DATA: w_po_line_ds LIKE out_par,
w_kunnr LIKE mhnd-kunnr,
w_wrbtr type bsid-wrbtr,
l_index like sy-tabix,
sum like bsid-wrbtr,
w_wrbtr1(15) type c,
w_wrbtr2(15) type c.
CONSTANTS: c_waers_eur(5) type C value 'EUR',
c_waers_usr(5) type C value 'USR',
c_bukrs(4) type c value '5E50'.
data: begin of itab occurs 0,
waers like bsid-waers,
wrbtr like bsid-wrbtr,
end of itab.
data: begin of wa_itab,
waers like bsid-waers,
wrbtr like bsid-wrbtr,
end of wa_itab.
CONSTANTS: c_line(15) TYPE c VALUE 'W_DUN_AMT' .
READ TABLE in_par TRANSPORTING NO FIELDS.
w_kunnr = in_par-value.
*select single bukrs from bsid into w_bukrs where kunnr = w_kunnr.
select waers
wrbtr
from bsid
into table itab
where kunnr = w_kunnr
and bukrs = c_bukrs.
clear sum.
sort itab by waers.
loop at itab into wa_itab.
l_index = sy-tabix.
sum = sum + wa_itab-wrbtr.
at end of waers.
read table itab into wa_itab index l_index.
wa_itab-wrbtr = sum.
move wa_itab-wrbtr to w_wrbtr2.
*write:/ wa_itab-cur,wa_itab-amt.
clear sum.
endat.
endloop.
‎2006 Nov 08 3:57 PM
Hi,
1)
Instead of TRANSPORTING NO FIELDS..use INDEX 1...If you say transporting no fields..No fields will be moved to the header line.
READ TABLE in_par <b>INDEX 1</b>.
2) The customer can be in multiple company codes..
If you want the first company code..Use the following..
DATA: V_BUKRS LIKE KNB1-BUKRS
SELECT SINGLE BUKRS FROM KNB1
INTO V_BUKRS
WHERE KUNNR = 'CUSTOMER NUMBER'.
Thanks,
Naren
‎2006 Nov 08 4:00 PM
Hi Narendran...
Thanks for the reply. But it is bouncing on the select query only.
please check this and corect that.
thanks & regards,
Arjun Jain
‎2006 Nov 08 3:57 PM
‎2006 Nov 08 4:03 PM
Hi,
Try calling the FM CONVERSION_EXIT_ALPHA_INPUT..
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = W_KUNNR
IMPORTING
OUTPUT = W_KUNNR.
Thanks,
Naren
‎2008 Jul 25 4:31 PM