Best way to JOIN 3 tables into internal table ?
Hi friends,
i have the following issue:
i need to join information of 3 different tables ( BUT000, BUT020 and ADRC ) concerning Business Partners and i need them into one internal table.
how would this be achieved with best performance ?
regards,
CL
Hi clemens,
As per my understanding, u can further improve this SQL By:
1. first select only BU000 and BU020 with inner join and then select material details in different different itabs. and process This will surely reduce load on DB and may increase load on ABAP which u can improve by using BINARY SERARCH!.
(Important: if u are using two table in join and giviing only PARTNER which is primary key field in both tables in WHERE clasuse ... this should be the only criteria in where clasue then i Dont think it will affect performance .... how many record may be there, this query will be BEST performer... I hope it will fetch 750000 records whithin few seconds)
2. Generally, U try to give more and more conditions in where clause on PRIMARY KEY fiedls only and not on not KEY fields...
3. In worst case, fetch data from three differnt tables into three different itabs and then process, this is best and last way to reduce load on DB and will increase load on ABAP which can be manages as above..
Still u want more info .. send codes to me.. We will try to make it more and more fast....
Jogdand M B
null
Message was edited by:
Jogdand M B
Similar Messages
-
Best way to declare and use internal table
Hi all,
As per my knoledge there are various techeniques (Methods) to declare and use the internal tables.
Please Suggest me the Best way to declaring and using internal table ( WITH EXAMPLE ).
Please Give the reason as well how the particular method is good ?
What are benefits of particular method ?
Thanks in advance.
Regards
RajHello Raj Ahir,
There are so many methods to declare an internal table.
Mainly I would like to explain 2 of them mostly used.
1. Using Work Area and
2. With header line.
This with header line concept is not suggestable, because, when we shift the code to oops concept.. it doesn't work... Because OOPS doesn't support the Headerline concept...
But it all depends on the situation.
If you are sure that your program doen't make use of the OOPs concept, you can use HEADER LINE concept. If it invols OOPs use WORK AREA concept.
Now I'l explain these two methods with an example each...
1. Using Work area.
TABLES: sflight.
DATA: it_sflight TYPE TABLE OF sflight.
DATA: wa_sflight LIKE LINE OF it_sflight.
SELECT *
FROM sflight
INTO it_sflight
WHERE <condition>.
LOOP AT it_sflight INTO wa_sflight.
WRITE / wa_sflight.
ENDLOOP.
In this case we have to transfer data into work area wa_sflight.
We can't access the data from the internal table direclty without work
area.
*<===============================================
2. Using Header line.
DATA: BEGIN OF it_sflight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
END OF it_sflight.
SELECT *
FROM sflight
INTO it_sflight
WHERE <condition>.
LOOP AT it_sflight INTO wa_sflight.
WRITE / wa_sflight.
ENDLOOP.
In this case we can directly access the data from the internal table.
Here the internal table name represents the header. for each and every
interation the header line will get filled with new data. If you want to
represnent the internal table body you can use it_sflight[].
*<======================================================
TYPES: BEGIN OF st_sflight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
END OF st_sflight.
DATA: it_sflight TYPE TABLE OF st_sflight,
wa_sflight LIKE LINE OF it_sflight.
This is using with work area.
DATA: it_sflight LIKE sflight OCCURS 0 WITH HEADER LINE.
This is using header line.
<b>REWARD THE POINTS IF IT IS HELPFUL.</b>
Regards
Sasidhar Reddy Matli.
Message was edited by: Sasidhar Reddy Matli
Sasidhar Reddy Matli -
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
How to pass the data of the dynamic table into internal table
Hi all,
I had designed an Dynamic table in my Online Interactive form.
I am able to pass only the First row data into the internal table which i had created
Now how can i pass data of all the rows into the internal table.
Needed some coding help
Thanks
AjayHello Ajay,
If you have dynamic table in adobe and you want to capture all the added rows then you need to add corresponding element in the node bound to that table ui.
when u add a row using java script in adobe form there is no corresponding element created in the backend that is ur wd node bound to the table ui. and so u only get 1 row of data back.
try this,
create a button in your view holding adobe form say "add rows" and on click of this button write the code to add one more element to the node bound to ur table ui of adobe form. when server side rendering occurs it will recreate the table in adobe with added row in the node and you will be able to get the data entered by user.
Thanks,
Abhishek -
Best way to join 2 columns from table A to same column in Table B?
Hi,
This is a simplified example of the query I'm trying to write.
I have two tables - PIPELINE (which includes columns CREDIT_RECEIVER and CREATOR) and EMPLOYEES (which includes columns EMAIL and LOB).
I want to write a query which joins PIPELINE.CREDIT_RECEIVER with EMPLOYEES.EMAIL to return LOB as "CREDIT_RECEIVER_LOB".
I also want this query to join PIPELINE.CREATOR with EMPLOYEES.EMAIL to return LOB as "CREATOR_LOB".
Currently, I am doing a left outer join on EMPLOYEES.EMAIL = PIPELINE.CREDIT_RECEIVER to get "CREDIT_RECEIVER_LOB", and calling a function GET_LOB(PIPELINE.CREATOR) (defined below) to get "CREATOR_LOB".
Query:
Select PIPELINE.ID as ID,
PIPELINE.CREDIT_RECEIVER as CREDIT_RECEIVER,
PIPELINE.CREATOR as CREATOR,
EMPLOYEES.LOB as CREDIT_RECEIVER_LOB,
GET_LOB(PIPELINE.CREATOR) as CREATOR_LOB
FROM PIPELINE
LEFT OUTER JOIN EMPLOYEES ON PIPELINE.CREDIT_RECEIVER=EMPLOYEES.EMAIL
Is there a more efficient way to write this query? This query is so slow that it usually times out on me.
Thanks,
Forrest
GET_LOB definition
create or replace function "GET_LOB"
(vemail in VARCHAR2)
return VARCHAR2
is
begin
DECLARE vLOB VARCHAR2(30);
BEGIN
SELECT LOB INTO vLOB FROM EMPLOYEES WHERE email = vemail;
return vLOB;
END;
end;Select PIPELINE.ID as ID,
PIPELINE.CREDIT_RECEIVER as CREDIT_RECEIVER,
PIPELINE.CREATOR as CREATOR,
e1.LOB as CREDIT_RECEIVER_LOB,
e2.LOB as CREATOR_LOB
FROM PIPELINE
LEFT OUTER JOIN EMPLOYEES E1
ON PIPELINE.CREDIT_RECEIVER = EMPLOYEES.EMAIL
LEFT OUTER JOIN EMPLOYEES E2
ON PIPELINE.CREATOR = EMPLOYEES.EMAIL
Ramin Hashimzade -
Hi Experts,
I am new comer to ABAP, have some very important task to be done, need help from all of you. I have a program which displays the results(inform about the infocubes). I want to insert the output of this prgm into an internal table, I am looking lot into the documentation, but so far not much help and i am not able to execute it. And one more task, I want to join this internal table and one database table and get the result, my question is , Is it possible to join this internal table and database table based on some common field.
Any help will be of grt help
Thanks,
Hem.Hi,
For joining internal table with database table,you need to write the logic as below.
This is the pseudo code.
select * from database into table itab2 where condition.
loop at itab1 into wa1.
move-corresponding wa1 to wa3.
loop at itab2 into wa2 where field = wa1-field.
move-corresponding wa2 to wa3.
endloop.
append wa3 to itab3.
endloop.
1. select the required data from database table into internal table.
2. loop the first internal table which you already have.
3. Based on the key fields in these two internal tables[database],place the condition in READ or LOOP statement for the second internal table inside the loop of the first internal table.
4. If there are more records in second internal table for a single record in first internal table,then use LOOP the second internal table within the first internal table.Otherwise, read the second internal table within the first internal table.
5.Then move the corresponding fields from both the internal tables inside the loop to third internal table.Append the record to the third internal table.
Hope it helps.
Regards,
J.Jayanthi -
How to upload the flat file records into internal table by position?
Hi
I have a flat file which has 7 records in each row and they are NOT provided with CSV or Tab demilited...
They are continous text without spaces....
but i know the fixed length of each field Eg : 1st field 7 char and seconc field 3 char and so on...
How can i upload this file into internal table by reading positions of each field...I know we can use GUI_UPLOAD and Read dataset and Open dataset...
But please let me know to read the file with the fixed postions and load into internal table...
Thanks in advance
MMHi
As per my knowledge i dont think thr is some function module or so to read with a fixed positions.
You can use the below method if you think this is the best way.
Suppose your file has
types : begin of ty_itab,
field1 type char7,
field2 type char3,
field3 type chat3,
field4 type char3,
end of ty_itab.
types : begin of ty_upload,
str type string,
end of ty_upload.
data : it_itab type standatd table of ty_itab,
it_upload type standard table ot ty_upload,
wa_itab type ty_itab,
wa_upload type ty_upload.
use gui_upload.get the data in it_upload.
here you know that u have first 16 charcters makes a first row n then next 16 charcters next row
Loop at it_upload into wa_upload.
v_len = strlen ( wa_upload ).
v_len = v_len / 16.
You get number of rows per record ,if it is decimal value make it final value if 3.9 make to 4.
do v_len times.
wa_itab = wa_upload.
By this only first 16 characters are moved and respective fields will get a value.or else u can use offset
wa_upload+0(16).
append wa_itab to it_itab.
Now shift 16 characters using shift command in wa_upload.
enddo.
endloop.
Hope this syntax help you to resolve your issue.May be something i have missed .Right now i don't have sap system to send you the full correct syntax code.
Cheers
Joginder -
Issue with uploading XML file from application server into internal table
i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module SMUM_XML_PARSE and the error message is "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?
TYPES: BEGIN OF T_XML,
raw(2000) TYPE C,
END OF T_XML.
DATA:GW_XML_TAB TYPE T_XML.
DATA: GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
DATA:GI_STR TYPE STRING.
data: GV_XML_STRING TYPE XSTRING.
DATA: GI_XML_DATA TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'File does not exist' TYPE 'E'.
ELSE.
DO.
* Transfer the contents from the file to the work area of the internal table
READ DATASET LV_FILE1 INTO GW_XML_TAB.
IF SY-SUBRC EQ 0.
CONDENSE GW_XML_TAB.
* Append the contents of the work area to the internal table
APPEND GW_XML_TAB TO GI_XML_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* Close the file after reading the data
CLOSE DATASET LV_FILE1.
IF NOT GI_XML_TAB IS INITIAL.
CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
ENDIF.
* The function module is used to convert string to xstring
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = GI_STR
IMPORTING
BUFFER = GV_XML_STRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE 'Error in the XML file' TYPE 'E'.
ENDIF.
ENDIF.
IF GV_SUBRC = 0.
* Convert XML to internal table
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = GV_XML_STRING
TABLES
XML_TABLE = GI_XML_DATA
RETURN = GI_RETURN.
ENDIF.
READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ 0.
MESSAGE 'Error converting the input XML file' TYPE 'E'.
ELSE.
DELETE GI_XML_DATA WHERE TYPE <> 'V'.
REFRESH GI_RETURN.
ENDIF.Could you please tel me why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
Becuase there will be lot of XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?> ??????
Is there any other way we can do with out removing the lines? -
Error while reading excel file from application server into internal table.
Hi experts,
My requirement is to read an excel file from application server into internal table.
Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
Now in my program I have used :
OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
DO.
READ DATASET v_filename INTO wa_tab.
The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
Error details:
A character set conversion is not possible.
At the conversion of a text from codepage '4110' to codepage '4103':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 445. If this number is 0, the second error case, as
mentioned above, has occurred.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4103' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
Regards,
KarthikHi,
Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
As I think you are uploading the file in BIN format to Application server and trying to open text file.
Regards,
Umang Mehta -
Function module to get data into internal table from Excel file sheets
Hi,
I have to upload customers from excel file.
we are donloading customer data excel file sheets.
Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
so i have 3-4 sheet in one excel file.
now my requirement is to get the data from excel file into internal table.
is there any function module.
Thanks & RegardsI am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
Upload the data into an internal table, like the way that I am describing in the above:
DATA: L_MAX_COL_NB TYPE I.
DATA: l_file_name LIKE RLGRAP-FILENAME.
Just to be sure that is the correct type for the FM.
l_file_name = P_FILE_NAME.
L_MAX_COL_NB = 58. "Maximum nb of colums that the FM can read.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file_name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = L_MAX_COL_NB
I_END_ROW = 9999
TABLES
INTERN = PT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
Now you should upload the data into your own itab. The Function Module will return to you all the an itab
from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
FIELD-SYMBOLS:
<F_REC> LIKE WA_UPLOAD_FILE, "working are of the uploading file
<F_FIELD> TYPE ANY.
DATA: COLUMN_INT TYPE I,
C_FIELDNAME(30) TYPE C.
PERFORM GET_FIELDCATOLG TABLES FIELDCAT
USING 'ZECO_CHARALAMBOUS_FILE'.
LOOP AT PT_EXCEL.
AT NEW ROW.
ASSIGN WA_UPLOAD_FILE TO <F_REC>.
ENDAT.
COLUMN_INT = PT_EXCEL-COL.
READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
ASSIGN (C_FIELDNAME) TO <F_FIELD>.
<F_FIELD> = PT_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
CLEAR WA_UPLOAD_FILE.
ENDAT.
ENDLOOP.
With Regards
George
Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM -
Upload excel file (xls) into internal table in SRM 4.0
Hi experts!
I need upload a xls file into internal table (in ABAP report) in EBP machine for i work with data in the sheets. Can you help me?
Best Regard!Hi Zeky,
Try GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES
or FM ALSM_EXCEL_TO_INTERNAL_TABLE
Please look at this threads too:
/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table
Upload XLS file from Application server into internal table.
Regards,
Marcin Gajewski
please reward points for helpful answers -
Import an open office spreadsheet into internal table
hi all,
i have one requirment to import excel into sap but i dont have MS office on my system
is there any way to import an open office spreadsheet into internal table
by using ALSM_EXCEL_TO_INTERNAL_TABLE fm or any other ways.Hi,
You can use this function module 'ALSM_EXCEL_TO_INTERNAL_TABLE',
It works fine, Here is a sample code hwich I developed and working fine.
FIELD-SYMBOLS: <FS1>.
Variables
DATA: LV_BEGCOL TYPE I VALUE 1,
LV_BEGROW TYPE I VALUE 1,
LV_ENDCOL TYPE I VALUE 100,
LV_ENDROW TYPE I VALUE 32000.
DATA: LV_FILENAME LIKE RLGRAP-FILENAME.
DATA: LV_ZWLEN TYPE I,
LV_ZWLINES TYPE I.
DATA: LV_TIND(4) TYPE N.
DATA: LV_ZWFELD(30).
DATA: KZHEADER TYPE XFELD.
Internal Tables
DATA: BEGIN OF LT_INTERN OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE.
DATA: END OF LT_INTERN.
DATA: BEGIN OF LT_INTERN1 OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE.
DATA: END OF LT_INTERN1.
DATA: BEGIN OF LT_COL OCCURS 0,
COL LIKE ALSMEX_TABLINE-COL,
SIZE TYPE I.
DATA: END OF LT_COL.
DATA: BEGIN OF LT_FIELDNAMES OCCURS 3,
TITLE(60),
TABLE(6),
FIELD(10),
KZ(1),
END OF LT_FIELDNAMES.
No of columns
DATA: BEGIN OF LT_DATA_TAB OCCURS 0,
VALUE_0001(50),
VALUE_0002(50),
VALUE_0003(50),
VALUE_0004(50),
VALUE_0005(50),
VALUE_0006(50),
VALUE_0007(50),
VALUE_0008(50),
VALUE_0009(50),
VALUE_0010(50).
DATA: END OF LT_DATA_TAB.
Initialization
LV_FILENAME = P_UFILE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = LV_FILENAME
I_BEGIN_COL = LV_BEGCOL
I_BEGIN_ROW = LV_BEGROW
I_END_COL = LV_ENDCOL
I_END_ROW = LV_ENDROW
TABLES
INTERN = LT_INTERN
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
WRITE:/ 'Uploading Error'(019), SY-SUBRC.
ENDIF.
Arrange Data
LOOP AT LT_INTERN.
LT_INTERN1 = LT_INTERN.
CLEAR LT_INTERN1-ROW.
APPEND LT_INTERN1.
ENDLOOP.
SORT LT_INTERN1 BY COL.
LOOP AT LT_INTERN1.
AT NEW COL.
LT_COL-COL = LT_INTERN1-COL.
APPEND LT_COL.
ENDAT.
LV_ZWLEN = STRLEN( LT_INTERN1-VALUE ).
READ TABLE LT_COL WITH KEY COL = LT_INTERN1-COL.
IF SY-SUBRC EQ 0.
IF LV_ZWLEN > LT_COL-SIZE.
LT_COL-SIZE = LV_ZWLEN.
Internal Table, Current Row Index
MODIFY LT_COL INDEX SY-TABIX.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE LT_COL LINES LV_ZWLINES.
SORT LT_INTERN BY ROW COL.
IF KZHEADER = 'X'.
LOOP AT LT_INTERN.
LT_FIELDNAMES-TITLE = LT_INTERN-VALUE.
APPEND LT_FIELDNAMES.
AT END OF ROW.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO LV_ZWLINES TIMES.
WRITE SY-INDEX TO LT_FIELDNAMES-TITLE.
APPEND LT_FIELDNAMES.
ENDDO.
ENDIF.
SORT LT_INTERN BY ROW COL.
LOOP AT LT_INTERN.
IF KZHEADER = 'X'
AND LT_INTERN-ROW = 1.
CONTINUE.
ENDIF.
LV_TIND = LT_INTERN-COL.
CONCATENATE 'LT_DATA_TAB-VALUE_' LV_TIND INTO LV_ZWFELD.
ASSIGN (LV_ZWFELD) TO <FS1>.
<FS1> = LT_INTERN-VALUE.
AT END OF ROW.
APPEND LT_DATA_TAB.
CLEAR LT_DATA_TAB.
ENDAT.
ENDLOOP.
Thanks & Regards,
Dileep .C -
How to get data from maintaince view into internal table
Hi,
I want to get the all data from v_t179 (maintanence view) into intrenal table.
if i write select stmt , it is giving error.
I want all data into internal table.
regards,
AjayI think this is what you want:
TABLES: t179, t179t.
DATA: v_t179_int TYPE TABLE OF v_t179.
SELECT * FROM t179
JOIN t179t ON
t179~prodh = t179t~prodh
INTO CORRESPONDING FIELDS OF TABLE v_t179_int.
Rob -
Uploading CSV file into internal table
Hi,
I want to upload a CSV file into internal table.The flat file is having values as below:
'AAAAA','2003-10-11 07:52:37','167','Argentina',NULL,NULL,NULL,NULL,NULL,'MX1',NULL,NULL,'AAAA BBBB',NULL,NULL,NULL,'1',NULL,NULL,'AR ',NULL,NULL,NULL,'ARGENT','M1V','MX1',NULL,NULL,'F','F','F','F','F',NULL,'1',NULL,'MX','MMI ',NULL
'jklhg','2004-06-25 08:01:57','456','hjllajsdk','MANAGUA ',NULL,NULL,'265-5139','266-5136 al 38','MX1',NULL,NULL,'hjgkid GRÖBER','sdfsdf dfs asdfsdf 380 ad ased,','200 as ads, sfd sfd abajao y 50 m al sdf',NULL,'1',NULL,NULL,'NI ',NULL,NULL,NULL,'sdfdfg','M1V','dds',NULL,NULL,
Here I can not even split at ',' because some of the values are having value like NULL and some have values with comma too,
The delimiter is a quote and the separator is a comma here.
Can anyone help on this?
Thanks.
Edited by: Ginger on Jun 29, 2009 9:08 AMAs long as there can be a comma in a text literal you are right that the spilt command doesn't help. However there is one possibility how to attack this under one assumption:
- A comma outside a text delimiter is always considered a separator
- A comma inside a text delimiter is always considered a comma as part of the text
You have to read you file line by line and then travel along the line string character by character and setting a flag or counter for the text delimiters:
e.g.
"Text","Text1, Text2",NULL,NULL,"Text"
String Index 1: EQ " => lv_delimiter = 'X'
String Index 2: EQ T => text literal (because lv_delimiter = 'X')
String Index 3: EQ e => text literal (because lv_delimiter = 'X')
String Index 4: EQ x => text literal (because lv_delimiter = 'X')
String Index 5: EQ t => text literal (because lv_delimiter = 'X')
String Index 6: EQ " => lv_delimiter = ' ' (because it was 'X' before)
String Index 7: EQ , => This is a separator because lv_delimiter = ' '
String Index 8: EQ " => lv_delimiter = 'X' (because it was ' ' before)
String Index 9: EQ T => text literal (because lv_delimiter = 'X')
String Index 10: EQ e => text literal (because lv_delimiter = 'X')
String Index 11: EQ x => text literal (because lv_delimiter = 'X')
String Index 12: EQ t => text literal (because lv_delimiter = 'X')
String Index 13: EQ 1 => text literal (because lv_delimiter = 'X')
String Index 14: EQ , => text literal (because lv_delimiter = 'X')
String Index 15: EQ T => text literal (because lv_delimiter = 'X')
Whenever you hit a 'real' separator (lv_delimiter = ' ') you pass the value of the string before that up to the previous separator into the next structure field.
This is not an easy way to do it, but if you might have commas in your text literal and NULL values I gues it is probably the only way to go.
Hope that helps,
Michael -
Hi Guys,
I have two internal tables with same structure, ITAB1 is having 100 records and ITAB2 is having 150 records, i need to club two internal tables into ITAB3.
I hope, we can loop one internal table append record by record.
Is any other way, can we club two internal tables.
Thanks,
Gourisankar.Hi,
You can use INSERT LNES OF ITAB1 INTO ITAB3 and afterwards do the same with ITAB2.
Regards, Gerd Rother
Maybe you are looking for
-
Sessions Editor acting strangely (10.1.2)
Hello, I have a few odd problems with the Session Editor. Maybe its my windows platform but I cant explain it. I make my changes to the sessions.xml using the Session Editor and save them to the file system. As long as I am logged in to my windows it
-
Can more than 9 tax types be defined for a country in OVK1 ?
Hello experts, I have read all documentation on the settings for tax determination. However, nowhere I could find answer to my question: "Can more than 9 tax types be defined for a country in OVK1 ?" In OVK1, we can define more than 1 tax type for a
-
Hello Everyone, I would like to ask the Pro a question. I have a video clip which i want to cut and fade in and Fade Out the video and Audio. I have searched on internet but i can not seems to find the right answer.Is it that complicated to do fade i
-
I upgrades my mac operating system to OSX 10.9.4 and now my Dreamweaver CS5 won't work, it just quits unexpectedly. Please help.
-
Embedded pictures not forwarding
I have an ipad running gmail using a 3G network smpt. When I forward pictures that are embedded in the email - the recipient doesn't get them. Any ideas?