on 03-31-2006 9:51 AM
Hi all,
I had a requirement like this...
when i upload data to a flat file in application server
using OPEN DATASET and TRANSFER...
the data can automatically be converted into tab delimited spaces...
so when ever i open the file using AL11 transaction...
the data has to be seen with tab delimited spaces between them....
hope you people got my question...
thanks and regards
raghu
Hi,
Refer this code:
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE LIKE IBIPPARMS-PATH OBLIGATORY DEFAULT '/TSS_dev/NP/CFS/in/MIGRATION/'. " For file selection
SELECTION-SCREEN END OF BLOCK B1.
PERFORM UPLOAD.
FORM UPLOAD.
DATA : LV_FINAL(350).
DATA : LC_HASH TYPE C,
LV_DELIM TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE E013 WITH P_FILE .
ENDIF.
DO.
READ DATASET P_FILE INTO GV_DATA .
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
SPLIT GV_DATA AT LV_DELIM INTO GT_FILE-ZCNTRY
GT_FILE-ZOLOC
GT_FILE-ZOLOC20
GT_FILE-ZOLOC40
GT_FILE-ZAWSYS
GT_FILE-ZSTREET
GT_FILE-ZSTREET2
GT_FILE-ZPOSTAL_CODE
GT_FILE-ZCITY
GT_FILE-ZCOUNTRY
GT_FILE-ZOBJ_SIGN
GT_FILE-ZREF1
GT_FILE-ZREF2
GT_FILE-ZREF3
GT_FILE-ZREF4
GT_FILE-ZNOTE1
GT_FILE-ZNOTE2
LC_HASH.
APPEND GT_FILE.
ENDDO.
CLOSE DATASET P_FILE.
ENDFORM. " gui_upload
Regards,
Gayathri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this below code.It won't show Tab delimited output.
Types : BEGIN OF ty_final,
f1(100),
f2(100),
...
End of ty_final,
BEGIN OF ty_output,
record(362) TYPE c, "Output data
END OF ty_output.
data : t_final TYPE STANDARD TABLE OF ty_final, "For ty_final
t_output TYPE STANDARD TABLE OF ty_output,"For ty_output.
<b> APPEND LINES OF t_final TO t_output.</b>
If you are appending as above,you won't get tab delimited output.
Local variable Declaration
DATA l_msg(60) TYPE c.
Opening the file for output in text mode
OPEN DATASET p_afile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
MESSAGE l_msg.
IF sy-subrc NE 0.
g_flg = c_x.
MESSAGE s000 WITH text-004 p_afile text-005.
"Error in opening file for output
LEAVE LIST-PROCESSING.
ENDIF.
LOOP AT t_output INTO w_output.
TRANSFER w_output TO p_afile LENGTH 400.
ENDLOOP.
Closing the file
CLOSE DATASET p_afile.
IF sy-subrc NE 0.
g_flg = c_x.
MESSAGE s000 WITH text-006 p_afile."Error in closing file
LEAVE LIST-PROCESSING.
ENDIF.
Kindly reward points by clikcing the star on the left of reply,if it helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
while transfering data attach tabs using <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB</b> that will do what you required.
Regards
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can try CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB or one of the attribute of CL_ABAP_CHAR_UTILITIES to add as a tab to your file.
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.