GUI_DOWNLOAD field names problem
Hi,
I have a problem with the haederline with the column names in the downloaded file.
I'm using the function GUI_DOWNLOAD in the following way:
DATA: ls_fieldnames TYPE it_fieldnames,
lt_fieldnames TYPE STANDARD TABLE OF it_fieldnames.
ls_fieldnames-fieldname = 'Column1'.
APPEND ls_fieldnames TO lt_fieldnames.
ls_fieldnames-fieldname = 'Column2'.
APPEND ls_fieldnames TO lt_fieldnames.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_fname
filetype = 'DAT'
codepage = '4103'
TABLES
data_tab = lt_table
fieldnames = lt_fieldnames
The problem now is, that the header line is shown a several times in the text file. that means, it appears at very first (as it should), but also appears a several times between the data lines again.
Does anyone have any idea what the problem is?
Thank you!
Hi,
If you are downloading the file into an EXCEL you can use the filetype 'DAT'.
Here you are downloading into an Text file. So please try with the Filetype 'ASC'.
Please try with this and also see what the pagecode 4103 does.
With Regards,
Sumodh.P
Similar Messages
-
Hi Mentors,
I am creating a z report in that one perticular field i want new value, old value details.
Field is in MMR - Foreigh trade import - CAS numner (pharma) this field we are using for material status.( ex. A,B,C)
Table Name - MARA Fiels name - CASNR
This status we will change every three months. so when i am taking the report i need old value and new value status.
For new value i will get from MARA-CASNR But, where i will find the old value table.
Ex. if i edit master record MM02 and go to top - environment-dispay changes- in that i am finding the chage details, if i choose the details option i am getting old value and new value details.
pls help me any one to find the old value details.
Highly appreciated any solution
award points if use ful answer
Regards
LaxmanHi Laxman,
I have found one program Please check the same.
*& Report ZAK_MM_CHANGE_HISTORY *
REPORT ZAK_MM_CHANGE_HISTORY .
TABLES:
CDHDR, CDPOS, MARA, MAKT, MARD.
FIELD-GROUPS: HEADER.
DATA: BEGIN OF CHGDOC OCCURS 50.
INCLUDE STRUCTURE CDRED.
DATA: END OF CHGDOC.
DATA:
CHGTYPE(1),
PLANT(4),
MATNR1 LIKE CHGDOC-OBJECTID.
SELECT-OPTIONS:
XMATNR FOR CDHDR-OBJECTID, "Material
XUDATE FOR CDHDR-UDATE, "Change Date
XUNAME FOR CDHDR-USERNAME, "User Name
XTCODE FOR CDHDR-TCODE, "Transaction Code
XWERKS FOR MARD-WERKS. "Plants
SELECTION-SCREEN SKIP.
*Filter change type
SELECTION-SCREEN BEGIN OF BLOCK CHG0 WITH FRAME TITLE TEXT-001.
PARAMETERS : XCHG1 AS CHECKBOX DEFAULT 'X',
XCHG2 AS CHECKBOX DEFAULT 'X',
XCHG3 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK CHG0.
START-OF-SELECTION.
INSERT:
CHGDOC-OBJECTID "Material
CHGTYPE "Change type
PLANT
CHGDOC-CHANGENR
CHGDOC-USERNAME
CHGDOC-UDATE
CHGDOC-TCODE
CHGDOC-TABNAME
CHGDOC-TABKEY
CHGDOC-CHNGIND
CHGDOC-FNAME
CHGDOC-FTEXT
CHGDOC-TEXTART
CHGDOC-OUTLEN
CHGDOC-F_OLD
CHGDOC-F_NEW
INTO HEADER.
SELECT * FROM MARA WHERE MATNR IN XMATNR.
MATNR1 = MARA-MATNR.
CALL FUNCTION 'CHANGEDOCUMENT_READ'
EXPORTING
ARCHIVE_HANDLE = 0
CHANGENUMBER = ' '
DATE_OF_CHANGE = '00000000'
OBJECTCLASS = 'MATERIAL'
OBJECTID = MATNR1
TABLEKEY = ' '
TABLENAME = ' '
TIME_OF_CHANGE = '000000'
USERNAME = ' '
LOCAL_TIME = ' '
TABLES
EDITPOS = CHGDOC
EXCEPTIONS
NO_POSITION_FOUND = 1
WRONG_ACCESS_TO_ARCHIVE = 2
TIME_ZONE_CONVERSION_ERROR = 3
OTHERS = 4.
LOOP AT CHGDOC.
CHECK: CHGDOC-UDATE IN XUDATE,
CHGDOC-USERNAME IN XUNAME,
CHGDOC-TCODE IN XTCODE.
Chg type: 1. Part revision, 2. Price change, 3. Others
CASE CHGDOC-TCODE.
WHEN 'MM01' OR 'MM02' OR 'MM03'. CHGTYPE = '1'.
WHEN 'MR21'. CHGTYPE = '2'.
WHEN OTHERS. CHGTYPE = '3'.
ENDCASE.
Filter chg type
IF ( CHGTYPE = '1' AND XCHG1 <> 'X' ) OR
( CHGTYPE = '2' AND XCHG2 <> 'X' ) OR
( CHGTYPE = '3' AND XCHG3 <> 'X' ).
CONTINUE.
ENDIF.
Plant is a substring of tabkey
PLANT = CHGDOC-TABKEY+21(4).
IF NOT ( XWERKS IS INITIAL ) AND NOT ( PLANT IS INITIAL ).
CHECK PLANT IN XWERKS.
ENDIF.
EXTRACT HEADER.
ENDLOOP.
ENDSELECT.
END-OF-SELECTION.
SORT.
LOOP.
Material
AT NEW CHGDOC-OBJECTID.
SELECT SINGLE * FROM MAKT WHERE MATNR = CHGDOC-OBJECTID.
FORMAT INTENSIFIED ON.
SKIP. SKIP.
WRITE:/' *** Material:', (18) CHGDOC-OBJECTID, MAKT-MAKTX.
ENDAT.
Change type
AT NEW CHGTYPE.
FORMAT INTENSIFIED ON.
SKIP.
CASE CHGTYPE.
WHEN '1'. WRITE:/ ' ** Change type: PARTS REVISION'.
WHEN '2'. WRITE:/ ' ** Change type: PRICE CHANGE'.
WHEN '3'. WRITE:/ ' ** Change type: OTHERS'.
ENDCASE.
SKIP.
ENDAT.
SHIFT CHGDOC-F_OLD LEFT DELETING LEADING SPACE.
SHIFT CHGDOC-F_NEW LEFT DELETING LEADING SPACE.
FORMAT INTENSIFIED OFF.
WRITE:
/ PLANT UNDER 'Plant',
(50) CHGDOC-FTEXT UNDER 'Field',
(45) CHGDOC-F_OLD UNDER 'Old value',
(45) CHGDOC-F_NEW UNDER 'New value'.
AT NEW CHGDOC-CHANGENR.
FORMAT INTENSIFIED OFF.
WRITE:
CHGDOC-CHANGENR UNDER 'Change doc',
CHGDOC-TCODE UNDER 'Tcod',
CHGDOC-USERNAME UNDER 'User name ',
CHGDOC-UDATE UNDER 'Date ' DD/MM/YY.
ENDAT.
AT END OF CHGDOC-OBJECTID.
SKIP.
ULINE.
SKIP.
ENDAT.
ENDLOOP.
TOP-OF-PAGE.
WRITE: / SY-DATUM, SY-UZEIT,
50 'ABC PTE LTD',
100 'page', SY-PAGNO,
/ SY-REPID,
48 'Change Documents Report',
100 SY-UNAME.
SKIP.
ULINE.
WRITE:/3
'Change doc',
'Tcod',
'User name ',
'Date ',
'Plant',
(50) 'Field',
(45) 'Old value',
(45) 'New value'.
ULINE.
Go to SE38 Create one Z report and paste the program without disturbing anything and execute. If it doesnot show any values in this report use Leading zeros formulae ieGive material no like 000000000000100222 etc. Try this i have tried in my system and its working.
Reg,
Ashok
Assign points if useful. -
Internal table field name problem
Dear All,
I am declaring one internal table & fetching data using inner join. Following is my structure of internal table but it is not fetching data into MATNR1, the data is there in the table.
Kindly suggest why this is happening?
Regards,
Dilip Gupchup
internal table
data : begin of sales_to_purchase_link_itab occurs 10,
*******FOR P O RELATED INFORMATION
EBELN LIKE EKKN-EBELN,"DOCUMENT NO
AEDAT LIKE EKPO-AEDAT,"P O DATE
EBELP LIKE EKKN-EBELP," ITEM
MATNR LIKE EKPO-MATNR,"MATERIAL
MENGE LIKE EKKN-MENGE,"QUANTITY
SAKTO LIKE EKKN-SAKTO,"G/L Account Number
NETWR LIKE EKKN-NETWR,"Net order value in PO
*******END FOR P O RELATED INFORMATION
*******FOR SALES ORDER RELATED INFORMATION
VBELN LIKE EKKN-VBELN,"SALES DOC NO
VBELP LIKE EKKN-VBELP,"SALES DOC ITEM
MATNR1 LIKE VBAP-MATNR,"SALES MATERIAL
ERDAT LIKE VBAP-ERDAT,"SALES DOC DATE
ARKTX LIKE VBAP-ARKTX,"MATERIAL DESCRIPTION
ZMENG LIKE VBAP-ZMENG,"QUANTITY
NETPR LIKE VBAP-NETPR,"SALE VALUE
*******FOR SALES ORDER RELATED INFORMATION
end of sales_to_purchase_link_itab.
select query
select
ekkn~ebeln
EKKN~EBELP
EKKN~SAKTO
EKKO~AEDAT
ekko~bukrs
EKPO~MATNR
EKPO~MENGE
EKPO~NETWR
vbap~vbeln
ekkn~vbelp
vbap~arktx
VBAP~MATNR
into corresponding fields of table
sales_to_purchase_link_itab from ekkn
inner join ekko on ekknebeln eq ekkoebeln "UP TO 10 ROWS.
INNER JOIN EKPO ON EKKOEBELN EQ EKPOEBELN
inner join vbap on ekknvbeln eq vbapvbeln
WHERE
EKPO~AEDAT IN S_ERDAT1.Hi,
or change your coding like that:
DATA rep LIKE sy-repid.
TYPE-POOLS : slis.
DATA : fcat TYPE slis_t_fieldcat_alv.
DATA wa TYPE slis_fieldcat_alv.
DATA : BEGIN OF fld OCCURS 0,
name(50),
END OF fld.
rep = sy-repid.
*only possible if fields of itab are defined with LIKE !
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = rep
i_internal_tabname = 'SALES_TO_PURCHASE_LINK_ITAB'
i_client_never_display = 'X'
i_inclname = rep
CHANGING
ct_fieldcat = fcat.
LOOP AT fcat INTO wa.
CONCATENATE wa-ref_tabname '~' wa-fieldname INTO fld-name.
APPEND fld.
ENDLOOP.
SELECT (fld)
INTO TABLE sales_to_purchase_link_itab
FROM ekkn
INNER JOIN ekko ON ekkn~ebeln EQ ekko~ebeln "UP TO 10 ROWS.
INNER JOIN ekpo ON ekko~ebeln EQ ekpo~ebeln
INNER JOIN vbap ON ekkn~vbeln EQ vbap~vbeln
WHERE
ekpo~aedat IN s_erdat1.
Andreas -
Not able to download the field names in GUI_DOWNLOAD(very urgent)
Hi All,
I am downloading the file contents to the presentation server.i am able to get the file contents proeprly but not able to download the field names into text file.
Can anybody please help me in this issue..? its very urgent. Valuable answers will be rewarded.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = w_filename
filetype = 'DAT'
write_field_seperator = c_x
col_select = c_x
COL_SELECT_MASK = t_mask
TABLES
data_tab = t_tab
fieldnames = t_colnames
EXCEPTIONS
Thanks & Regards,
Satish.Hi,
I have tried in both ways its not working.
while a ran the program it is going to the dump.
I am working in mySAP ECC6.0
Can pl you suggest other way..
Thanks & Regards,
Satish. -
HOW TO KEEP FIELD NAMES IN GUI_DOWNLOAD
Hai,
can u answer this.HI ravi,
pass all the column names in an internal table and pass the internal table in the field names parameter of the FIELDNAMES of tables parameters..
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES = it_fieldnames
PLS CHECK THE SIMPLE CODE BELOW...
data: begin OF itab occurs 0,
matnr like mara-matnr,
end of itab.
data : begin of it_fieldnames occurs 0,
name(100),
end of it_fieldnames.
it_fieldnames-name = 'MATNR'.
APPEND IT_FIELDNAMES.
select matnr from mara into table itab UP TO 10 ROWS.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Documents and Settings\sampath\Desktop\flatfile.txt'
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 =
TABLES
DATA_TAB = itab
FIELDNAMES = IT_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 a bit,
all the best,
regards,
sampath
mark helpful answers
Message was edited by:
sampath pilla -
Problem using alias field names in a sql query
Hello,
I have a question regarding a simple Oracle database SQL query writeup:
In the following (badly written but properly working) SQL query:
Query 1:
select
soe.field1,
(soe.field2 + soe.field3) as field4,
(soe.field5 - (soe.field2 + soe.field3)) as field6,
(select comp.parValue*soe.field7
from
CompTable comp) as parValue,
(select soe.field8 - (comp.parValue*soe.field7+ soe.field9)
from
CompTable comp) as field10
from
SomeTable soe
PROBLEM 1:
I am re writing the code (soe.field2 + soe.field3) to get the alias field4 or column name field4 that I have created on the fly in the previously for use with the following fields. Can't I rewrite the query as follows. There is something simple missing!
Query 2:
select
soe.field1,
(soe.field2 + soe.field3) as field4,
soe.field5 - field4 as field6, <<< field4 does not work here
(select
comp.parValue*soe.field7
from
CompTable comp) as parValue,
(select
soe.field8 - (comp.parValue*soe.field7+ soe.field9)
from
CompTable comp) as field10
from
SomeTable soe
PROBLEM 2:
Similar to the above problem, I was thinking to get a field parValue out of the CompTable table and re-use many times rather than the code shown in Query 1:
Query 3:
select
soe.field1,
(soe.field2 + soe.field3) as field4,
soe.field5 - field4 as field6,
soe.field7* (select comp.parValue from CompTable comp) as parValue1,
soe.field8 - (parValue1*soe.field7+ soe.field9) as field10 <<<< parvalue1 does not work here
parValue1*soe.field9 as TaxCondition <<<< parvalue1 does not work here
from
SomeTable soe
See that the query becomes so simple, but the above query does not work. There is something fundamentally wrong in my usage of the alias field names in creating other fields. The Query1 seems to be the only working option but its very slow as I am redoing and re-writing the whole code again and again to get the parValue field out of the CompTable table for use to create many other fields.
I will appreciate if you can guide me in the right direction on this issue.
Thanks and Regards
RamaSELECT tmp.contract_no, tmp.Actual, tmp.Actual - tmp.NbHours
FROM ( SELECT t.contract_no, sum(l.hrs) AS Actual, (c.labour_hours * c.labour_progress_per) / 100 AS NbHours
FROM TASK_DELEGATION t
INNER JOIN COST_CODE c
ON t.cost_code = c.cost_code AND t.contract_no = c.contract_no AND t.is_inactive=0
INNER JOIN Labour.dbo.LABOURALLOT l
ON l.contractNo = c.contract_no AND l.costcode = c.cost_code AND l.pm = 'N'
GROUP BY t.contract_no, c.labour_hours, c.labour_progress_per
) tmp -
Sql Problems, Same Field Names In Multiple Mysql Tables?
I have a keyword search that searches multiple DB tables for thumbnail images using UNION ALL. I have two pages, results.php, and view.php. My goal is to able to click a thumbnail image on results.php and be directed to a larger version of that same image on view.php. The problem is each image in all my tables uses the field name "id" so when I click a thumbnail on results.php I get two different images with the same id from different tables. I tried changing the id's to different names, but when it was time to pass url parameters I can only choose 1 value. (if you can choose more than 1 I don't know how). So my question is why are my id's from different tables being grouped together, and how can I change this?
Image Results Page (which works perfect):
SELECT *
FROM table1
WHERE keyword LIKE %colname% OR id LIKE %colname%
UNION ALL
SELECT *
FROM table2
WHERE keyword LIKE %colname% OR id LIKE %colname%
View Image Page (having problems here):
SELECT *
FROM table1
WHERE id = colname
UNION ALL
FROM table2
WHERE id = colnameYes, that is going to be a problem - and it's just the beginning of your problems when you do not normalize your data. Your data model is not correct. You should not be storing similar data in 15 tables - it's a really big mistake.
To solve your current problem you would need to include a table identifier in the query results in the Image results page, and pass that to the view page and then use PHP to dynamically create the SQL with the correct table....ugh! -
Problem in key field name in FCC
hi,
I am using FCC on the sender side.
Source file is
1;;PY;X101;20060630;06;20060630;GBP;Ref.1;Payroll June 2006; (Header)
1;1;40;S2225000;;1050;;;;;;;;;;;;;;;X101003;;;;;;;;;;;;;;;
1;2;240;S2225000;;4563;;;;;;;;;;;;;;;X101004;;;;;;;;;;;;;;;
1;3;31;3100001;;5013;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1;4;31;3100002;;600;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2;;PY;X101;20060630;06;20060630;GBP;Ref.2;Payroll June 2006; (Header)
2;1;40;S2225000;;530;;;;;;;;;;;;;;;X101003;;;;;;;;;;;;;;;
2;2;40;S2225000;;2490;;;;;;;;;;;;;;;X101004;;;;;;;;;;;;;;;
2;3;31;3100002;;3020;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
The first field in the header is the key field to identify the header, which keeps incrementing for evry occurence of the header.
So for the first occurence of the header first field of header will be 1, first field of item will be 1( same as header) and second field of item will be the key field now which will increment with evry occurence of item within the header.So there is no constant value for key field name.
So how do i perform FCC for this type of structure?
Regards,
LoveenaHi,
You can create a custom Adapater Module and add it in your Sender Adapter. This will add a Unique Identifier to your Header and Record item which you can give in FCC.
For more details refer to this forum
https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=6143385
Thanks
Amit -
Prepared statement problem using a field name that contains a "?"
I am attempting to execute the following query via use of a PreparedStatement:
select [Spread_By_Cost_Center?], Debit_Category, Credit_Category, Start_Date, End_Date, Allocation_Type From ALLOCATION_FORMULA Where FormulaID = ?
The query fails with the following message:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT
field incorrect
However, I can run this query directly in MS-ACCESS, using a value for the substitution parameter (i.e., FormulaID = 1)
If I remove the "Spread_By_Cost_Center? field from the query within the PreparedStatement, the PreparedStatement query executes successfully.
So, it would appear that the "?" in the field name is possibly being treated as a substitution parameter. Is this a bug within PreparedStatement? I do not want to use a Statement object, as the PreparedStatement provides a much more elegant solution (when it works).
Any suggestions?That may be so, but as I see it there are two alternatives:
1. Wait for the "bug" to be fixed.
2. Change the database to use less problematic column names.
I know which alternative I would choose. -
Problem with column/field names in Oracle resultset being UPPERCASE
Hi everyone,
I understand that Oracle DBMS returns all the field names in UPPERCASE in the result set. However this is undesired for my application and I was wondering if there is any workaround for getting the field names in the application in exactly the same format as your select query. Is there any set method which can be called before to control this behavior.
E.g. select ename as employeename from table_name;
ORACLE RETURNS --> EMPLOYEENAME
Required --> employeename
Please help me
..VinitVinit,
You can use column aliases in your query -- see Oracle SQL Reference for more details.
Then you can set some connection property in Oracle JDBC that allows you to obtain the column alias (I think). Check the Oracle JDBC User's Guide and Reference for more details.
Good Luck,
Avi. -
CFUPDATE problem with field name beginning with a number
I have a form (actually several) that is gathering data for a survey. I tried to use cfupdate to update the data elements and got a string index out of range error. I tested again without the form fields that began with numbers and it worked just fine. I then tried to enclose the offending field names in () and []. Both times I got same error. Does anyone have a work around for this? The code and error are below.
Changing the field names is not really an option. This survey has almost 400 data points and most of the fields begin with the question number.
Thanks
DW
<cfupdate datasource="#application.fdp_datasource#" tablename="arra_survey1" dbtype="ODBC" formfields = "entry_no, 2_a_fy09, '2_a_fy10', '2_a_fy11', '2_a_fy12', '2_b_fy09', '2_b_fy10', '2_b_fy11', '2_b_fy12', '2_c_fy09', '2_c_fy10', '2_c_fy11', '2_c_fy12', '2_d_fy09', '2_d_fy10', '2_d_fy11', '2_d_fy12', '2_e_fy09', '2_e_fy10', '2_e_fy11', '2_e_fy12', '2_f_fy09', '2_f_fy10', '2_f_fy11', '2_f_fy12', '2_g_fy09', '2_g_fy10', '2_g_fy11', '2_g_fy12', '2_h_fy09', '2_h_fy10', '2_h_fy11', '2_h_fy12', '2_i_fy09', '2_i_fy10', '2_i_fy11', '2_i_fy12', '2_j_fy09', '2_j_fy10', '2_j_fy11', '2_j_fy12', '2_k_fy09', '2_k_fy10', '2_k_fy11', '2_k_fy12', '2_l_fy09', '2_l_fy10', '2_l_fy11', '2_l_fy12', central_office, dept_office, incl_other, 3_a_fy09, 3_a_fy10, 3_a_fy11, 3_a_fy12, 3_b_fy09, 3_b_fy10, 3_b_fy11, 3_b_fy12, 3_c_fy09, 3_c_fy10, 3_c_fy11, 3_c_fy12, 3_d_fy09, 3_d_fy10 3_d_fy11, 3_d_fy12, 3_e_fy09, 3_e_fy10, 3_e_fy11, 3_e_fy12, 3_f_fy09, 3_f_fy10, 3_f_fy11, 3_f_fy12, 3_g_fy09, 3_g_fy10, 3_g_fy11, 3_g_fy12, 3_h_fy09, 3_h_fy10, 3_h_fy11, 3_h_fy12, 3_i_fy09, 3_i_fy10, 3_i_fy11, 3_i_fy12, 3_j_fy09, 3_j_fy10, 3_j_fy11, 3_j_fy12, 3_k_fy09, 3_k_fy10, 3_k_fy11, 3_k_fy12, 3_l_fy09, 3_l_fy10, 3_l_fy11, 3_l_fy12">
String index out of range: -2
The error occurred in C:\Inetpub\wwwroot\directory\process_arra_suvey_2.cfm: line 12
12 : <cfupdate datasource="#application.fdp_datasource#" tablename="arra_survey1" dbtype="ODBC" formfields = "entry_no, 2_a_fy09, '2_a_fy10', '2_a_fy11', ...I think you have run one of CFUPDATE's limitations. I am not 100% certain, but I do not think cfupdate provides a way to escape invalid column names like yours. In which case you may need to do a regular UPDATE within a cfquery instead... or rename your columns.
fields that began with numbers
Most databases discourage creating column names that start with a number (or other restricted characters). While many databases will allow you to escape invalid names, it is simpler all around to avoid them altogether. Otherwise, you may have to escape the names in every single query. The recommendations vary, but usually object names that begin with a letter, and contain only letters, numbers and underscores are considered safe.
This survey has almost 400 data points and most of the fields begin with the question number.
Four-hundred (400) is a lot of columns for a single table. The fact that they all them seem to contain the same type of information (ie response to a question) is an indication that data should probably be stored in a separate table, as rows, not columns. For example questions could be stored in one table, possible answers in another, and the results of an individual test/survey stored in a third table. A structure like that is much easier to query, can easily accommodate changes (add/remove questions, responses, etcetera) without having modify the table every time. -
Problem getting field names with OCI
Hi,
I am trying to retrieve the names of select fields through the
OCI using OCIParamGet() followed by OCIAttrGet(). This seems to
work OK, in most cases, except occasionally I get one field name
concatenated to the following field name.
Has anyone else seen this before, and if so, how do you get
around it? Let me know if you need more details.
Thanks in advance.
Tim
nullThat worked. Thanks!
Peter Kls (guest) wrote:
: Timothy Sim (guest) wrote:
: : Hi,
: : I am trying to retrieve the names of select fields through
the
: : OCI using OCIParamGet() followed by OCIAttrGet(). This seems
to
: : work OK, in most cases, except occasionally I get one field
: name
: : concatenated to the following field name.
: Try evaluating the string length returned by the OCIAttrGet
call.
: The name string is not (always) \nul terminated.
: : Thanks in advance.
: : Tim
: good luck
: Peter
null -
Field names Missing in the (Excel) Mail attachment
Hi ,
I am trying to send my ALV Grid Output as Excel Email attachment using the below code
The problem is that the field names are missing in the receivers Mail.
i.e
*Name* *Emp Code* * Branch* "this is missing
abc 123 ukp
I searched many threads but unable to find the solution for this.
Kindly suggest me regarding this issue.
loop at p_eadd.
if p_eadd-low <> space.
clear reclist.
reclist-rec_type = 'U'. "Internet-adress
reclist-receiver = p_eadd-low.
reclist-express = 'X'.
append reclist.
endif.
endloop.
* endif.
* Send the document
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_type = 'RAW'
document_data = doc_chng
* PUT_IN_OUTBOX = 'X'
tables
object_content = objcont
receivers = reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
ld_aplstat = '4'.
case sy-subrc.
when 0.
loop at reclist.
if reclist-receiver = space.
name = reclist-rec_id.
else.
name = reclist-receiver.
endif.
if reclist-retrn_code = 0.
write: / name, ': succesfully sent'.
else.
write: / name, ': error occured'.
endif.
endloop.
ld_aplstat = '0'.
when 1.
write: / 'Too many receivers specified !'.
when 2.
write: / 'No receiver got the document !'.
when 4.
write: / 'Missing send authority !'.
when others.
write: / 'Unexpected error occured !'.
endcase.
*.Tell workflow to go on
clear ls_scma_event.
ls_scma_event-wf_event = cs_wf_events-finished.
ls_scma_event-wf_witem = wf_witem.
ls_scma_event-wf_okey = wf_okey.
call function 'KPEP_MONI_CLOSE_RECORD'
exporting
ls_key = gs_key
ls_scma_event = ls_scma_event
changing
ld_aplstat = ld_aplstat
exceptions
no_id_given = 1
others = 2.
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
i_field_seperator = ' '
i_line_header = 'X'
i_filename = p_file
* I_APPL_KEEP = ' '
tables
i_tab_sap_data = it_final
* CHANGING
* I_TAB_CONVERTED_DATA =
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.
Thanks in Advance,
Mr. BenHi Ben,
Follow the code below....
Your internal table it_final will have the attachment data. After you got the attachment data do the following
gc_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
lt_attachment TYPE TABLE OF solisti1 ,
gt_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE,
CLEAR:gs_attach. <this will have your attachment, declare a structure which contains fields of your excel sheet>
<before this you have to copy all the fields from your final internal table which should be attached to email to gs_attach>
For attaching field names
CONCATENATE gc_ret gs_attach INTO gs_attach.
gs_attach = gs_attach+1.
APPEND gs_attach TO gt_attach.
CLEAR:lt_attachment.
lt_attachment[] = gt_attach[].
SORT lt_attachment .
DELETE ADJACENT DUPLICATES FROM lt_attachment COMPARING ALL FIELDS.
CLEAR gs_attach.
CONCATENATE <field names >
INTO gs_attach SEPARATED BY gc_tab.
INSERT gs_attach INTO lt_attachment INDEX 1.
<field addition ends>
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_type = 'RAW'
document_data = doc_chng
PUT_IN_OUTBOX = 'X'
tables
object_content = objcont
receivers = reclist
contents_bin = lt_attachment
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
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,
Aravind. -
Getting an object's field name
In the snippet of code shown below, 'parent' represents a UI dialog, and 'child' represents one of the components of the dialog. What I would like to know is the field name of 'child'. The variable 'fieldName' would contain the name I am seeking, if I knew how to determine the value of 'ii' that corresponds to the object 'child'.
I hope you can help.
Thanks,
Miguel
String getFieldName(Object parent,Component child) {
Class cl = parent.getClass();
Field [] fields = cl.getDeclaredFields();
String fieldName = fields[ii].getName();
// problem: how to get 'ii' that corresponds to 'child'?
return fieldName;
}Is there a way to get the
corresponding array of component objects? It depends on the way the "parent" class is defined.
For example (a BAD example, but an example):
I could have the parent keep it's components in a HashMap, with a key of the component type and a value of an ArrayList that contains each component matching the component type.
This would be very annoying to deal with, and hard to find any given component (whether reflectively or with normal code).
If I can get
the value of a field (Object val =
field.get(parent);), there must be a way to get the
reference to the object that correspond to the pair
'field','parent'.
Thanks.Huh?
What do you think field[1].get(parent) returned?
It's the value that the field is referring to (e.g. the actual object refered to by the field).
I think dubwai's questions about "what are you trying to do" are very relevant. Using reflection like this usually means the design is lacking some important functionality -
Field names are not coming in file when dloaded frm apserv to prserv
Here i'm dloading data to Appserver..frm there data is dloading to pre server..but fieldnames are downloading...i am working in 4.6c version.same code is working in ECC version...Plzz give me a suggestion...
FORM dload_file_from_server USING p_srfname "#EC *
p_fname "#EC *
p_psfile "#EC *
p_flag.
DATA: lv_fname TYPE string.
CASE p_flag.
WHEN 'MSEG'.
ASSIGN it_fn TO <fn>.
ASSIGN wa_fn TO <fn_wa>.
ASSIGN it1_mseg TO <fs>.
ASSIGN wa1_mseg TO <fs_wa>.
ASSIGN p_srfname TO <fs_fname>.
CONCATENATE p_psfile p_fname INTO lv_fname SEPARATED BY '\'.
WHEN 'MKPF'.
ASSIGN it_fn TO <fn>.
ASSIGN wa_fn TO <fn_wa>.
ASSIGN it1_mkpf TO <fs>.
ASSIGN wa1_mkpf TO <fs_wa>.
ASSIGN p_srfname TO <fs_fname>.
CONCATENATE p_psfile p_fname INTO lv_fname SEPARATED BY '\'.
WHEN OTHERS.
ENDCASE.
OPEN DATASET <fs_fname> FOR INPUT IN TEXT MODE ENCODING DEFAULT.
READ DATASET <fs_fname> INTO <fn_wa>.
APPEND <fn_wa> TO <fn>.
DO.
IF sy-tabix GE 1.
READ DATASET <fs_fname> INTO <fs_wa>.
IF sy-subrc = 0.
APPEND <fs_wa> TO <fs>.
ELSE.
EXIT.
ENDIF.
ENDIF.
ENDDO.
CLOSE DATASET <fs_fname>.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_fname
filetype = 'ASC'
trunc_trailing_blanks = 'X'
trunc_trailing_blanks_eol = 'X'
TABLES
data_tab = <fs>
fieldnames = <fn>.
IF sy-subrc <> 0. "#EC
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: <fn>, <fn_wa>.
ENDFORM. " dload_file_from_server
Please use code tags - it makes your code easier to read
Edited by: Rob Burbank on Dec 6, 2010 4:00 PMHi,
I think for 4.6 C <fn> must be declared as an internal table and the field names should be given as records and not as one single record.
the fieldnames internal table should contain records as :
Field1
Field2 .... and not as Field1 Field2 ....
Regards,
Srini.
Maybe you are looking for
-
Can't get 2164 pictures off iPhone
At this point I have 2164 pictures I've taken with my iPhone, but I can't get a single photo off the phone via the USB connection (I can email a few, but this is not only extremely time consuming, but not very practical) and I need to get a few hundr
-
Where I can download Acrobat Standard 9
I have license with Acrobat Standard 9, but my CD was crash, and none of my friend has the CD. Could anyone tell me where I can download the file, please?
-
Getting no result while executing RFC-enabled function module
Hi folks, Iam having a remote-enable function module which divides two numbers and gives out the result. For this i have created two import parameters A and B of type CHAR10 and one export parameter C. In the source code i've given the code as C = A
-
Icloud won't send mail to my computer
Icloud sends mail to my phone, but not to my computer.
-
Here's what I have on my PC!
Hi! Time to be just a little crazy here on the forum. These are the programs that old Dokie runs on his computer. I run MSE and MBAM in real time. To me Toshiba is a great company. I love my Toshiba laptop. I love the Toshiba forum. There are some g