2006 Nov 17 10:29 AM
I have a samll Question :
I have in entry of Method an internal table , and I ignore the fields contain on it.
the goal is to separate each two fields with separator. and write it in text file.
how I can do that :
Ex:
Internal table
PP OO KK
MM CC TT
What I want to do is :
PP;OO;KK
MM;CC;TT
Note That I ignore the structure of the table. I know just that is table
2006 Nov 17 10:37 AM
HI,
You know the lenth of the field in the internal table,
so write like
Loop at itab.
Move itab-File+0(2) to copyfield.
Move Copyfield to text.
move itab-field+2(2) to copyfield.
concatinate copyfield text into text separeted by ':'.
move itab-field+4(2) to copyfield.
concatinate copyfield text into text separeted by ':'
endloop.
So at the last you wil have the exact value in the TEXT field
Regards
Sudheer
HI,
You know the lenth of the field in the internal table,
so write like
Loop at itab.
Move itab-File+0(2) to copyfield.
Move Copyfield to text.
move itab-field+2(2) to copyfield.
concatinate copyfield text into text separeted by ':'.
move itab-field+4(2) to copyfield.
concatinate copyfield text into text separeted by ':'
endloop.
So at the last you wil have the exact value in the TEXT field
Regards
Sudheer
2006 Nov 17 10:34 AM
2006 Nov 21 10:04 AM
Hi every one,
I have a question about ABAP Object...
Can a class have an attribute as Table (satndard)...??
Otherwise how to avoid it ?
Sincerly
Thanks
2006 Nov 17 10:37 AM
HI,
You know the lenth of the field in the internal table,
so write like
Loop at itab.
Move itab-File+0(2) to copyfield.
Move Copyfield to text.
move itab-field+2(2) to copyfield.
concatinate copyfield text into text separeted by ':'.
move itab-field+4(2) to copyfield.
concatinate copyfield text into text separeted by ':'
endloop.
So at the last you wil have the exact value in the TEXT field
Regards
Sudheer
2006 Nov 17 10:50 AM
My internal Table is Standard table without header line ...
What's copyfiled....and Itab-File.
Itab-File are not accepted by the compilator..
Thanks
2006 Nov 17 11:02 AM
Hi
Can't you use fm SAP_CONVERT_TO_CSV_FORMAT?
I you need to do by yourself, perhaps this can be helful for you.
It's a method I developed to insert an element as separator:
- Definition
METHODS: INSERT_SEPARATOR_CHAR
IMPORTING
SEPARATOR TYPE STRING
RECORD_IN TYPE ANY
NO_GAPS TYPE C DEFAULT SPACE
EXPORTING
RECORD_OUT TYPE STRING.- Implemetation
METHOD INSERT_SEPARATOR_CHAR.
FIELD-SYMBOLS: <FS_FIELD> TYPE ANY.
DATA: WA_STRING(10000) TYPE C.
DATA: LEN_SEPAR TYPE I,
LEN_FIELD TYPE I,
LEN_STRING TYPE I.
LEN_SEPAR = STRLEN( SEPARATOR ).
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE RECORD_IN TO <FS_FIELD>.
IF SY-SUBRC <> 0. EXIT. ENDIF.
DESCRIBE FIELD <FS_FIELD> LENGTH LEN_FIELD.
WRITE: <FS_FIELD> TO WA_STRING+LEN_STRING(LEN_FIELD).
LEN_STRING = LEN_STRING + LEN_FIELD.
WRITE: SEPARATOR(LEN_SEPAR) TO WA_STRING+LEN_STRING.
IF NOT NO_GAPS IS INITIAL.
CONDENSE WA_STRING NO-GAPS.
LEN_STRING = STRLEN( WA_STRING ).
ELSE.
LEN_STRING = LEN_STRING + LEN_SEPAR.
ENDIF.
ENDDO.
LEN_STRING = STRLEN( WA_STRING ).
MOVE WA_STRING(LEN_STRING) TO RECORD_OUT.
ENDMETHOD. "INSERT_SEPARATOR_CHARMax
2006 Nov 17 12:59 PM
I can't execute SAP_CONVERT_TO_CSV_FORMAT I don't have it.
For your code i think it's good code but i have a problem with it ....
i have always sy-subrc = 4 after my assign sy-index OF STRUCTURE record_in TO <fs_field>
Note My structure is local structure created in an other program who call the method .....!!
2006 Nov 17 1:28 PM
I think that problem is that for me RECORD_IN is internal table and I saw that in the method it's defined like structure.
2006 Nov 17 2:53 PM
Hi sorry but finally I found that I can run SAP_CONVERT_TO_CSV_FORMAT.
You know I 'm Really begineer ... in SAP environement.
I have just question related to that SAP_CONVERT_TO_CSV_FORMAT...
The file is only writing on the application server ...How I can do to dispaly the containt of it ...
thanks a lot.
2006 Nov 20 1:51 AM
Use Tcode AL11 & look up under the relevant directory to view your file..
~Suresh
2006 Nov 17 10:38 AM
USE FM GUI_DOWNLOAD
and WRITE_FIELD_SEPARATOR = 'X'.
tab dilimiter
santhosh
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |