‎2006 Jan 17 1:37 PM
&----
*
*& Report YGL_BALANCES
*&
&----
*&
*&
&----
REPORT YGL_BALANCES.
TABLES:BAPI1028_0,BAPI1028_4,faglflext.
data: f_glacc(10) type c value 'flgl.text' .
DATA: BALANCE LIKE BAPI1028_4-BALANCE,
RETUR LIKE BAPIRETURN,
FISC_YEAR LIKE BAPI1028_4-FISC_YEAR,
FIS_PERIOD LIKE BAPI1028_4-FIS_PERIOD,
DEBITS_PER LIKE BAPI1028_4-DEBITS_PER,
CREDIT_PER LIKE BAPI1028_4-CREDIT_PER,
PER_SALES LIKE BAPI1028_4-PER_SALES.
data:prctr like faglflext-prctr,
racct like faglflext-racct,
rbukrs like faglflext-rbukrs.
**
*
types: begin of st_i ,
COMP_CODE LIKE BAPI1028_4-COMP_CODE,
GL_ACCOUNT LIKE BAPI1028_4-GL_ACCOUNT,
FISC_YEAR(4),
FIS_PERIOD(2),
DEBITS_PER(23),
CREDIT_PER(23),
PER_SALES(23),
BALANCE(23),
CURRENCY LIKE BAPI1028_4-CURRENCY,
CURRENCY_ISO(3),
END OF st_i.
DATA: ITAB like BAPI1028_4 OCCURS 10 WITH HEADER LINE.
***********************************************************************jtab like faglflext occurs 0 with header line.
PARAMETERS: COMPCODE LIKE BAPI1028_0-COMP_CODE,
CURRENCY LIKE BAPI1028_5-CURR_TYPE,
YEAR LIKE BAPI1028_4-FISC_YEAR,
ACCOUNT LIKE BAPI1028_0-GL_ACCOUNT.
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
EXPORTING
COMPANYCODE = COMPCODE
GLACCT = ACCOUNT
FISCALYEAR = YEAR
CURRENCYTYPE = CURRENCY
IMPORTING
BALANCE_CARRIED_FORWARD = BALANCE
RETURN = RETUR
TABLES
ACCOUNT_BALANCES = ITAB.
open dataset f_glacc for output in text mode encoding default.
loop at itab .
transfer itab to f_glacc.
endloop.
close dataset f_glacc.
iam getting error like this
Runtime Errors UC_OBJECTS_NOT_CHARLIKE
Date and Time 01/16/2006 07:09:51
-
-
ShrtText |
The current statement is defined for character-type data objects only. |
-
-
What happened? |
Error in ABAP application program. |
The current ABAP program "YGL_BALANCES" had to be terminated because one of the |
statements could not be executed. |
This is probably due to an error in the ABAP program. |
-
-
Error analysis |
Only character-type data objects are supported at the argument |
position "f" for the statement |
"TRANSFER f TO ...". |
In this case, the operand "f" has the non-character-type "BAPI1028_4". The |
current program is flagged as a Unicode program. In the Unicode context, |
type X fields are seen as non-character-type, as are structures that |
contain non-character-type components. |
-
-
Trigger Location of Runtime Error |
Program YGL_BALANCES |
Include YGL_BALANCES |
Row 48 |
Module Name START-OF-SELECTION |
-
-
Source Code Extract |
-
Line | SourceCde |
-
18 | FIS_PERIOD LIKE BAPI1028_4-FIS_PERIOD, |
19 | DEBITS_PER LIKE BAPI1028_4-DEBITS_PER, |
20 | CREDIT_PER LIKE BAPI1028_4-CREDIT_PER, |
21 | PER_SALES LIKE BAPI1028_4-PER_SALES, |
22 | |
23 | ITAB LIKE BAPI1028_4 OCCURS 10 WITH HEADER LINE. |
24 | *data : wa like itab. |
25 | |
26 | PARAMETERS: COMPCODE LIKE BAPI1028_0-COMP_CODE, |
27 | CURRENCY LIKE BAPI1028_5-CURR_TYPE, |
28 | YEAR LIKE BAPI1028_4-FISC_YEAR, |
29 | ACCOUNT LIKE BAPI1028_0-GL_ACCOUNT. |
30 | |
31 | CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES' |
32 | EXPORTING |
33 | COMPANYCODE = COMPCODE |
34 | GLACCT = ACCOUNT |
35 | FISCALYEAR = YEAR |
36 | CURRENCYTYPE = CURRENCY |
37 | IMPORTING |
38 | BALANCE_CARRIED_FORWARD = BALANCE |
39 | RETURN = RETUR |
40 | TABLES |
41 | ACCOUNT_BALANCES = ITAB. |
42 | |
43 | *OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. |
44 | *TRANSFER `1234567890` TO file. |
45 | * |
46 | open dataset f_glacc for output in text mode encoding default. |
47 | loop at itab . |
>>>>> | transfer itab to f_glacc. |
49 | endloop. |
50 | close dataset f_glacc. |
51 | |
52 | . |
53 | |
54 | *CALL FUNCTION 'WS_DOWNLOAD' |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
-
‎2006 Jan 17 1:41 PM
HI,
MOve whatever that is there in the itab to another itab, with a structure referring to only char type variables.
move all the data of the itab1 to itab2 and use it for the transfer statement.
for eg: if there is a amount field, go to the data element level/domain level and see the output length of the field. Declare a char type variable of the same length in the new internal table.
REgards,
Ravi
‎2006 Jan 17 1:44 PM
‎2006 Jan 17 1:44 PM
Hi,
Problem may be that you are sending non char
fields to application server. Convert nonchar to
char and transfer the contents to application server.
Reward points if info is helpful
Regards
Amole
‎2006 Jan 17 1:44 PM
i guess f_glacc should be a valid application server path
eg: /usr/sap/trans/data/down/filename
‎2006 Jan 17 1:48 PM
Hi,
u need to transfer the contents of ur internal table into a character variable to transfer it to FILE.
something like this:
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
concatenate itab-var1 itab-var2 itab-var3 into char separated by con_tab.
transfer char to f_glacc.
Regards,
Bikash
‎2006 Jan 17 1:49 PM
Hi ,
what is that file type .text ...?
there is some problem as i understand from ur code ...
There actually u have to mention application server path
with file name...
go thru this code ..I hope it will be helpful for u
ELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001
PARAMETERS : p_afile LIKE filename-fileintern LOWER CASE.
SELECTION-SCREEN END OF BLOCK a.
OPEN DATASET p_afile FOR OUTPUT IN TEXT MODE.
*Display this message if the file is not opened successfully
IF sy-subrc NE 0.
MESSAGE e006 WITH 'Error in opening Server file'.
ELSE.
LOOP AT it_display.
TRANSFER it_display TO p_afile.
ENDLOOP.
IF sy-subrc EQ 0.
WRITE : /'File posted successfully'.
ENDIF.
*Close dataset
CLOSE DATASET p_afile.
*Display this message if the file is not closed
IF sy-subrc NE 0.
MESSAGE e006 WITH 'Error in closing Server file'.
ENDIF.
ENDIF.
‎2006 Jan 17 1:50 PM
hi,
herewith i send a link..
http://www.sapdevelopment.co.uk/file/file_updown.htm
hope this will be useful..
regards,
Vinoth
‎2006 Jan 17 1:54 PM
Regarding teh application server path u can access u can get it from AL11 transaction.
Get one of the directories which u have access (generally
DIR_HOME PATH /usr/sap/CON/DVEBMGS03/work )
AND THEN add some file name say (file.txt)
so total path will be /usr/sap/CON/DVEBMGS03/work/file.txt)
then try
enjoy
vengal
‎2006 Jan 17 2:04 PM
Hi,
try:
1) delete comment * from type st_i
2) define: DATA: ITAB2 type st_i OCCURS 0 WITH HEADER LINE
3) itab2[] = itab[]
4) transfer itab2
regards
‎2006 Jan 17 2:14 PM
Hi,
since there are some non char fields trnasfer will fail.
so try to convert them to char fields and use transfer.
that will solve your problem.
declare them as char fields in your internal table
regards
vijay