Internal table in ABAP Query
Hi all,
Can we use internal table in ABAP/SAP Query (Infoset - SQ02)? If yes, Pls guide me on the same.
Thanks in advance
Regards
Madhumathi A
to my knowledge u can't use internal tables in ABAP query...it is a mix of tables...
Similar Messages
-
Can we join two totals tables in ABAP Query
Hey Gurus!
Can we join two totals tables in ABAP query.
I am tyring to join FAGFLEXT with internal orders totals table.
Thanks
SHi,
Report painter majorily operates around characteristics and key figures.
ABAP query comes even more handy. The advantage is -
1. You can link many tables
2. Create selection screen as you like to have
3. User friendly report creation
4. Logic can also be coded.
5. Authorization can be set
I have written a article in SDN, which gives you an idea as to how to go about using ABAP query. Have a look on this - [Article - Practical Usage of ABAP Query|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f6b256-23be-2b10-8b93-cad83a617634]
Regards,
Sridevi -
How to extract data from info cube into an internal table using ABAP code
HI
Can Anyone plz suggest me
How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
Thankx in advance
regds
AJAYHI Dinesh,
Thankq for ur reply
but i ahve already tried to use the function module.
When I try to Use the function module RSDRI_INFOPOV_READ
I get an information message "ERROR GENERATION TEST FRAME".
can U plz tell me what could be the problem
Bye
AJAY -
Internal table in ABAP Server Proxy
Hi Experts,
I have developed a JDBC to ABAP Proxy scenario.
I have a problem. In my ABAP server proxy I have to import the values into an internal table and pass them to a BAPI for GR creation.
I get an error like. OCCURS 0 is not allowed in OO concept.
Can anyone give me examples on declaring internal table in an ABAP Proxy(OO Concept).
Thanks
AKHi
Check this out.
http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb3660358411d1829f0000e829fbfe/frameset.htm
Cheers -
Generating an XML Document from an internal table in ABAP
Good day to all of you;
With ABAP, in the R/3 system, I'm trying to figure out a way to accomplish the following:
1) SELECT a set of Purchase Order data into an internal table.
2) Generate an XML document, containing the above data, using a specific schema.
I've been playing around with function module SAP_CONVERT_TO_XML_FORMAT which has the following interface:
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ''
I_LINE_HEADER = ''
I_FILENAME = v_fname
I_APPL_KEEP = ''
I_XML_DOC_NAME = v_docname
IMPORTING
PE_BIN_FILESIZE = v_byte
TABLES
I_TAB_SAP_DATA = i_SapData
CHANGING
I_TAB_CONVERTED_DATA = i_XMLData
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
I'm uncertain as to whether or not the Export parameter, I_XML_DOC_NAME refers to some schema or definition and therefore have been excluding it. In doing so, the generated XML document seems to use the field name/type information from my itab for the tags.
If this function module requires an XML Document Name, how do I create one and where do I store it in R/3? If this is not the recommended solution, is anyone familiar with a way to load an XML schema, retrieve some data then have SAP generate an XML document using the schema?
Many thanks for any help available.
THai Phillips
Try with the following Code
This program exports an internal table to an XML file.
Report ZPRUEBA_MML_13 *
Export an internal table to XML document *
NO BORRAR ESTE CODIGO *
REPORT ZPRUEBA_MML_13.
PANTALLA SELECCION *
PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
PANTALLA SELECCION *
TYPE TURNOS *
TYPES: BEGIN OF TURNOS,
LU LIKE T552A-TPR01,
MA LIKE T552A-TPR01,
MI LIKE T552A-TPR01,
JU LIKE T552A-TPR01,
VI LIKE T552A-TPR01,
SA LIKE T552A-TPR01,
DO LIKE T552A-TPR01,
END OF TURNOS.
TYPE TURNOS *
TYPE SOCIO *
TYPES: BEGIN OF SOCIO,
NUMERO LIKE PERNR-PERNR,
REPOSICION LIKE PA0050-ZAUVE,
NOMBRE LIKE PA0002-VORNA,
TURNOS TYPE TURNOS,
END OF SOCIO.
TYPE SOCIO *
ESTRUCTURA ACCESOS *
DATA: BEGIN OF ACCESOS OCCURS 0,
SOCIO TYPE SOCIO,
END OF ACCESOS.
ESTRUCTURA ACCESOS *
START OF SELECTION *
START-OF-SELECTION.
PERFORM LLENA_ACCESOS.
PERFORM DESCARGA_XML.
END-OF-SELECTION.
END OF SELECTION *
FORM LLENA_ACCESOS *
FORM LLENA_ACCESOS.
REFRESH ACCESOS.
CLEAR ACCESOS.
MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
CLEAR ACCESOS.
MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
ENDFORM.
FORM LLENA_ACCESOS *
FORM DESCARGA_XML *
FORM DESCARGA_XML.
DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
G_IXML TYPE REF TO IF_IXML,
W_STRING TYPE XSTRING,
W_SIZE TYPE I,
W_RESULT TYPE I,
W_LINE TYPE STRING,
IT_XML TYPE DCXMLLINES,
S_XML LIKE LINE OF IT_XML,
W_RC LIKE SY-SUBRC.
DATA: XML TYPE DCXMLLINES.
DATA: RC TYPE SY-SUBRC,
BEGIN OF XML_TAB OCCURS 0,
D LIKE LINE OF XML,
END OF XML_TAB.
CLASS CL_IXML DEFINITION LOAD.
G_IXML = CL_IXML=>CREATE( ).
CHECK NOT G_IXML IS INITIAL.
M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
CHECK NOT M_DOCUMENT IS INITIAL.
WRITE: / 'Converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'ACCESOS'
DATAOBJECT = ACCESOS[]
IMPORTING
DATA_AS_DOM = L_DOM
CHANGING
DOCUMENT = M_DOCUMENT
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
CHECK NOT L_DOM IS INITIAL.
W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
IF W_RC IS INITIAL.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
W_RC.
ENDIF.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = M_DOCUMENT
IMPORTING
XML_AS_STRING = W_STRING
SIZE = W_SIZE
TABLES
XML_AS_TABLE = IT_XML
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
LOOP AT IT_XML INTO XML_TAB-D.
APPEND XML_TAB.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
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.
FORM DESCARGA_XML *
Thanks & regards
Sreenivasulu P -
How to convert xml file into internal table in ABAP Mapping.
Hi All,
I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
<BookingCode>2KY34R</BookingCode>
- <Passenger>
<Name>SARVESH</Name>
<Address>THANE</Address>
</Passenger>
- <Passenger>
<Name>RAJESH</Name>
<Address>POWAI</Address>
</Passenger>
- <Passenger>
<Name>CARRON</Name>
<Address>JUHU</Address>
</Passenger>
- <Flight>
<Date>03/03/07</Date>
<AirlineID>UA</AirlineID>
<FlightNumber>125</FlightNumber>
<From>LAS</From>
<To>SFO</To>
</Flight>
</ns0:MTO_ABAP_MAPPING>
AT the receiver side I wnat to concatenate the NAME & ADDRESS.
I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
but couldnt succeed to convert the xml file into internal table perfectly.
Can anybody help on this.
Thanks in advance!!
SarveshHi Sarvesh,
The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
Just in case you have not seen this
regards
Vijaya -
Using Internal Table in ABAP OO.
Hi,
I am using a internal table, I am calling a FM, which require Internal table as its parameter. Since Internal table with header line is not supported in ABAP OO. How to attain this.
Thanq For Ur time.
Cheers,
SamHi,
Please look at my example below.
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
kunnr TYPE vbak-kunnr,
vkgrp TYPE vbak-vkgrp,
END OF t_vbak.
DATA: gt_vbak TYPE STANDARD TABLE OF t_vbak,
gt_vbak_dum LIKE gt_vbak.
*CLASS DEFINITIONS
* CLASS lcl_get_so DEFINITION
CLASS lcl_get_so DEFINITION.
PUBLIC SECTION.
METHODS: get_sales_orders
EXPORTING
ex_vbak LIKE gt_vbak.
ENDCLASS. "lcl_get_so DEFINITION
*CLASS IMPLEMENTATIONS
* CLASS lcl_get_so IMPLEMENTATION
CLASS lcl_get_so IMPLEMENTATION.
METHOD get_sales_orders.
SELECT vbak~vbeln vbap~posnr vbak~erdat
vbak~ernam vbak~auart vbak~kunnr
vbak~vkgrp
FROM vbak
INNER JOIN vbap
ON vbak~vbeln = vbap~vbeln
INTO TABLE gt_vbak
WHERE vbak~erdat IN s_erdat
AND vbak~ernam IN s_ernam
AND vbak~auart IN s_auart
AND vbak~vkgrp IN s_vkgrp
AND vbak~kunnr = p_kunnr.
IF NOT gt_vbak[] IS INITIAL.
ex_vbak[] = gt_vbak[].
ELSE.
MESSAGE i000 WITH 'No data found for given criteria'.
LEAVE TO SCREEN 0.
ENDIF.
ENDMETHOD. "get_sales_orders
ENDCLASS. "lcl_get_so IMPLEMENTATION
* START-OF-SELECTION *
START-OF-SELECTION.
DATA: o_get_so TYPE REF TO lcl_get_so.
CREATE OBJECT: o_get_so.
*Get sales orders
CALL METHOD o_get_so->get_sales_orders
IMPORTING
ex_vbak = gt_vbak_dum.
Hope it helps...
Please award points if it helps... -
Declaring the internal table in ABAP objects
Hi every1,
Please any one let me know how to declare an internal table in class (ABAP objects). Bcos i am new to this classes.
help me out.
Regards,
MadhaviHi,
Check this example..
TYPES: BEGIN OF TYPE_DATA,
MATNR TYPE MATNR,
WERKS TYPE WERKS_D,
END OF TYPE_DATA.
DATA: T_DATA TYPE STANDARD TABLE OF TYPE_DATA.
DATA: WA_DATA TYPE TYPE_DATA.
Adding rows to the internal table.
WA_DATA-MATNR = 'AA'.
APPEND WA_DATA TO T_DATA.
Processing the interna table
LOOP AT T_DATA INTO WA_DATA.
ENDLOOP.
Thanks,
Naren -
I want to call components of an internal table in ABAP-Objects!!!!
Hy all,
I am trying to call the component my_query_info-compuid. But if I do it that way like shown below I get a Syntax error message.
"MY_QUERY_INFO" is a table without a header line and therefore has no component called "COMPUID".
And in Classes and OO its forbidden to declare internal tables with header lines and I also tried it?!
I hope you can give me some help.
DATA: my_query_info TYPE STANDARD TABLE OF
rrmx_s_query_info
WITH DEFAULT KEY
INITIAL SIZE 0.
METHOD get_queries_from_wb.
CALL FUNCTION 'RRMX_WORKBOOK_QUERIES_GET'
EXPORTING
i_workbookid = obj_id
i_objvers = 'A'
IMPORTING
e_t_query_info = my_query_info.
SELECT *
FROM rsrrepdir
INTO table long_query_info
WHERE compuid = my_query_info-compuid.
ENDMETHOD. "get_queries_from_wbHello Peter
Fortunately ABAP-OO does no longer allow to use header lines which are only good for spoiling programs.
Below you find my suggestion for OO-compatible coding:
DATA: my_query_info TYPE STANDARD TABLE OF rrmx_s_query_info
WITH DEFAULT KEY,
ls_query LIKE LINE OF my_query_info.
METHOD get_queries_from_wb.
CALL FUNCTION 'RRMX_WORKBOOK_QUERIES_GET'
EXPORTING
i_workbookid = obj_id
i_objvers = 'A'
IMPORTING
e_t_query_info = my_query_info.
"SELECT *
"FROM rsrrepdir
"INTO table long_query_info
"WHERE compuid = my_query_info-compuid.
IF ( my_query_info IS NOT INITIAL ).
SELECT * FROM rsrepdir INTO TABLE long_query_info
FOR ALL ENTRIES IN my_query_info
WHERE compuid = my_query_info-compuid.
ENDIF.
" Or:
LOOP AT my_query_info INTO ls_query.
SELECT * FROM rsrrepdir APPENDING TABLE long_query_info
WHERE compuid = ls_query-compuid.
ENDLOOP.
ENDMETHOD. "get_queries_from_wb
Regards
Uwe -
Conversion of internal tables from ABAP to XML and Viceversa
Hi ,
I am writing a BAPI to pick the data from SAP system which gives its output to a .NET application. So, i designed XSD and i want the output of the BAPI according to that XSD rather than in the form of normal internal tables.
Can any one please tell me what is the best way to do this ?
I know very little about the simple transformations that are available in ABAP. Do we need to write our own transformation for the conversion of the internal tables to required XML format or do we already have transformations which take the internal tables and XSD to generate the XML required ?
Also for again converting the XML document to ABAP do we need to write a new transformation ?
Reward points are assured for all the replies.
Regards,
Srinivas.to convert internal table to xml format you could use CALL TRANSFORMATION key word
data: xml_out type string .
call transformation (`ID`)
source output = youritab
result xml xml_out.
instead of ID (xslt program) you can desing your own xslt program to generate the xml in the desired format. ID is the standard delivered one -
HI experts,
Is it possible to put the internal
table in the memory in such a way that
that I can access the content
of it in my function calls?
Thanks for your reply.
best regards,
roseHai
Program 1
report zImport_0001.
data: itab type table of string with header line.
field-symbols: <fs> type table.
itab = 'This is the line 1'. append itab.
itab = 'This is the line 2'. append itab.
assign itab[] to <fs>.
export <fs> to memory id 'ZSRITEST'.
submit zsri_0002 and return.
Program 2
REPORT zImport_0002 .
data: itab type table of string with header line.
field-symbols: <fs> type table.
data: wa type string.
assign itab[] to <fs>.
import <fs> from memory id 'ZSRITEST'.
loop at <fs> into wa.
write:/ wa.
endloop.
Thanks & regards
Sreeni
Message was edited by: Sreenivasulu Ponnadi -
Longest length of a data type in an internal table in abap
Hi everyone,
I have a requirement for a client in which i want to read a standard text from SO10 which can be up to 5000 words, store that into an internal table & display it in an excel sheet in a single column in a single field.
I have tried declaring my field as:
field(65535) TYPE c,
edidd-sdata,
char1024,
/SDF/CCM_XSTRING, etc. But the field does not store morre than 128 characters.
Im attaching a screen shot of my final requirement.
can anybody help in this regard??Hi Vinnet,
Declare field with string type and use below sample code to display in a single row or colum.
CONSTANTS: "Char
lc_char1 TYPE char2 VALUE '"' ,
AT NEW esnum. "#EC AT_LOOP_WH
CONCATENATE lc_char1 l_string
INTO l_string
SEPARATED BY space.
ENDAT.
CONCATENATE l_string <field_name>
INTO l_string
SEPARATED BY space.
* Check for last line item to get payment note
AT END OF esnum. "#EC AT_LOOP_WH
CONCATENATE l_string lc_char1
INTO l_string
SEPARATED BY space.
ENDAT.
reward if it helpfull. -
Convert an internal table from ABAP to an xml file on the Unix server
I'm trying to convert an internal table to an xml file. This file will be downloaded to a unix server. Can someone help?
Hello Linda,
You can combine the code given by Mahalakshmi with something like this:
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = 'YOUR_LOGICAL_FILE_NAME
parameter_1 = l_file_name_xml
IMPORTING
file_name = l_file_server
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
TRY.
OPEN DATASET l_file_server FOR OUTPUT. "<IN TEXT MODE> <ENCODING DEFAULT>.
ENDTRY.
IF sy-subrc = 0.
LOOP AT lt_xml INTO ls_xml.
TRANSFER ls_xml TO l_file_server.
ENDLOOP.
CLOSE DATASET l_file_server.
ENDIF.
ENDIF.
You need to have the server path defined (look at the paths with tcode AL11) and the file logical name with tcode FILE
Best regards,
Andri -
Append one register to internal table in abap oo
DATA: l_fields TYPE STANDARD TABLE OFsval ,
LINEA TYPE sval.
linea-tabname = 'CSKS'.
linea-fieldname = 'KOSTL'.
linea-value = 0.
APPEND linea to l_fields.
i want to do this append, but i have an error because i work in a ABAP Objects
Some suggestions?
ThanksHi!
Could you Copy & Paste the text of the error? If you can it would be good to give the message id (sy-msgid) and number (sy-msgno) also.
I'm assuming that "OFsval" is a typo and in your code it's like "OF sval".
Regards,
Mário Espinheira
Edited by: Mário Espinheira on Dec 20, 2007 9:22 PM -
Records are getting overwritten in the internal table using Select query.
Hi All,
I have following query :
Loop at i_salesplant.
select maramatnr mvkeVKORG mvkeVTWEG maraZZCOEAFE maraZZCOEAFEUOM mvkeZZALLPOL
into corresponding fields of table i_zallocpol from mara inner join mvke on
mvkematnr = maramatnr
where MARA~zzobjtype = I_ZZOBJTYPE
and MVKE~VKORG = i_salesplant-vkorg
and MVKE~VTWEG = T_VTWEG.
ENDLOOP.
My Que : For example lets say first it selects all the records for Sales Org 1000. Next when you select the records for the Sales Org 2000 the earlier records are getting overwritten.
Please let me know your valuable inputs.
Thanks,
ChandravadanHi,
Thanks alot for the reply.
I changed query using appending as follows :
Loop at i_salesplant.
select maramatnr mvkeVKORG mvkeVTWEG maraZZCOEAFE maraZZCOEAFEUOM mvkeZZALLPOL
into appending corresponding fields of table i_zallocpol from mara inner join mvke on
mvkematnr = maramatnr
where MARA~zzobjtype = I_ZZOBJTYPE
and MVKE~VKORG = i_salesplant-vkorg
and MVKE~VTWEG = T_VTWEG.
ENDLOOp.
But it is giving error saying " Field "APPENDING" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "
Please suggest.
Thanks,
Chandravadan
Maybe you are looking for
-
RAW photo into Photshop CS5 as a Smart Object.
I am trying to open a RAW photo in Photohsop CS5 as a Smart Object. I have the photo selected in Bridge. When I go to execute File>Place in Bridge CS5 the menu entry indicates there should be a menu displayed. However, clicking on Place does not b
-
I Pod mini not working, it will not sync
I have a I Pod mini 2nd generation. I went to sync more music on to it and it when I auto filled it does not work and I have done the diagnostics. I get this message from I Tunes. I cannot add any songs to my I Pod because no songs will copy to this
-
HT1386 photos do not appear correctly
When viewing the actual photo it is not the same photo on the camera roll screen
-
WLC 7.0.220 - USER_ADD_FAILED
Here is what I'm getting: *Dot1x_NW_MsgTask_0: Apr 16 10:08:53.443: %APF-1-USER_ADD_FAILED: apf_ms.c:5665 Unable to create username mag12 for mobile00:21:5f:b2:f6:87. I have WPA2 with 802.1X ties back to ACS 5.3. Works great, but I got a client havin
-
Hi, I recently got a 5508 controller. I use 1 SSID for the employees on the main site (using certificate authentication). On the Remote sites I want to use the same SSID with different DHCP Servers (AP are configuring with HREAP mode). So I tried to