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

error while transferin intenal table data to application server

Former Member
0 Likes
1,211

&----


*

*& 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

  • EXPORTING

56

    • BIN_FILESIZE = ' '

57

    • CODEPAGE = ' '

58

  • FILENAME = 'C:\KLN.TXT'

59

  • FILETYPE = 'DAT'

60

    • MODE = ' '

61

    • WK1_N_FORMAT = ' '

62

    • WK1_N_SIZE = ' '

63

    • WK1_T_FORMAT = ' '

64

    • WK1_T_SIZE = ' '

65

    • COL_SELECT = ' '

66

    • COL_SELECTMASK = ' '

67

    • NO_AUTH_CHECK = ' '

-


10 REPLIES 10
Read only

Former Member
0 Likes
1,044

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,044

First, this line needs to be modified. You should be giving the full path and file name.

<b>data: f_glacc type localfile default '/usr/sap/TST/SYS/flgl.txt'.</b>

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,044

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

Read only

Former Member
0 Likes
1,044

i guess f_glacc should be a valid application server path

eg: /usr/sap/trans/data/down/filename

Read only

Former Member
0 Likes
1,044

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

Read only

Former Member
0 Likes
1,044

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.

Read only

Former Member
0 Likes
1,044

hi,

herewith i send a link..

http://www.sapdevelopment.co.uk/file/file_updown.htm

hope this will be useful..

regards,

Vinoth

Read only

Former Member
0 Likes
1,044

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

Read only

andreas_mann3
Active Contributor
0 Likes
1,044

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

Read only

Former Member
0 Likes
1,044

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