11-13-2011 3:42 PM
dear all,
my requirement is i want to get total data for AFIELD ' rs in currency' from KSB1 tcode .
my code is
TYPE-POOLS: SLIS.
data: begin of ascitab occurs 1,
line(255),
end of ascitab,
wa_ascitab like line of ascitab.
DATA:lt_listobject TYPE TABLE OF abaplist,
l_tab_lines TYPE i.
DATA: txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE.
data zkokrs type kokrs.
data cgroup type ksgru.
*data wac like line of cgroup.
data zbudat type RANGE OF budat.
data wab like line of zbudat.
data variant type DISVARIANT-VARIANT.
wab-low = '01092011'.
wab-high = '11112011'.
wab-option = 'BT'.
wab-sign = 'I'.
append wab to zbudat.
SUBMIT rkaep000 with zKOKRS = '1001'
with cgroup = 'VA398G'
with budat in zbudat
with P_DISVAR = '/COST ORE PR' EXPORTING LIST TO MEMORY AND RETURN.
free MEMORY ID 'FOB'.
submit rkaep000 using selection-screen '0100'
with p_kokrs = '1001'
with kstgr = 'VA398G'
WITH RBUDAT IN ZBUDAT
WITH P_DISVAR = '/COST ORE PR'
with p_tcode = 'KSB1' EXPORTING LIST TO MEMORY AND RETURN.
*****SUBMIT rkaep000
USING SELECTION-SET 'RAVI'
EXPORTING LIST TO MEMORY AND RETURN.
*****if sy-subrc ne 0.
Read list from memory into table
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
Error in function module &1
ENDIF.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listobject = lt_listobject
listasci = ascitab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
listobject = lt_listobject.
LOOP AT txtlines.
*
endloop.
types:begin of ty_tab,
wrgbtr type rkgxxx,
end of ty_tab.
data : wa1 type ty_tab.
data it1 type table of ty_tab.
data total type rkgxxx.
total = 0.
LOOP AT ascitab into wa_ascitab from 4. "data will be stored in this..
wa1-wrgbtr = wa_ascitab+17(14).
total = wa1-wrgbtr + total.
endloop.
but iam unable to get data into wa_ascitab+17(14). iam using company code,cxost center,RS in currency fields as my l;aypout
is there any data declaraitons i have to made.
please helpme,
thanks in advance.
raj shiv
11-13-2011 5:30 PM
Are you getting data into ascitab more than 4 lines. If yes, then try passing wa_ascitab+17(14) into a character field and then pass it to the field you want, by shifting the field left and deleting leading spaces.
Thanks,
Harikiran Katta
11-13-2011 5:30 PM
Are you getting data into ascitab more than 4 lines. If yes, then try passing wa_ascitab+17(14) into a character field and then pass it to the field you want, by shifting the field left and deleting leading spaces.
Thanks,
Harikiran Katta
11-14-2011 6:46 AM
dear all,
iam getting dump for th above mentioned progrm as 'unable to interpret value 1,037.23
as number'
11-14-2011 7:09 AM
Try
DATA: wa_string TYPE string.
LOOP AT ascitab into wa_ascitab from 4. "data will be stored in this..
wa_string = wa_ascitab+17(14).
TRANSLATE wa_string USING ', '.
CONDENSE wa_string NO-GAPS.
wa1-wrgbtr = wa_string.
total = wa1-wrgbtr + total.
ENDLOOP.
11-14-2011 7:39 AM