‎2009 Jul 15 6:02 AM
the function moudule sap_convert_to_csv_format is not available in my system . it is a not released fm as of now. so i cant use it.
My requirement is to send the details to app server in a comma separated format.
For each work area , which i transfer to application server, i hv to separte each field by a comma separtaor.
TRANSFER wa to VA_FILENAME LENGTH 256 ENF OF LINE.
Suppose my work area has fields wa-f1 wa-f2 wa-f3, it should write in app server as value1, value2, value3 like wise....
Suggest me if there is any alternative function module to acheiver this like when we pass wa to fm, the fields should be comma separator,
Any other useful suggestions are welcome.
Thanks
‎2009 Jul 15 6:06 AM
Hi,
The simplest way would be just to do a :
concatenate wa-f1 wa-f2 wa-f3 into va separated by ','.
Regards,
Neil.
‎2009 Jul 15 6:12 AM
I thought of that idea, But i hv more than 30 fields to transfer to the file. So if there is any fm to pass and get the fields separated by comma would be more helful
‎2009 Jul 15 6:38 AM
Hi ,
The below method is for converting contents of work are into sting format.
Loop at <itab_name> into ls_text.
Call Method CL_ABAP_CONTAINER_UTILITIES =>FILL_CONTAINER_C
Exporting
IM_VALUE = ls_text
Importing
EX_CONTAINER = ls_string
Exceptions
ILLEGAL_PARAMETER_TYPE = 1
others = 2.
Transfer ls_string To ls_file.
Endloop.
Regards,
Waseem
‎2009 Jul 15 6:11 AM
Hi,
here is the piece of code to transfer data from internal table to applivcation server as a comma seperated file..
FORM comma_sep_file .
DATA: l_cost_center_str TYPE type_cost_center.
IF it_cost_center[] IS NOT INITIAL.
**Concatenate file path and file name
CONCATENATE p_cpath p_cfile INTO v_cost_cen_output.
OPEN DATASET v_cost_cen_output FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
If Network file could not be opened, give a message.
IF sy-subrc <> 0.
WRITE : / text-030 , v_cost_cen_output .
MESSAGE s000(zp) WITH text-015 .
CLEAR : v_cost_cen_output,
p_cpath .
ELSE.
LOOP AT it_cost_center INTO l_cost_center_str.
CONCATENATE l_cost_center_str-co_cen_code
l_cost_center_str-co_cen_name
l_cost_center_str-fld3
l_cost_center_str-fld4
l_cost_center_str-set_true INTO wa_csvdata
SEPARATED BY c_const_sep.
TRANSFER wa_csvdata TO v_cost_cen_output.
CLEAR wa_csvdata.
ENDLOOP.
ENDIF."IF sy-subrc <> 0.
CLOSE DATASET v_cost_cen_output.
ENDIF.
ENDFORM. "
i hope this will help you...
Thanks & Regards
Ashu Singh
‎2009 Jul 15 6:12 AM
Hello,
Try to understand below logic. you can add '#' with your field like below :
constants: con_comma value '#'.
LOOP AT it_data INTO wa_data.
clear w_var.
w_var(10) = WA_data-XBLNR.
w_var+10(1) = con_comma.
write wa_data-augdt to w_var+11(10).
w_var+21(1) = con_comma.
write wa_data-wrbtr to w_var+22(20).
TRANSFER w_var TO w_filename.
ENDLOOP.
CLOSE DATASET w_filename.Hope now you are able to complete your task.
Have a Nice Day,
Regards,
Sujeet