11-27-2007 8:54 AM
hi,
I want to upload data to sap server in txt format, now i want use the program as follows:
open dataset file for output IN text MODE encoding default.
loop at itab.
TRANSFER itab TO file.
endloop.
close dataset file.
in this way ,the text is no separated by separator. How separated by separator(, or tab),can somebody tell me ,ths.
sophia
11-27-2007 9:09 AM
Data: record type string,
sep type c value ','.
open dataset file for output IN text MODE encoding default.
loop at itab.
concatenate itab-field1
itab-fiel2
into record
separated by sep.
TRANSFER record TO file.
endloop.
close dataset file.
11-27-2007 9:00 AM
Hi,
Declare fields in ur itab as a character n pass separater int that field as ' space or whatever u want n then download. This is the only way.
Regards,
Prashant
11-27-2007 9:00 AM
do this way....
If u want to Concatenate the components Dynamically use the Field symbols concept.
Eg:
field-symbols: <fcomp> type any.
DATA : V_sTR TYPE STRING.
Loop at Itab INTO WA..
Do .
ASSIGN-COMPONENT SY-INDEX OF STRUCTURE WA TO <FCOMP>
CASTING TYPE C.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
CONCATENATE V_STR <FCOMP> TO V_STR
SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
ENDIF.
Enddo.
TRANSFER V_STR TO P_FILE.
ENDLOOP.
Regards
Vasu
11-27-2007 9:09 AM
Data: record type string,
sep type c value ','.
open dataset file for output IN text MODE encoding default.
loop at itab.
concatenate itab-field1
itab-fiel2
into record
separated by sep.
TRANSFER record TO file.
endloop.
close dataset file.
11-27-2007 11:38 AM
Hi Sophia,
This is kiran kumar.G(working in SAP).i have develop a small code for u for ur problem.U have to copy the below code and execute it.And trace my code ok.Then ur problem will be solved.
If u r satisfy with my answer give me REWARD POINTS.
HAVE A NICE DAY..
CODE:
----
Internal Table
----
DATA: BEGIN OF itab OCCURS 0,
text(50),
END OF itab.
----
Append data to Internal Table
----
itab-text = 'DEMO BDC FIRST LINE'.
APPEND itab.
itab-text = 'DEMO BDC SECOND LINE'.
APPEND itab.
----
OPEN THE DATASET
----
OPEN DATASET 'ZBDCDEMO' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
----
Transfer the data to APPSERVER
----
LOOP AT itab.
TRANSFER itab TO 'ZBDCDEMO'.
ENDLOOP.
----
Close the Dataset
----
CLOSE DATASET 'ZBDCDEMO'.
11-27-2007 1:26 PM