Beth Ivey Aug 21, 2007 4:57 PM I have activated and I'm using EXIT_RSAQEXCE_001 so I can run SAPQuery in background.This exit give me the "Private File" checkbox, and enables background transfer of data to application server. I finally got OPEN DATASET FOR OUTPUT working properly, and I'm using mode IN TEXT MODE ENCODING DEFAULT since it's a unicode program. Because it's unicode, and because my dataset has non char values, I get a short dump on TRANSFER DATASET v_filename. The SAP Library has Help files specific to this exit that suggest I convert the values using fieldsymbols and casting. They even have an example, but I need a little more detail than it provides. Can someone show me how to convert the non char fields of DATATAB using field symbols and casting, so that I can use this exit for any query? In other words, I can't declare a structure or itab like DATATAB because it will differ depending on the query being run. Yes, I reward ALL helpful responses. Thanks, Beth 915 Views Tags: abap Average User Rating (0 ratings) Re: Use of field symbols in EXIT_RSAQEXCE_001 /people/ars Hi, /people/arsaRs . Aug 21, 2007 5:32 PM (in response to Beth Ivey) Here is small documentation from our server. <i> As of Release 2.1D, the ABAP/4 Query has several options of passing data determined by a query on to other software products. Hence this data can be passed on to EXCEL (via the XXL interface), to SAP Business Graphics and to the Management Information System EIS, or stored as a file via the download interface. The procedure is always similar. The determined data is supplied in an internal table (data table), whose fields correspond in sequence and type to the fields which are output in the list. A further internal table (description table) contains a description of the individual fields of the data table. In addition to type and position in the list, information on the field names, for example, is contained. Both these tables are transferred to the above-mentioned products and processed further by them. As of Release 2.1D, the ABAP/4 Query also makes this interface available, so that every customer has the option to add own software products. This is the goal of the extension SQUE0001. The extension SQUE0001 consists of two components, the function module EXIT_RSAQEXCE_001 and the menu enhancement RSAQEXCE+DAT. The activation A user created a query X1 in client 03 in the user group RX. an additional parameter is displayed on the selection screen. file directory. In the ranking.1D).of the extension within a project (transaction CMOD) results in an additional interactive function (private file) being available in every report generated by the query. by whose activation the above-mentioned function module is called. all queries should be generated again since otherwise the additional parameter does not appear on the selection screen. which consists of a singlespaced basic list. In addition. statistics and a ranking. that is. without previously displaying the list.program which initiated transfer LIST_ID . After activation of the extension. in the component for maintaining queries.identifier of the transferred partial list LISTTEXT .title of the transferred partial list DATATAB . the percentage and the average are required for the field KNC1-UM01U. the following example is used. and how the values of these parameters are to be interpreted or processed is described in the following. The function module EXIT_RSAQEXCE_001 has the following parameters: PROGRAM . Since the parameter on the selection screen is called 'Private file'. graphic. Which parameters are transferred to the function module EXIT_RSAQEXCE_001.description table for the fields of the data table PROGRAM: . which. offers the possibility to carry out the additional function (private file) directly. To do this. save). the fields KNA1-KUNNR customer number KNA1-NAME1 name KNC1-UM01U sales in posting period 1 are output in this sequence. In the basic list.data table LISTDESC . A regeneration is also necessary for all queries which have already been created for a former release (before 2. ther report is generated again on the next execution of the query. The tables mentioned above (data table and description table) are basically transferred to the function module. EIS. In statistics. it is recommended that you name the menu enhancement the same (corresponds to the SAP recommendation). the fields KNA1-KUNNR customer number KNA1-NAME1 name KNC1-GJAHR fiscal year KNC1-UM01U sales in posting period 1 T001-WAERS currency key are output in this sequence. the fields KNA1-LAND1 country key KNC1-UM01U sales in posting period 1 are output in this sequence. This can be achieved by the fact that the query is selected for editing with the function Change. As a result. as for the other interactive functions (EXCEL. where in addition specifications of the number of the read records. and subsequently saved. .if DATATAB contains the data of the basic list Txx . However. From this name you can determine which query was processed. the description table (LISTDESC) always contains the description for the fields of all partial lists. On the one hand. which was allocated for the definition of the query of the corresponding partial list. If the basic list is transferred in the example. and the value R01 if the data of the ranking is transferred. a line of the data table consists of 5 fields with the following types. Every list created by a query generated list can consist of several partial lists (a basic list. several statistics. the parameter LIST_ID contains the value G00 if the data of the basic list is transferred. length 04 (KNC1-GJAHR) 4th field: type P.02. The access to individual fields of the data table is possible with the help of field symbols and the statement ASSIGN COMPONENT. you can determine which type the transferred partial list has and on the other hand. lengths and decimal places: 1st field: type C. the value T01 if the data of the statistics is transferred.02.This parameter contains the name of the query report which initiated the calling up of the function module. length 10 (KNA1-KUNNR) 2nd field: Type C..) Rxx . The data table (DATATAB) transferred to the function module only contains the data of a partial list. dec.. LIST_ID: This parameter contains an three-digit identification code for identifying the transferred data table. length 08.if DATATAB contains the data of statistics xx (01. several rankings). For this. the valid entries can be determined in the description table. Possibly available line breaks are not taken into account in lines of basic lists. The possible values of the parameter are G00 .if DATATAB contains the data of ranking xx (01. Since the structure of the data table depends on the definition of the transferred partial list. In the current example. the parameter LIST_ID has two functions.) Hence. The fields of this table correspond in sequence and type to the fields which were output in the partial list. the description table LISTDESC can be used for help. the report name is therefore AQRX03X1. such broken lines nevertheless make up a table line.. length 35 (KNA1-NAME1) 3rd field: type N. that is.. length 05 (T001-WAERS) . its structure cannot be transferred but must be determined in the function module itself.. In each case a table line corresponds to a list line. LISTTEXT: This parameter contains a text. since it always has the following structure. AQbbmmqq bb = name of the user group mm = client qq = name of the query In the current example. DATATAB: This table contains the data of the transferred partial list.. 02 (KNC1-UM01U) 5th field: type C. length 03 ID of the partial list FPOS TYPE N. length 01 number of the continuation line FCURPOS TYPE N.If the statistics are transferred. If a query consists of several partial lists (as in the current example). the description table always contains the description of the fields of all data tables (all partial lists). LISTDESC: The description table contains a description of the fields of the data table DATATAB. a line of the data table consists of 5 fields with the following types. length 04 (number of records read) 4th field: type P. length 02 number of decimal places of the field FOLEN TYPE N. length 35 (KNA1-NAME1) 4th field: type P. length 02 position of the field FCONT TYPE N. length 03 output length of the field FCUR TYPE C. dec. length 04. dec. fields of the data table of the statistics and the fields of the data table of the ranking in the current example. length 01 ABAP type of the field FLEN TYPE N. 02 (average of KNC1-UM01U) If the ranking is transferred. a line of the data table consists of 4 fields with the following types. lengths and decimal places: 1st field: type C. the description table would always contain the description of the fields of the data table of the basic list. 03 (percentage) 5th field: type P. This structure consists of the following fields: LID TYPE C. 02 (total of KNC1-UM01U) 3rd field: type I. length 16. The description table has the structure RSAQLDESC. length 16. length 03 length of the field FDEC TYPE N. which can be transferred by this query. Thus. length and number of decimal places can be determined either with the help of the ABAP statement DESCRIBE FIELD or with the help of the description table LISTDESC (see below). dec. length 06 (position in the ranking) 2nd field: type C. length 01 currency flag FADD TYPE C. lengths and decimal places: 1st field: type C. which also includes information in addition to type. length 10 (KNA1-KUNNR) 3rd field: type C. length and number of decimal places. length 01 flag for internal field FDESC TYPE C. which cannot be determined with the help of the ABAP statement DESCRIBE FIELD. length 08. 2 (total of KNC1-UM01U) The specifications on type. The appropriate entries can then be obtained from the description table via the parameter LIST_ID. dec. length 01 X = text flag for graphic FTYP TYPE C. length 03 (KNA1-LAND1) 2nd field: type P. length 03 list position of the field FGRAF TYPE C. length 40 field description (long text) . rank specification (only in rankings) C . This field is not normally needed for the private file. the table LISTDESC would have the following structure (the values of the fields FDESC are listed below). from which the data for these internal tables was obtained. The following values are possible: R .FNAME TYPE C. how they were determined for the definition of the query. FPOS describes the position of the field in the partial list indicated by LID. FCURPOS describes the start position of the field in the list line if the field is a numeric field (FTYP = P. that is. . 1. length 30 field name (source field) LID indicates which partial list of the query the described field belongs to. which is also available to the user on definition of the query. the ID for the field. Otherwise. I. FADD describes whether the field is an additional field. For all other fields FCUR has the value space. I. FCONT describes the number of the continuation line in which the field is output (0. In the current example. 02. FDEC describes the number of decimal places of the field. generated by the query itself. The same values as for the parameter LIST_ID are possible (see above).. D. FOLEN describes the output length of the field in the partial list. F). This field is not normally needed for the private file. FCURPOS has the value 000. please note that data is first gathered in an internal table. This can only occur for basic lists which are broken due to a too low list width (LINE-SIZE)..average (only in statistics) FDESC contains the field description. Thus the origin of data can be determined from this name. This field is not normally needed for the private file. FGRAF has the value X if the value of the described non-numeric field is to be used as a help text for the graphic. The numbering of the fields (according to FPOS) is not affected by it. This specification is only of interest if FTYP has the value P. The example below illustrates this. F. . In all other cases.). N.percentage rate (only in statistics) M . FDESC FNAME G00|01|0|000|X|C|010|00|010| | | 1) |KNA1-KUNNR | G00|02|0|000|X|C|035|00|035| | | 2) |KNA1-NAME1 | . P. FTYP describes the ABAP type of the field and can take the values C. The positions are counted sequentially from 1 (01. For statistics and rankings. T or X. Nevertheless. the numbering is carried out sequentially and regardless of the value of the field FCONT. FCUR marks a field as a currency amount field (F) or as a currency key or currency field (W). that is. FDEC has value 00. FLEN describes the length of the field in bytes. which was output in the partial list and is contained in the data table. FNAME contains the ABAP name of the field (source field) from which the value comes.).. the name of the field can also be determined here.number of records read (only in statistics) P .. SKIP 1. However. FCURPOS and FGRAF are discarded in the case of the table LISTDESC. for which LISTDESC-LID = LIST_ID applies. ***INCLUDE ZXQUEU01 . . this simple example clearly shows how the individual parameters are to be interpreted and how the data table can be accessed. all of the entries from the table LISTDESC are of importance. The transferred tables LISTDESC and DATATAB are in this case simply output again as a list. FIELD-SYMBOLS . PROGRAM2(2). PROGRAM6(2). where the output of the fields FCONT. A simple example of an implementation of the function module EXIT_RSAQEXCE_001 should finally be given.G00|03|0|000|X|N|004|00|004| | | 3) |KNC1-GJAHR | G00|04|0|053| |P|008|02|021|F| | 4) |KNC1-UM01U | G00|05|0|000|X|C|005|00|005|W| | 5) |T001-WAERS | T01|01|0|000|X|C|003|00|003| | | 6) |T01-KNA1-LAND1 | T01|02|0|005| |P|016|02|021|F| | 7) |T01-KNC1-UM01U | T01|03|0|027| |I|004|00|008| |C| 8) |T01-C$T-KNC1-UM01U | T01|04|0|036| |P|004|03|009| |P| 9) |T01-P$R-KNC1-UM01U | T01|05|0|047| |P|008|02|021|F|M| 10) |T01-A$G-KNC1-UM01U | R01|01|0|000| |C|006|00|008| |R| 11) |V01-RANGCT | R01|02|0|000|X|C|010|00|010| | | 12) |V01-KNA1-KUNNR | R01|03|0|000|X|C|035|00|035| | | 13) |V01-KNA1-NAME1 | R01|04|0|057| |P|016|02|021|F| | 14) |V01-KNC1-UM01U | 1) customer number 2) name 3) fiscal year 4) sales in posting period 1 5) currency key 6) country key 7) sales in posting period 1 8) total number 9) portion in % 10) average 11) rank 12) customer number 13) name 14) sales in posting period 1 When calling up the function module. NEW-PAGE LINE-SIZE 132. 'of user group'. ULINE. WRITE: / 'Query'. LOOP AT LISTDESC WHERE LID = LIST_ID. LISTDESC-FADD. LISTDESC-FOLEN. I am looking for specifics of how to use field symbols and casting to change the data type of DATATAB fields to type C.WRITE: / 'Fields of sublist'. </i> aRs Report Abuse Like (0) Re: Use of field symbols in EXIT_RSAQEXCE_001 /people/beth. but it doesn't speak to the issue I am having.holback (in response to aRs . ULINE.holback response to Beth Ivey) /people/beth. LISTDESC-FDEC. ULINE. 2007 7:18 PM (in . LISTDESC-FTYP.holbackBeth Ivey Aug 21. LISTDESC-FCUR. I am already familiar with that documentation from the SAP Library. ENDLOOP. WRITE: / 'Data table'. LISTDESC-FLEN. LISTDESC-FPOS. 2007 5:57 PM Yes.) /people/beth. WRITE: / LISTDESC-FDESC. NEW-LINE. LOOP AT DATATAB. SKIP 1. Report Abuse Like (0) Re: Use of field symbols in EXIT_RSAQEXCE_001 /people/beth.holbackBeth Ivey Aug 23. LIST_ID. LISTDESC-FNAME. loop at datatab. if listdesc-ftyp ne 'P' and listdesc-ftyp ne 'D' and listdesc-ftyp ne 'I'. Here's how I did it. if sy-subrc ne 0. assign (lv_field) to <fs_fld>. if not lv_filename is initial. lv_string. loop at listdesc. lv_tab = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB. in case someone needs it someday: Data: lv_field(30). elseif sy-tabix = lv_count. condense lv_field. lv_tmpchar = <fs_fld>. lv_tab. concatenate lv_string <fs_fld> lv_tab into lv_string. concatenate <fs_fld> lv_tab into lv_string. open dataset lv_filename for output in text mode encoding default. describe table listdesc lines lv_count. field-symbols: <fs_fld> type any. clear: lv_field. lv_count type i. assign lv_tmpchar to <fs_fld>. endif. lv_string type string. lv_strlen type i. concatenate 'DATATAB-' listdesc-fname into lv_field. assign (lv_field) to <fs_fld> . message e999(z1) with 'open dataset failed'. if sy-tabix = 1. .Figured it out on my own. elseif sy-tabix < lv_count. lv_tmpchar(255) type c. condense lv_tmpchar. else. endif. ly/SCNFB http://bit. comment.ly/SCNLnI Follow SCN Site Index Contact Us SAP Help Portal Privacy Terms of Use http://www. close dataset lv_filename.epx .ly/SCNyouT http://bit. Login Register http://bit. transfer lv_string to lv_filename length lv_strlen. endloop. share and bookmark content. like. Report Abuse Like (0) Go to original post Tweet Actions Login to follow.ly/SCNTwR http://bit. endloop.com/corporate-en/our-company/legal/impressum.sap. endif.lv_strlen = strlen( lv_string ). Pattern for FM EXIT_RSAQEXCE_001 .02. " EXIT_RSAQEXCE_001 .EXIT RSAQEXCE 001 Associated Function Group: XQUE Released Date: 02.1994 CALL FUNCTION 'EXIT_RSAQEXCE_001' "SAP Query: Private data file EXPORTING listtext = list_id = program = TABLES datatab = listdesc = " Data table List description "c Title of the passed sub-list " rsaqldesc-lid ID of passed sub-list " sy-repid Program which generated the list " rsaqldesc .