2007 Sep 03 9:27 AM
Hi,
i have some programs which have upload/download functionality. To do this, the PC path is stored in a parameter of type localfile. This type is declared as CHAR 128, which is definitly too short when dealing with UNC paths (like
servername\path1\path2\complicatedname\etc...).
So im looking for an alternative for the type localfile.
One possibility is to take string, with the disadvantage that i have a selection field in every program which i have to translate over and over again for every report.
I can write my own type of course, but is there really no type for variables holding pc paths predefined by SAP?
//Rainer
2007 Sep 03 9:35 AM
Hi,
Even the RLGRAP-FILENAME is of length 128..
I think you can use CHAR2000 as data type..
Even I had a problem and I used CHAR2000 its a dataelement of length 2000 characters.
rewards if useful,
regards,
nazeer
Hi,
Even the RLGRAP-FILENAME is of length 128..
I think you can use CHAR2000 as data type..
Even I had a problem and I used CHAR2000 its a dataelement of length 2000 characters.
rewards if useful,
regards,
nazeer
2007 Sep 03 9:30 AM
parameter : p_file type rlgrap-filename.rlgrap is the structure you are looking for.
Regards
Gopi
2007 Sep 03 9:35 AM
Hi
p_file TYPE rlgrap-filename value 'TEST3.txt'.
u can use like this also
&----
*& Report ZSD_EXCEL_INT_APP
*&
&----
*&
*&
&----
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
reward if usefull
2007 Sep 03 9:35 AM
Hi,
Even the RLGRAP-FILENAME is of length 128..
I think you can use CHAR2000 as data type..
Even I had a problem and I used CHAR2000 its a dataelement of length 2000 characters.
rewards if useful,
regards,
nazeer
2007 Sep 03 10:15 AM
2000 should be really enough, but as i wrote first i want to avoid declaring the translation of the selection field over and over again. But as far as i can see there is no way around that. May be it is possible to copy localfile to my own type, keeping the translations and just changing the length of the field.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |