GUI_DOWNLOAD seperator
Hi,
I am using the gui_download to download the data and its being downloded but data should be downloaded by comma seperator .
what is to be done for comma seprator format.Please reply
Hi,
Please check out this sample program.
report ztest_0001.
data: begin of itab occurs 0,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of itab.
data: begin of iout occurs 0,
rec(1000) type c,
end of iout.
parameters: p_file type localfile default 'C:\test.csv'.
data: file type string.
start-of-selection.
Build the ITAB
itab-fld1 = 'A'.
itab-fld2 = 'B'.
itab-fld3 = 'C'.
append itab.
itab-fld1 = 'D'.
itab-fld2 = 'E'.
itab-fld3 = 'F'.
append itab.
itab-fld1 = 'G'.
itab-fld2 = 'H'.
itab-fld3 = 'I'.
append itab.
Build the output internal table from ITAB
Concatenate all fields into IOUT-REC
loop at itab.
concatenate itab-fld1 itab-fld2 itab-fld3 into iout-rec
separated by ','.
condense iout-rec no-gaps.
append iout.
endloop.
Now Download
file = p_file.
call function 'GUI_DOWNLOAD'
exporting
filename = file
tables
data_tab = iout
exceptions
others = 22.
Reward points if found helpful
Cheers,
Chandra Sekhar.
Similar Messages
-
GUI_DOWNLOAD field seperator not appering in downloaded data
Hi Experts,
I am dowladong data on presentation server using GUI_DOWNLOAD fm . the write fieldseperator i have passed is
'|' which is no appearing at end of each record . below is my code
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:/test.txt'
write_field_separator = '|'
TABLES
data_tab = itab
EXCEPTIONS
OTHERS = 22.
and the output is
000000000000000001 ROH 00000000
000000000000000002 00000000
000000000000000003 00000000
000000000000000004 ROH 00000000
Thamnks in advanceHi,
WRITE_FIELD_SEPARATOR = ' | '
WRITE_FIELD_SEPARATOR in GUI_DOWNLOAD works in SAP R/3 4.7 and later version.
or for example:
report ZFIELD_SEPARATOR.
data: begin of ioutput occurs 0,
rect(1000) type c,
end of ioutput.
data: begin of itab occurs 0,
field1(1) type c,
field2(2) type c,
field3(3) type c,
end of itab.
itab-field1 = 'A'.
itab-field2 = 'B'.
itab-field3 = 'C'.
append itab.
itab-field1 = '1'.
itab-field2 = '2'.
itab-field3 = '3'.
append itab.
itab-field1 = '$'.
itab-field2 = '@'.
itab-field3 = '#'.
append itab.
loop at itab.
concatenate itab-field1
itab-field2
itab-field3
into iout-rect
separated by '|'.
condense ioutput-rect no-gaps.
append ioutput.
endloop.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:/test.txt'
tables
data_tab = ioutput -
Hi Experts,
We are using GUI_DOWNLOAD function module to download data into presentation server in ECC6.
DATA: T_DATX(300) OCCURS 500 WITH HEADER LINE.
T_DATX is the one we are passing to FM which contains data to be downloaded.
In 4.7 version, we have used DATA: _T(1) TYPE x VALUE '09' as field seperator.
but its not accepting in ECC6 after upgrade. so to overcme this, we have used DATA: T(1) TYPE C VALUE CLABAP_CHAR_UTILITIES=>VERTICAL_TAB. but still its not downloading properly into cells in the excel sheet.
its downloading single record into single cell. How come I overcome this.
Pls advice. I have given the below code for your reference.
DATA: T_DATX(300) OCCURS 500 WITH HEADER LINE.
Modification ECC 6.0 Release Upgrade START *
DATA: _T(1) TYPE x VALUE '09'.
DATA: T(1) TYPE C VALUE CLABAP_CHAR_UTILITIES=>VERTICAL_TAB.
Modification ECC 6.0 Release Upgrade END *
*data: _t(1) type c value ';'.
DATA: _REPID LIKE SY-REPID
,_COMP LIKE RSTRUCINFO OCCURS 10 WITH HEADER LINE
,_IDX LIKE SY-TABIX
,F_TYPE(1)
FIELD-SYMBOLS: <FS>.
_REPID = SY-REPID.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
PROGRAM = _REPID
FIELDNAME = TABNAME
TABLES
COMPONENTS = _COMP
EXCEPTIONS
OTHERS = 1.
LOOP AT _COMP.
CONCATENATE T_DATX _COMP-COMPNAME T INTO TDATX.
ENDLOOP.
APPEND T_DATX.
CLEAR T_DATX.
LOOP AT T_EX.
_IDX = 1.
ASSIGN COMPONENT IDX OF STRUCTURE TEX TO <FS>.
DO.
CONCATENATE T_DATX <FS> T INTO TDATX.
_IDX = _IDX + 1.
ASSIGN COMPONENT IDX OF STRUCTURE TEX TO <FS> .
IF SY-SUBRC <> 0. EXIT. ENDIF.
ENDDO.
APPEND T_DATX.
CLEAR T_DATX.
ENDLOOP.
Regards,
SujathaHi Sujatha,
As suggested by previous poster, you should use horizontal tab as a separator (or a comma) to get a tab-delimited/CSV type format that you can open in Excel. However, instead of building the output table yourself as text lines, I'd simply pass the actual output table to function GUI_DOWNLOAD in parameter DATA_TAB, use table FIELD_NAMES for the column headers (looks like you want those based on your coding) and then set the FILE_TYPE parameter to 'DAT'.
Best wishes, harald -
how to use '|' delimited as seprator in GUI_DOWNLOAD ? Plz suggest me ,,
i want the output should be seprated by '|' delimited when i download the file.Hi,
We will pass the seperator to the WRITE_FIELD_SEPARATOR parameter as
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file
write_field_separator = '|'
TABLES
data_tab = itab[] . "Our internal talbe filled with data
Re: Why Function GUI_DOWNLOAD can create XML file but not a flat file?
Award points if useful
Thanks,
Ravee... -
WRITE_FIELD_SEPARATOR IN GUI_DOWNLOAD
Hi ,
How do i use the WRITE_FIELD_SEPARATOR field in the GUI_DOWNLOAD function.
ArunHi Arun,
Import parameter WRITE_FIELD_SEPARATOR of function GUI_DOWNLOAD you can use if you want fields to be seperated by tabs in downloaded file. If you pass 'X' to this parameter fields will be separated by tabs. for example i downloaded a table with this parameter as 'X' and then again with this parameter as blank. following output i got in file.
File generated with WRITE_FIELD_SEPARATOR = ''
1NAME1 CITY1
2NAME2 CITY2
3NAME3 CITY3
4NAME4 CITY4
5NAME5 CITY5
File generated with WRITE_FIELD_SEPARATOR = 'X'
1<spaces> NAME1 <spaces> CITY1
2<spaces> NAME2 <spaces> CITY2
3<spaces> NAME3 <spaces> CITY3
4<spaces> NAME4 <spaces> CITY4
Regards,
Komal. -
GUI_DOWNLOAD with txt file?
I can succesfully upload a csv, comma delimited, file, and manipulate it with GUI_DOWNLOAD. This way....
DATA: BEGIN OF gt_coa_data_holder OCCURS 0,
rec(200) TYPE c,
END OF gt_coa_data_holder.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_filename
TABLES
data_tab = gt_coa_data_holder
LOOP AT gt_coa_data_holder into <gs_coa_data_holder>.
SPLIT <gs_coa_data_holder> AT ',' INT into wa-fields
But I discovered the file has commas in it so I need to do this with a text, space delimited file. When I use the new txt, space delimited file the space appears as a # in gt_coa_data_holder but as a /h/ in the work area. Thus I can not split up the records lines field by field properly. Even when I say
SPLIT <gs_coa_data_holder> AT '#' INT into wa-fields
or
SPLIT <gs_coa_data_holder> AT '/h/' INT into wa-fields
I tried using different parameters like "has field seperator" whos default is space.
Any suggestions?
Thank-You.Hello Tom,
I've encountered a similar problem. Not being aware of the exits or abap classes as of which to use, what I've done is that...
Downloaded the file on the presentation server into an elementary table of type c. Then used the SPLIT AT ','command and store them into the required table fields, here 'gt_coa_data_holder' .
It worked this way!!
Indu. -
GUI_UPLOAD & GUI_DOWNLOAD
Hi Could anyone please explain me kind of inputs that I need to give to this Function Module. I want to import one excel file and need to do some processing on it and replace original excel file by new one.
Can i Use above mentioned Function Modules to satisfy my requirements?
Thanks & Regards
JigarHI,
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:/VEND.XLS'(file path)
FILETYPE = 'ASC'(file type)
TABLES
DATA_TAB = ITAB.(internal table.)
UR MODUFICATIONS IN THE DATA.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:/VEND.XLS'(file path)
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' X'(IN CASE IF U WANT FIELD SEPERATOR)
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_EOL = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB(MODIFIED INTERNAL TABLE DATA).
REGARDS,
BHARAT. -
Urgent : help on gui_download
hi guys,
i am using gui_download to download file to a excel i have given field seperator as
" " empty. and the file type as asc. iwhen i download the file i am getting all the field clubbed into the excel in the first field only .also the output is in exponent format . how to get the output in seperate colums and to get without exponential format.
reward is sureCALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'C:\Documents and Settings\nex44jc\Desktop\header.xls'
filetype = 'DAT'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = it_header
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
reward if helpfull. -
Call function 'gui_download'
Hallo Friends,
I am using the above fuction in my program. I want the header of my internal table to be writen als header in the text file. So, I created another Itab (Itab-col_1) and appended all the headers in this, which I later use as below.
Problem:
1.
I am not satisfied with the downloaded output in file.txt I want the header to be excactly over the column content. Please see my output:
MANDT LIFNR LAND1 NAME1 NAME2 NAME3
010§§§§§§0000010000§§§§§§§§§§§§§§§§§§DE§§§§§§Test
010§§§§§§0000100000§§§§§§§§§§§§§§§§§§US§§§§§§TEST
§ § means Space
It is Obvious LAND1 should be over DE / US, NAME1 should be over Test / TEST etc etc
2.
I would like filed seperator to be ( ; ) not space. The flag 'X' gives space.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = str
filetype = 'ASC'
write_field_separator = 'X'
dat_mode = 'X'
TABLES
data_tab = itab_kreditor
fieldnames = itab_datei_col_header
EXCEPTIONS
file_write_error = 1
file_not_found = 19
OTHERS = 22.
So, how can I solve these two problems.
Blacky.CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = filename
FILETYPE = 'ASC'
APPEND = ' '
<b> WRITE_FIELD_SEPARATOR = ';'</b>
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = data_tab
FIELDNAMES = FIELDNAMES
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Vasu -
Gui_Download export to excel delivering only one row in excel output
Hello,
I am using Vista Os with the SAP front end logon 710 and Office 2007. Also my company is using Ecc6.0 in the server.
I am able to export the Itab data to excel but all the rows are on the first row in Excel.
If i have 3 rows in ITAB then all the 3 rows are on the First row of Excel
I have supplied these parameters
filename = 'C:\ITAB2XLS.xls'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
SHOW_TRANSFER_STATUS = 'X'
tables
data_tab = itab[]
FIELDNAMES = headingTab[]
Is anyone having the same issue like me ?
Thanks.Hi,
I tried commenting the Field seperator but it didnt change anything. I am still having the same problem.
I am pasting my code sample.
data:begin of itab occurs 0,
grp type c,
val type i,
end of itab.
data:begin of headingTab occurs 0,
TEXT(10) type c,
end of headingTab.
itab-grp = 'A'.
itab-val = 100.
append itab.
itab-grp = 'B'.
itab-val = 200.
append itab.
headingTab-text = 'GROUP'.
append headingTab.
headingTab-text = 'VALUE'.
append headingTab.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\ITAB2XLS.xls'
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'X'
SHOW_TRANSFER_STATUS = 'X'
tables
data_tab = itab[]
FIELDNAMES = headingTab[]
I think there is some problem with the Vista / Office 2007 with SAP.
Any suggestions? -
Fields should be quoted seperated by comma while transferring to text file
Hi Experts,
I need to show the file contents within double quotes and seperated by comma using 'GUI_DOWNLOAD'
For eg. The text file contents that are transferred to presentation server should look like,
"00210000001400","21000000149","","0000149","0014","10"
"00210006121500","21000612151","","0612151","1215","10".
I was coded like
**CONCATENATE c_quotes lv_matnr14 INTO lv_first.**
**CONCATENATE lw_final-extwg+0(2) c_quotes INTO lv_last.**
**CONDENSE lv_first NO-GAPS.**
**CONDENSE lv_last NO-GAPS.**
**CONCATENATE lv_first**
**lw_final-ean11+3(11)**
**lw_final-yyshortdesc**
**lw_final-ean11+7(8)**
**lw_final-ean11+9(4)**
**lv_last**
**INTO lw_ps_data**
**SEPARATED BY c_comma1.**
**CONDENSE lw_ps_data NO-GAPS.**
**APPEND lw_ps_data TO rt_ps_data.**
Can u please suggest if there is other better way than this.....?try ABAP forum for a better response - ABAP Development
-
hi guys,
i am using gui_download to download file to a excel i have given field seperator as
" " empty. and the file type as asc. iwhen i download the file i am getting all the field clubbed into the excel in the first field only .also the output is in exponent format . how to get the output in seperate colums and to get without exponential format.
reward is surehi..
Check the below program :
REPORT Z4PG_EXTEND_MATERIAL
NO STANDARD PAGE HEADING
LINE-SIZE 150
MESSAGE-ID Z4.
TABLES :
mard, "#EC * " Storage Location Data for Material
marc. "#EC * " Plant Data for Material
INTERNAL TABLES DECLARATIONS
1. INTERNAL TABLE FOR MATERIALS THAT ARE MAINTAINED FOR lgort = '0001'
DATA : BEGIN OF it_mard OCCURS 0,
matnr LIKE mard-matnr, " Material No.
werks LIKE mard-werks, " Plant
lgort LIKE mard-lgort, " Storage Location
END OF it_mard.
2. INTERNAL TABLE TO STORE MATERIALS WHICH ARE ALREADY MAINTAINED FOR
*lgort = 'ABCD'.
DATA: BEGIN OF it_verify OCCURS 0,
matnr LIKE mard-matnr, " Material No.
werks LIKE mard-werks, " Plant
lgort LIKE mard-lgort, " Storage Location
dismm LIKE marc-dismm, " MRP type
END OF it_verify.
3. INTERNAL TABLE TO STORE MATERIALS WHICH HAS NO MRP TYPE ASSIGNED.
DATA: BEGIN OF it_marc OCCURS 0,
matnr LIKE marc-matnr, " Material No.
werks LIKE marc-werks, " Plant
dismm LIKE marc-dismm, " MRP type
END OF it_marc.
3. INTERNAL TABLE TO STORE MATERIALS WHICH ARE ALREADY MAINTAINED FOR
*lgort = 'ABCD'.
DATA: BEGIN OF it_error OCCURS 0, "#EC *
index TYPE I,
fname(25),
fval(30),
err_msg(40),
END OF it_error.
DATA: BEGIN OF it_error1 OCCURS 0, "#EC *
matnr LIKE mard-matnr,
type LIKE bapiret2-type,
id LIKE bapiret2-id,
message LIKE bapiret2-message,
END OF it_error1.
TABLES FOR FUNCTION - BAPI_MATERIAL_SAVEDATA
DATA: I_HEADDATA LIKE BAPIMATHEAD, " HEADER DATA
I_STORAGELOCATIONDATA LIKE BAPI_MARD, " STORAGE
*LOCATION SPECIFIC MATERIAL DATA
I_STORAGELOCATIONDATAX LIKE BAPI_MARDX, " Information on
*update for STORAGELOCATIONDATA
I_RETURN LIKE BAPIRET2, " RETURN FROM
*BAPI
I_RETURNMESSAGES LIKE BAPI_MATRETURN2 OCCURS 0 WITH
HEADER LINE.
SELECTION PARAMETERS
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS s_matnr FOR mard-matnr. " Material Number
SELECTION-SCREEN END OF BLOCK MAIN.
SELECTION SCREEN VALIDATION.
AT SELECTION-SCREEN .
PERFORM validate_material.
START OF SELECTION
START-OF-SELECTION.
PERFORM extract_itmard.
PERFORM extract_itmarc.
PERFORM extract_itverify.
PERFORM verify_material.
PERFORM display_error_report.
*& Form extract_itmard
text
--> p1 text
<-- p2 text
form extract_itmard .
SELECT matnr werks lgort
FROM mard
INTO TABLE it_mard
WHERE matnr IN s_matnr AND
werks = 'RAPI' AND " Plant
lgort = 'RAPI' . " Storage Location
IF sy-subrc NE 0.
MESSAGE s114. " Success Message --> Data
Not Available
STOP.
ENDIF.
endform. " extract_itmard
*& Form extract_itmarc
text
--> p1 text
<-- p2 text
form extract_itmarc . "Fetch Materials for which the MRP
*Type is not maintained
SELECT matnr werks dismm
FROM marc
INTO TABLE it_marc
FOR ALL ENTRIES IN it_mard
WHERE matnr = it_mard-matnr AND
werks = it_mard-werks AND
dismm = ' '.
endform. " extract_itmarc
*& Form extract_itverify
text
--> p1 text
<-- p2 text
form extract_itverify . " Fetch All the Materials
which are already extended for the Storage Location
IF it_mard[] IS NOT INITIAL. "Check it_likp for not
null
SELECT matnr werks lgort
FROM mard
INTO TABLE it_verify
FOR ALL ENTRIES IN it_mard
WHERE matnr = it_mard-matnr AND
werks = 'RAPI' AND " For Plant
lgort = '0001'. " For Storage
Location
ELSE.
MESSAGE s114. "Success Message -->
Data Not Available
STOP.
ENDIF.
endform. " extract_itverify
*& Form verify_material
text
--> p1 text
<-- p2 text
FORM verify_material .
DATA: v_cnt TYPE I.
v_cnt = 1.
IF it_verify[] IS NOT INITIAL AND it_marc[] IS NOT INITIAL.
"Check it_likp for not null
SORT it_mard BY matnr.
SORT it_verify BY matnr.
ENDIF.
LOOP AT it_mard.
IF it_verify[] IS NOT INITIAL. " Check it_verify
for not null
READ TABLE it_verify WITH KEY matnr = it_mard-matnr BINARY
SEARCH. " Check Material is not extended
IF sy-subrc <> 0.
READ TABLE it_marc WITH KEY matnr = it_mard-matnr BINARY
SEARCH. " Check MRP Type for the Material is Maintained
IF sy-subrc <> 0.
PERFORM extend_material USING it_mard-matnr
" Extend Material
it_mard-werks.
ELSE.
it_error-index = v_cnt.
" Generate Error Report
it_error-fname = 'MATERIAL NO'.
it_error-fval = it_mard-matnr.
it_error-err_msg = 'MRP Type Not Maintained'.
APPEND it_error.
v_cnt = v_cnt + 1.
ENDIF.
ENDIF.
ELSE.
READ TABLE it_marc WITH KEY matnr = it_mard-matnr BINARY
SEARCH.
IF sy-subrc <> 0.
PERFORM extend_material USING it_mard-matnr
it_mard-werks.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " verify_material
*& Form extend_material
text
-->P_IT_MARD_MATNR text
-->P_IT_MARD_WERKS text
-->P_IT_MARD_LGORT text
FORM extend_material USING P_IT_MARD_MATNR TYPE mard-matnr
P_IT_MARD_WERKS TYPE mard-werks.
DATA: v_str(50).
CLEAR I_HEADDATA.
I_HEADDATA-MATERIAL = P_IT_MARD_MATNR.
I_HEADDATA-MRP_VIEW = 'X'.
CLEAR I_STORAGELOCATIONDATA.
CLEAR I_STORAGELOCATIONDATAX.
I_STORAGELOCATIONDATA-PLANT = P_IT_MARD_WERKS.
I_STORAGELOCATIONDATA-STGE_LOC = '0001'.
I_STORAGELOCATIONDATAX-PLANT = P_IT_MARD_WERKS.
I_STORAGELOCATIONDATAX-STGE_LOC = '0001'.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = i_headdata
CLIENTDATA =
CLIENTDATAX =
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA = i_storagelocationdata
STORAGELOCATIONDATAX = i_storagelocationdatax
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
NO_DEQUEUE = ' '
IMPORTING
RETURN = i_return
TABLES
MATERIALDESCRIPTION =
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES = i_returnmessages
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
LOOP at i_returnmessages.
write: / i_returnmessages-message.
ENDLOOP.
v_str = 'Material No does not Exist'.
IF i_return-type = 'E'.
it_error1-matnr = P_IT_MARD_MATNR.
it_error1-type = i_return-type.
it_error1-id = i_return-id.
it_error1-message = v_str.
APPEND it_error1.
ELSEIF i_return-type = 'S'.
READ TABLE i_returnmessages WITH KEY TYPE = 'S' id = 'M3'.
IF sy-subrc = 0.
it_error1-matnr = P_IT_MARD_MATNR.
it_error1-type = i_return-type.
it_error1-id = i_return-id.
it_error1-message = i_returnmessages-message.
APPEND it_error1.
CLEAR it_error1.
ENDIF.
ENDIF.
REFRESH i_returnmessages.
CLEAR it_error1.
CLEAR i_return.
ENDFORM. " extend_material
*& Form display_error_report
text
--> p1 text
<-- p2 text
FORM display_error_report .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:/Error1.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_error1
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:/Error.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_error
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_error_report
*& Form validate_material
text
--> p1 text
<-- p2 text
form validate_material .
IF NOT s_matnr[] IS INITIAL.
SELECT matnr
INTO mard-matnr
FROM mard
UP TO 1 ROWS
WHERE matnr IN s_matnr.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E115 WITH 'Invalid' mard-matnr. " Error
Message-->Invalid Parameters
ENDIF.
ENDIF.
IF NOT s_matnr[] IS INITIAL.
SELECT matnr
INTO marc-matnr
FROM marc
UP TO 1 ROWS
WHERE matnr IN s_matnr.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE s114. "Success Message -->
Data Not Available
STOP.
ENDIF.
ENDIF.
endform. " validate_material
Some frums links
gui download
Sample code for FTP download
http://www.sapdevelopment.co.uk/file/file_updownpop.htm
<b>Reward points if useful</b>
Regards
Ashu -
Downloading into a text file with comma seperation
hey experts,
well i want to download various fields of an internal table into a text file.but the hitch is that all the columns should be seperated by a comma.something like csv.
could you please help me with this.?
i have tried using gui download but the seperator field was not working.
thanks in advance...
regards,
sandra.hey sandra,
for comma seperation and downloading ,you can use the following fm.
here the i_field seperator should be given as "," as in ur case.
i_tab3 is the table from which the values are being fetched.
and i_tab2 is the table conatining the comma seperated values.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
I_TAB_SAP_DATA = I_TAB3
CHANGING
I_TAB_CONVERTED_DATA = I_TAB2
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
after this u can use the gui download fm as required.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = TESTFILNA
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'x'
HEADER = '123'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = I_TAB2
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
hope this helps u.
do reward points if useful.....:-) -
Comma seperated fields fetched in a text file
hi all,
well in the reporting context,i am lookin forward to fetch data from the internal table and then download them into a text file,the condition of retrieval of the data is that every field should be seperated by a comma in the text file,
currently i m using "gui download" function module and its giving out the fetched reords correctly,but i m not able to put a "," seperator between the fields.....
could anyone help me with this??
points will rewarded generously,,,,
thanks in advanceHi ,
Use this statement first
CONCATENATE
"Give the field name which are to be displayed with , seperator
INTO wa_final-string
SEPARATED BY ',' .
INSERT wa_final
INTO i_final INDEX 1.
Pass this tabel in gui_download.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = lwa_file
filetype = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = i_final
FIELDNAMES = FIELDNAMES
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
I hav an internal table . I want to download the data using GUI_DOWNLOAD with comma seperator. But condition is condition is i hav to convert the data into CSV format and then download.
How can i do this and send me th coding for exampleFor comma separation ,
report zcsv.
data: lt_poll type table of ypoll.
data: ls_poll type ypoll.
Changes made here
types: begin of ty_singlerow,
rowdata type string,
end of ty_singlerow.
data: lt_singlerow type table of ty_singlerow.
data: ls_singlerow type ty_singlerow.
Changes ends here
select *
from ypoll
into table lt_poll.
Changes made here
loop at lt_poll into ls_poll.
concatenate ls_poll-mandt
ls_poll-POLLID
ls_poll-TEAM
ls_poll-INITIATOR
ls_poll-DESCRIPTION
ls_poll-APPROVED
ls_poll-INITIATED_DATE
ls_poll-END_DATE
ls_poll-WINNER
into ls_singlerow-rowdata
separated by ','.
append ls_singlerow to lt_singlerow.
clear ls_singlerow.
endloop.
Changes ends here
call method cl_gui_frontend_services=>gui_download
exporting
BIN_FILESIZE =
filename = 'RESULTS_POLL.txt'
FILETYPE = 'ASC'
APPEND = SPACE
WRITE_FIELD_SEPARATOR = SPACE
HEADER = '00'
TRUNC_TRAILING_BLANKS = SPACE
WRITE_LF = 'X'
COL_SELECT = SPACE
COL_SELECT_MASK = SPACE
DAT_MODE = SPACE
CONFIRM_OVERWRITE = SPACE
NO_AUTH_CHECK = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = SPACE
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
changing
data_tab = lt_singlerow
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24
if sy-subrc <> 0.
write 'Unsuccessful'.
endif.
Maybe you are looking for
-
Method Scope variables controls Multi-Threading !
Hye there Experts ! First, let me thank you all for such a brain-stuff sharing around; feel nice to be a part here. While browsing through the below article, found something confusing...kindly clarify. http://www.javaworld.com/javaworld/jw-07-2004/jw
-
Hello Gurus!!! Presently I am into BW since 1month. I would be working on BW archiving. I finished with basics of BW from Fu Fu . I have practically implemented extraction of data from flat files,R/3 etc etc. Cud U all please suggest me which concept
-
i am not able to transfer emails from outlook 2007 in Windows 8 to outlook 2011 in Mac. I export .pst file to my hard drive from win 8 and then import in outlook 11 in mac, the folders including subfolders are created but there are hardly one email.
-
Edit The Logon Page for anonymous user
HIII frnds. I am working on concept of anonymous user. For this I have created a Anon user group and it is working succesfully . Now i have to design a Logon page for this group of users. Pls anybody help me out , becoz i have no idea that how to e
-
Bookmarks are out of order in safari 5.1.1
I can't recall exactly when this started happening (perhaps since I updated all my machines to Lion, perhaps upon a more recent update) but Safari is scrambling my bookmarks. If I drag a new bookmark to a folder it appears at the bottom of the pull