Method to fill teh internal table .
Hi Experts ,
How can i develop method of class for following purpose .
method importing parameter as name of the table ( dynamic :- caller can provide name of any table )
and exporting parameter as the internal table fill with the data from table whos name was entered by the user .
Thanks ,
Rushikesh
Like this
CLASS lcl_filler DEFINITION.
PUBLIC SECTION.
METHODS: get_table IMPORTING tab_name TYPE string
RETURNING value(r_table) TYPE REF TO data. "we return reference to table
ENDCLASS. "lcl_filler DEFINITION
CLASS lcl_filler IMPLEMENTATION.
METHOD get_table.
FIELD-SYMBOLS <tab> TYPE STANDARD TABLE.
CREATE DATA r_table TYPE TABLE OF (tab_name).
ASSIGN r_table->* TO <tab>.
SELECT * FROM (tab_name) INTO TABLE <tab> UP TO 10 ROWS.
ENDMETHOD. "get_table
ENDCLASS. "lcl_filler IMPLEMENTATION
START-OF-SELECTION.
DATA: r_filler TYPE REF TO lcl_filler,
r_table TYPE REF TO data.
FIELD-SYMBOLS <tab> TYPE STANDARD TABLE.
CREATE OBJECT r_filler.
r_table = r_filler->get_table( 'SFLIGHT' ).
ASSIGN r_table->* TO <tab>. "here content of first table
r_table = r_filler->get_table( 'SPFLI' ).
ASSIGN r_table->* TO <tab>. "here content of another one
Regards
Marcin
Similar Messages
-
Dynamically fill the internal table with new fileds
Hi Friends,
I have the internal table like
Data:begin of i_data occurs 0,
a(60),
b(60),
c(60),
d(60),
e(60),
end of i_data.
I need to fill the internal table dynamically like
Data:begin of i_data occurs 0,
a(60),
b(60),
c(60),
c1(60), "new filed dynamically
c2(60), "new field dynamically
d(60),
e(60),
end of i_data.
Please suggest me how to do this.
Regards,
Sunny.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 1:55 PMYou can not add new fields to a statically defined internal table, instead you must create the entrie internal table at runtime.
Search this forum for Dynamic Internal tables, you will get a lot of example programs.
Regards,
Rich Heilman -
Fill dinamic internal table from internal table
Hi gurus i need to know how can i fill a dinamic interna table from another internal table
example i have the table called it_info with the followin information
field1 field2 field3
Alex Ross 1
Rita Campos 1
because i have the same value in field 3 i have to agroup register 1 and 2 in the same line so the data should be in the next way
Field1 field2 field3 field4 field5
Alex Ross 1 Rita Campos
I have made a dinamic interna table so my table has the 5 fields but i dont know how to trasfer the data to my dinamic internal table, any idea? my source code:
it_campos-campo = 'Field1'. APPEND it_campos.
it_campos-campo = 'Field2'. APPEND it_campos.
it_campos-campo = 'Field3'. APPEND it_campos.
it_campos-campo = 'Field4'. APPEND it_campos
loop at it_campos .
t_fieldcat_wa-col_pos = SY-TABIX.
t_fieldcat_wa-fieldname = it_campos-campo.
APPEND t_fieldcat_wa TO t_fieldcat.
endloop .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = tabla
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
others = 2.
ASSIGN tabla->* TO <l_table>.
CREATE DATA ep_line LIKE LINE OF <l_table>.
ASSIGN ep_line->* TO <l_line>.
Now my dinamic internal table <l_table> is ready but how should i trasnfer the it_info data to this other table?This method (cl_alv_table_create=>create_dynamic_table) is really old-fashioned and counter-performant and limited as it uses GENERATE SUBROUTINE POOL statement.
Instead you should now use RTTC to create data, search forum for more information (sometimes referred as RTTS or RTTI, though this last one doesn't correspond to creation; you'll have to use CREATE DATA statement).
That said, your question has been asked many times in the forum: http://www.sdn.sap.com/irj/scn/advancedsearch?query=filldynamicinternal+table.
To help you a little bit, you need to use ASSIGN and FIELD-SYMBOLS statements (ASSIGN COMPONENT field_name OF STRUCTURE <fs_line> TO <fs_field>) -
Filling Dyanamic Internal table with data
Hi All
I have a following requirement.
1.. I have internal table with 1 text field of length 1000, this is field with data uploaded from text file having data tab seprated
2. I have a dyanamic table in which i have to fill the using the above internal table splited by tab seprated into the corresponding fields of dyanamic table.
please suggest some solution for the above.
thanks
bobbyHi Martin,
But How to assign to dyanmic table fields if we are using
split t_intab at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into .
where t_intab has 1 field of lenth say 1000 in which data stored is tab seprated.
please find below my code, please check loop at t_intab
FUNCTION Z_TEXT.
""Local Interface:
*" IMPORTING
*" VALUE(I_EXPTABLE) TYPE LVC_T_FCAT
*" VALUE(I_DELIMETER) TYPE C DEFAULT 'T'
*" TABLES
*" T_INTAB
*" T_OUTTAB
Data declarations
DATA:
dtab TYPE REF TO data,
newstr2 TYPE REF TO cl_abap_typedescr,
tab_type1 TYPE REF TO cl_abap_tabledescr,
lref_ditab TYPE REF TO data,
lref_new_line TYPE REF TO data.
Field-Symbols declarations
FIELD-SYMBOLS:
<fs_dyn_tab1> TYPE ANY TABLE,
<fs_dyn_wa> TYPE ANY,
<fs> type any.
Create dynamic table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_exptable
IMPORTING
ep_table = lref_ditab
EXCEPTIONS
generate_subpool_dir_full = 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.
Assign the dynamic table reference to a field-symbol
ASSIGN lref_ditab->* TO <fs_dyn_tab1>.
Create a structure similar to the dynamic table created
CREATE DATA lref_new_line LIKE LINE OF <fs_dyn_tab1>.
ASSIGN lref_new_line->* TO <fs_dyn_wa>.
loop at t_intab.
if I_DELIMETER = 'T'.
split t_intab at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into .
endif.
endloop.
ENDFUNCTION.
thanks
bobby -
Filling dynamic internal table with data from other internal table
Hi Friends,
My problem is that i have already built a dynamic internal table
(class int_table->create) but now i want to fill it with data from other internal table.
The dynamic table column name and the field value of the data filled internal table are same, but how to access that column name, since i cant hard code it anyway.
Like if my werks field value is '8001'. I want to place it under the column 8001 of dynamic table, Can anybody help me in this regard?
Awarding points is not a problem for even giving a slight hint.
Best RegardsHi
See this
Dynamic internal table is internal table that we create on the fly with flexible column numbers.
For sample code, please look at this code tutorial. Hopefully it can help you
Check this link:
http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Sample code:
DATA: l_cnt(2) TYPE n,
l_cnt1(3) TYPE n,
l_nam(12),
l_con(18) TYPE c,
l_con1(18) TYPE c,
lf_mat TYPE matnr.
SORT it_bom_expl BY bom_comp bom_mat level.
CLEAR: l_cnt1, <fs_dyn_wa>.
Looping the component internal table
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
AT END OF bom_comp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDAT.
ENDLOOP.
Reward if useful
Anji -
Fill dynamic internal table with data from another dynamic table
Hi,
I have a huge dynamic table with a few columns and need to fill another dynamic table with some of the columns, that are also existing in the other one. I first know at runtime, which fields the smaller table contains.
Until now, I did it that way:
LOOP AT <it_tab_structure> ASSIGNING <wa_tab_structure>.
LOOP AT lt_comp_full INTO ls_comp_full.
ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <structure> TO <column>.
ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <wa_tab_structure> TO <value>.
<column> = <value>.
ENDLOOP.
APPEND <structure> TO <table>.
ENDLOOP.
lt_comp_full contains the columns of the second table, that have to be filled.
This is taking a very long time, as there can be a lot of columns in the source table and the source table contains at least 100000 records.
Is there therefore any way to fill the other table faster?
Thank you & best regards,
MichaelHey Sharath,
thank you for your answer! Unfortunately I don't have a 7.4 system here, but your example pointed out, that I can also use move-corresponding from one structure to the other, which I thought, was not possible. I'm trying out, if this makes it faster now.
I'll let you all know, if this made the deal.
Thank you & best regards,
Michael & Arne -
How to fill internal table with no data in debugging mode
Hi all,
I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
Thanks,
BalajiHi,
In the debugging do the following..
Click the Table button..
Double click on the internal table name..
Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
Use the APPEND button to insert records to the internal table..
Thanks,
Naren -
How many times will internal table get filled?
Dear BW / ABAP gurus:
I am observing a routine in a transformation in 7.0 data flow.
The internal table is created as follows in the global declaration in the Start Routine:
TYPES: BEGIN OF ST_PROD,
/BIC/AZPROD TYPE /BIC/OIAZPROD,
/BIC/AZCOST TYPE /BIC/OIAZCOST,
END OF ST_PROD.
DATA: IT_PROD TYPE TABLE OF ST_PROD,
WA_PROD TYPE ST_PROD.
The programmer is fetching data for product cost which is not available in the source. This code is written in the Start Routine:
SELECT /BIC/AZPROD /BIC/AZCOST
FROM /BIC/PAZPROD
INTO CORRESPONDING FIELDS OF TABLE IT_PROD
WHERE OBJVERS = 'A'.
My questions:
(1) Is it a standard practice to create the internal table in the global declaration?
(2) Is it a standard practice to fill the internal table with data in the Start Routine? Is it possible to fill the internal table with data in the global declaration? Or is the global declaration only reserved for declaring variables and creating internal tables?
(3) What is the use of 2nd part global?
(4) Let's say there are 100, 000 records at the source and the DTP package size is 50,000. Then the Start Routine will get executed 2 times. So the code in the Start Routine will hit the database 2 times to fill the internal table. Is this correct?
Note to mods: Please do not delete the thread. Move to the beginner section if you think this is basic. But please do not delete. It take a long time to type out the questions.hi Saurav,
(1) Is it a standard practice to create the internal table in the global declaration?
1. No ,internal table should be created in global part only if they are getting used in field level or end routine .Else they must be in local part and should get refreshed at the end so that performance not get affected.
(2) Is it a standard practice to fill the internal table with data in the Start Routine? Is it possible to fill the internal table with data in the global declaration? Or is the global declaration only reserved for declaring variables and creating internal tables?
1.No if only you want to use the data in field level routine and start routine ,you will fill table in start routine otherwise no .
2.first global part is for data declaration so no in first global part select cannot come .
3.Second global part can have select but you cannot write any statement using source package or result package here as they are private object of transformation class and not recognized at this area.However simple select on any table other than these will be fine .
(3) What is the use of 2nd part global?
1.In second global part you can declare internal table ,structures that are not of type source package or result package but independent and can use them .
2.If you will declare these table in first global part they will be private object and you cannot write select using them in second global part .
3.Second global part is also declaration but outside the class so these objects are global across transformation with more flexibility .
4.If you will declare any data here using the structure of source /result package you will get error .This is a data declaration part comes between transformation definition and implementation part .
(4) Let's say there are 100, 000 records at the source and the DTP package size is 50,000. Then the Start Routine will get executed 2 times. So the code in the Start Routine will hit the database 2 times to fill the internal table. Is this correct?
yes the source and result package are actually the DTP packages only so code will get executed same no of time as you have number of packages in DTP extraction .
Hope this will be helpful .
Regards,
Jaya Tiwari -
Hi
I have a requirement of writing internal table data to XML. Any idea where i should start.
I have pretty good experience with ABAP and basic knowledge in XML.
There are good blogs which talk about transformations and other stuff but they are not able to give me clear path to my solution.
Could somebody give me a basic example or some reference material where i can move the data in internal table (assume Sales order details of a day) to XML.
ThanksRefer the program -
In this implementation we will only focus on the creation of the XML file and the transfer to the user. You can not create a XML document directly. You have to use a so called ixml factory first.
TYPE-POOLS: ixml.
DATA: l_ixml TYPE REF TO if_ixml.
l_ixml = cl_ixml=>create( ).
This iXML factory can create an empty XML document object named l_document.
DATA: l_document TYPE REF TO if_ixml_document.
l_document = l_ixml->create_document( ).
At this point you can add the nodes (elements, attributes) into the document. First you have to declare the root element node.
DATA: l_element_root TYPE REF TO if_ixml_element.
This node we have to give a name and add it (create_simple_node) to the document object l_document, which will be the parent of this node.
l_element_root = l_document->create_simple_element(
name = 'flights'
parent = l_document ).
Next we can add child nodes to there parent node using the same method of the document object.
DATA: l_element_airline TYPE REF TO if_ixml_element,
l_element_airline = l_document->create_simple_element(
name = 'airline'
parent = l_element_root ).
An attribute can be add easily using the method set_attribute of the element node.
l_rc = l_element_airline->set_attribute( name = 'code' value = 'LH401' ).
Now we have finished the document object. Regretfully it can not be displayed in any form due to the fact that it is a binary object.
The next step is to convert the created document to a flat file. To achieve this we have to create a stream factory, which will help us to create an output stream.
DATA: l_streamfactory TYPE REF TO if_ixml_stream_factory.
l_streamfactory = l_ixml->create_stream_factory( ).
In this case, we will convert the document into an output stream which is based on an internal table of type x.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i,
l_ostream TYPE REF TO if_ixml_ostream.
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
When we have created the output stream we can do the rendering from the document into the stream. The XML data will be stored in the internal table automatically.
DATA: l_renderer TYPE REF TO if_ixml_renderer.
l_renderer = l_ixml->create_renderer( ostream = l_ostream
& nbsp; document = l_document ).
l_rc = l_renderer->render( ).
In the last step we upload the file to the sapgui
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\temp\flights.xml'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
This finished the first step-of-three. As mentioned before the next log will focus on the conversion from xml files (back) to abap tables.
REPORT z_xit_xml_dom_create.
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
DATA: l_element_flights TYPE REF TO if_ixml_element,
l_element_airline TYPE REF TO if_ixml_element,
l_element_flight TYPE REF TO if_ixml_element,
l_element_from TYPE REF TO if_ixml_element,
l_element_to TYPE REF TO if_ixml_element,
l_element_dummy TYPE REF TO if_ixml_element,
l_value TYPE string.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
DATA: lt_spfli TYPE TABLE OF spfli.
DATA: l_spfli TYPE spfli.
START-OF-SELECTION.
Fill the internal table
SELECT * FROM spfli INTO TABLE lt_spfli.
Sort internal table
SORT lt_spfli BY carrid.
Start filling xml dom object from internal table
LOOP AT lt_spfli INTO l_spfli.
AT FIRST.
Creating a ixml factory
l_ixml = cl_ixml=>create( ).
Creating the dom object model
l_document = l_ixml->create_document( ).
Fill root node with value flights
l_element_flights = l_document->create_simple_element(
name = 'flights'
parent = l_document ).
ENDAT.
AT NEW carrid.
Create element 'airline' as child of 'flights'
l_element_airline = l_document->create_simple_element(
name = 'airline'
parent = l_element_flights ).
Create attribute 'code' of node 'airline'
l_value = l_spfli-carrid.
l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
Create attribute 'name' of node 'airline'
SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
ENDAT.
AT NEW connid.
Create element 'flight' as child of 'airline'
l_element_flight = l_document->create_simple_element(
name = 'flight'
parent = l_element_airline ).
Create attribute 'number' of node 'flight'
l_value = l_spfli-connid.
l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
ENDAT.
Create element 'from' as child of 'flight'
CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
l_element_from = l_document->create_simple_element(
name = 'from'
value = l_value
parent = l_element_flight ).
Create attribute 'airport' of node 'from'
l_value = l_spfli-airpfrom.
l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
Create element 'to' as child of 'flight'
CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
l_element_to = l_document->create_simple_element(
name = 'to'
value = l_value
parent = l_element_flight ).
Create attribute 'airport' of node 'from'
l_value = l_spfli-airpto.
l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
Create element 'departure' as child of 'flight'
l_value = l_spfli-deptime.
l_element_dummy = l_document->create_simple_element(
name = 'departure'
value = l_value
parent = l_element_flight ).
Create element 'arrival' as child of 'flight'
l_value = l_spfli-arrtime.
l_element_dummy = l_document->create_simple_element(
name = 'arrival'
value = l_value
parent = l_element_flight ).
Create element 'type' as child of 'flight'
CASE l_spfli-fltype.
WHEN 'X'.
l_value = 'Charter'.
WHEN OTHERS.
l_value = 'Scheduled'.
ENDCASE.
l_element_dummy = l_document->create_simple_element(
name = 'type'
value = l_value
parent = l_element_flight ).
ENDLOOP.
IF sy-subrc NE 0.
MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
ENDIF.
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
Connect internal XML table to stream factory
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
Rendering the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\temp\flights.xml'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
<?xml version="1.0"?>
<flights>
<airline code="AA" name="American Airlines">
<flight number="0017">
<from airport="JFK">NEW YORK,US</from>
<to airport="SFO">SAN FRANCISCO,US</to>
<departure>110000</departure>
<arrival>140100</arrival>
<type>Scheduled</type>
</flight>
<flight number="0064">
<from airport="SFO">SAN FRANCISCO,US</from>
<to airport="JFK">NEW YORK,US</to>
<departure>090000</departure>
<arrival>172100</arrival>
<type>Scheduled</type>
</flight>
</airline>
<airline code="AZ" name="Alitalia">
<flight number="0555">
<from airport="FCO">ROME,IT</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>190000</departure>
<arrival>210500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0788">
<from airport="FCO">ROME,IT</from>
<to airport="TYO">TOKYO,JP</to>
<departure>120000</departure>
<arrival>085500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0789">
<from airport="TYO">TOKYO,JP</from>
<to airport="FCO">ROME,IT</to>
<departure>114500</departure>
<arrival>192500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0790">
<from airport="FCO">ROME,IT</from>
<to airport="KIX">OSAKA,JP</to>
<departure>103500</departure>
<arrival>081000</arrival>
<type>Charter</type>
</flight>
</airline>
<airline code="DL" name="Delta Airlines">
<flight number="1984">
<from airport="SFO">SAN FRANCISCO,US</from>
<to airport="JFK">NEW YORK,US</to>
<departure>100000</departure>
<arrival>182500</arrival>
<type>Scheduled</type>
</flight>
<flight number="1699">
<from airport="JFK">NEW YORK,US</from>
<to airport="SFO">SAN FRANCISCO,US</to>
<departure>171500</departure>
<arrival>203700</arrival>
<type>Scheduled</type>
</flight>
<flight number="0106">
<from airport="JFK">NEW YORK,US</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>193500</departure>
<arrival>093000</arrival>
<type>Scheduled</type>
</flight>
</airline>
<airline code="JL" name="Japan Airlines">
<flight number="0407">
<from airport="NRT">TOKYO,JP</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>133000</departure>
<arrival>173500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0408">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="NRT">TOKYO,JP</to>
<departure>202500</departure>
<arrival>154000</arrival>
<type>Charter</type>
</flight>
</airline>
<airline code="LH" name="Lufthansa">
<flight number="2407">
<from airport="TXL">BERLIN,DE</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>071000</departure>
<arrival>081500</arrival>
<type>Scheduled</type>
</flight>
<flight number="2402">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="SXF">BERLIN,DE</to>
<departure>103000</departure>
<arrival>113500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0402">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="JFK">NEW YORK,US</to>
<departure>133000</departure>
<arrival>150500</arrival>
<type>Charter</type>
</flight>
<flight number="0401">
<from airport="JFK">NEW YORK,US</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>183000</departure>
<arrival>074500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0400">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="JFK">NEW YORK,US</to>
<departure>101000</departure>
<arrival>113400</arrival>
<type>Scheduled</type>
</flight>
</airline>
<airline code="QF" name="Qantas Airways">
<flight number="0005">
<from airport="SIN">SINGAPORE,SG</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>225000</departure>
<arrival>053500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0006">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="SIN">SINGAPORE,SG</to>
<departure>205500</departure>
<arrival>150500</arrival>
<type>Scheduled</type>
</flight>
</airline>
<airline code="SQ" name="Singapore Airlines">
<flight number="0988">
<from airport="SIN">SINGAPORE,SG</from>
<to airport="TYO">TOKYO,JP</to>
<departure>163500</departure>
<arrival>001500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0158">
<from airport="SIN">SINGAPORE,SG</from>
<to airport="JKT">JAKARTA,ID</to>
<departure>152500</departure>
<arrival>160000</arrival>
<type>Scheduled</type>
</flight>
<flight number="0015">
<from airport="SFO">SAN FRANCISCO,US</from>
<to airport="SIN">SINGAPORE,SG</to>
<departure>160000</departure>
<arrival>024500</arrival>
<type>Scheduled</type>
</flight>
<flight number="0002">
<from airport="SIN">SINGAPORE,SG</from>
<to airport="SFO">SAN FRANCISCO,US</to>
<departure>170000</departure>
<arrival>192500</arrival>
<type>Scheduled</type>
</flight>
</airline>
<airline code="UA" name="United Airlines">
<flight number="0941">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="SFO">SAN FRANCISCO,US</to>
<departure>143000</departure>
<arrival>170600</arrival>
<type>Scheduled</type>
</flight>
<flight number="3504">
<from airport="SFO">SAN FRANCISCO,US</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>150000</departure>
<arrival>103000</arrival>
<type>Scheduled</type>
</flight>
<flight number="3516">
<from airport="JFK">NEW YORK,US</from>
<to airport="FRA">FRANKFURT,DE</to>
<departure>162000</departure>
<arrival>054500</arrival>
<type>Scheduled</type>
</flight>
<flight number="3517">
<from airport="FRA">FRANKFURT,DE</from>
<to airport="JFK">NEW YORK,US</to>
<departure>104000</departure>
<arrival>125500</arrival>
<type>Scheduled</type>
</flight>
</airline>
</flights>
Regards,
Amit
Reward all helpful replies. -
How to create an dynamic internal table with the structure of a ddic table
Hi all,
I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server). The ddic tables have different amount of fields.
I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
LOOP AT lt_struc ASSIGNING <lfs_struc>.
LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
lv_feld = lv_wa1-zdat_name.
ENDLOOP.
CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
Do.
OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
READ DATASET lv_pfad INTO lv_rec.
IF sy-subrc NE 0.
EXIT.
ENDIF.
enddo.
REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
INSERT into (<lfs_struc>) values lr_str_value.
CLOSE DATASET lv_pfad.
endloop.
This is not the whole code, but it's working until
SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
Has anyone an idea?Hi Mayari,
though you were successfull with
METHOD cl_alv_table_create=>create_dynamic_table
I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
If you know the DDIC structure, it is (starting with ECC6.0) much easier:
field-symbols:
<table> type standard table.
data:
lr_data type ref to data.
Create data lr_data type table of (<DDIC structure>).
assign lr_data->* to <table>.
The split code can be simplified gaining speed loosing complexity not loosing functionality.
field-symbols:<fs_s> type any.
field-symbols:<fs_t> type any.
SPLIT lv_rec AT ';' INTO table it_string.
loop at it_string assigning <fs_s>.
assign component sy-tabix of wa_string to <fs_t>.
if sy-subrc = 0.
<fs_t> = <fs_s>.
endif.
at last.
append <fs_itwa3> to <ft_itab3>.
endat.
endloop.
Though it may work as Keshav.T suggested, there is no need to do that way.
Regards,
Clemens -
Problem with downloading the internal table onto the presentation server.
Hey folks,
I have a problem where in i am downloading one year of sales done by the company. I wrote a program to download the file onto the presentation server . The error occurs in the FM GUI_DOWNLOAD where if the file exceeds 105843504 bytes its giving me a dump saying that
When the program was running , it was established that more memory was needed than the operating system is able to safely to provide.
The current program has to be terminted because of the program already requested 105843504 bytes from the operating system with malloc when the operating system reported after further memory request that there was no more memory space available.
Could somebody provide an alternative soltuion for this.
Its really urgent as i can download the file with 70,000,000 bytes
Regards
RockHi Rock,
Please download the files on to Application Server, else as suggested by Ashish download into 2 or 3 files and merge them manually.
Declare same internal tables may be 5 times.
When you fill the internal table check for a counter and when you hit a certain number stop appending to it and start appending to the next.
After you are done so download all the internal tables.
I guess this would be a good way. I am not sure if there are any ther alternative good methods.
Hope this helps.
Shreekant -
Export internal table from report to web-dynpro
Hi,
I am trying to export an internal table from a report to my web dynpro pragram however its not working.
Statement used in my report -
EXPORT it_ordbk FROM it_ordbk TO MEMORY ID 'ZORDBK'.
Statement used in my web dynpro program
IMPORT it_ordbk to it_ordbk FROM MEMORY ID 'ZORDBK'.
This dynpro application is being called in HTML container on the screen.
Kindly help.
Cordially,
DanishHi Danish,
do not use export or import in Webdynpro.
try to create a class with global variables and in the report or at the place of Export fille the data .
and next in the place of Import memory to to call the global variable in the webdynpro and fill the internal table
go to se24> create a zclasss-> methods initialize>create a ztable same as export table and also declare in glaobal vairaible
--> next in the webdynpro program -->call the method retrive and push the global data to internal table.
Prabhudas -
Internal table values in a popup window
Hi All,
i'm new to WD..
i have a dynamic internal table(only one field) in my WDA. i want to show all the values as POPUP on the screen after user press the button. please let me know how can i procced for this? also after selecting the rows from Popup table, i want the fields selected to be placed into another internal table.
please let me know how can i do this..
Thanks in advance
ShekharHi Shekhar,
Have you actually populated your internal table I_TAB with any data? Am asking so coz I dont find anything related to that in here. You have just obtained your context node's reference & have written a bind_table to that. Have you actually filled this internal table by using WDDOINIT method or a supply function?
Regards,
Uday
Am sorry I had earlier given you a link to invalid tutorial. Plz find the correct link for the task I had explained earlier in [here|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm].
Below is the code that I have in my push button.I read the KUNNR value entered by the user & fetch the corresponding sales order information & bind it to my context node. I then map this context node to the view embedded within my popup view.
METHOD onactiondisplay_popup .
DATA: lv_node TYPE REF TO if_wd_context_node,
lv_kunnr TYPE ig_componentcontroller=>element_kna1-kunnr,
lt_vbak TYPE ig_componentcontroller=>elements_vbak.
* get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
lv_node = wd_context->get_child_node( name = 'KNA1' ).
CALL METHOD lv_node->get_attribute
EXPORTING
name = 'KUNNR'
IMPORTING
value = lv_kunnr.
SELECT * FROM vbak INTO TABLE lt_vbak WHERE kunnr = lv_kunnr.
IF sy-subrc NE 0.
* report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = 'No sales orders exist for this customer!'.
ELSE.
lv_node = wd_context->get_child_node( name = 'VBAK' ).
lv_node->bind_table( new_items = lt_vbak ).
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window(
window_name = 'POPUP_WINDOW'
title = 'Working with modal windows in webdynpro!'
close_in_any_case = abap_true ).
lv_node = wd_context->get_child_node( name = 'WINDOW_REFERENCE' ).
lo_window->open( ).
ENDIF.
ENDMETHOD. "onactiondisplay_popup -
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 -
Hi ,
I have created a view with a table inside. This table is bound to a node that contains data from a service
call.
The view is embeded in the window and the data in the table can be displayed on the screen. I would like
to print this table. How do I code this? Please give me suggestions.
ps. I don't want to display in ALV format.
Thanks,
AS.Hi Thomas,
I have created a view and a popup window. In this view context, I created a node that is bound to SFPPRIP structure.
I have user to enter output device (DEST) .
I don't know how to declear it_message and print_options to make the method PRINT to work.
Could you look at the code below and give me some suggestions on the input for the print method?
method GET_PRINT_PARAM .
* get print input
data: context_node type ref to if_wd_context_node,
elem_print type ref to if_wd_context_element,
stru_print type if_componentcontroller=>element_printing,
item_dest like stru_print-dest.
context_node = wd_context->get_child_node( name = 'PRINTINT' ).
elem_print = context_node->get_element( ).
elem_print->get_attribute(
exporting
name = 'DEST'
importing
value = item_dest ).
* fill the internal table
data: elem_sflightinfo type ref to if_wd_context_element,
stru_sflightinfo type table of if_componentcontroller=>element_sflightinfo initial size 0,
w_itab like line of stru_sflightinfo.
context_node = wd_context->get_child_node( name = 'SFLIGHTINFO').
select * from sflight
into corresponding fields of table stru_sflightinfo.
* BIND table to context node flighttab
call method context_node->bind_table
exporting
new_items = stru_sflightinfo.
* for print method
data: it_out type ref to data,
it_message type ref to CL_BSP_MESSAGES. "I know it is wrong, but what should I use?
get reference of stru_sflightinfo into it_out.
wd_this->print(
* col_def = " tableviewcontroltab
itab = it_out " ref to data
* iterator = " ref to if_htmlb_tableview_iterator
messages = it_message " ref to cl_bsp_messages(wrong. but what to pass?)
print_options = item_dest " sfpprip (I know it is wrong, but don't know what to pass?)
endmethod.
PRINT method
method PRINT .
FIELD-SYMBOLS: <tab> TYPE table.
ASSIGN itab->* TO <tab>.
****This sample uses the new ALV Object Model - Only available in WebAS 640+
****It will have to be changed (perhaps to use field catalogs and REUSE_ALV)
****in WebAS 620
DATA: table TYPE REF TO cl_salv_table.
DATA: print_parameters TYPE pri_params,
valid_flag(1) TYPE c.
****Convert the Input Print Parameters (Designed for Adobe Forms)
****Into the ABAP List format
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority = print_options-authority
copies = print_options-copies
cover_page = print_options-cover
data_set = print_options-dataset
department = print_options-division
destination = print_options-dest
expiration = print_options-lifetime
immediately = print_options-reqimm
layout = 'X_65_255'
list_name = print_options-suffix2
list_text = print_options-covtitle
new_list_id = print_options-reqnew
no_dialog = abap_true
receiver = print_options-receiver
release = print_options-reqdel
IMPORTING
out_parameters = print_parameters
valid = valid_flag
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc = 0 OR valid_flag NE abap_true.
messages->add_message2( condition = 'print'
message = 'Invalid Print Parameters'(e01) ).
RETURN.
ENDIF.
****Start List Processing with our Print Parameters
NEW-PAGE PRINT ON PARAMETERS print_parameters
NO DIALOG.
****Create the ALV Object Model
DATA: salv_msg TYPE REF TO cx_salv_msg.
DATA: error_string TYPE string.
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = abap_true
IMPORTING
r_salv_table = table
CHANGING
t_table = <tab> ).
CATCH cx_salv_msg INTO salv_msg.
messages->add_message_from_exception( condition = 'print'
exception = salv_msg ).
EXIT.
ENDTRY.
****Process the Column Definitions
DATA: columns TYPE REF TO cl_salv_columns_table.
****Get a reference to the columns object and set the optimize width.
columns = table->get_columns( ).
columns->set_optimize( abap_false ).
DATA: l_col_def TYPE tableviewcontroltab.
DATA: iterator_error TYPE REF TO cx_sy_dyn_call_illegal_method.
****We have an iterator Class - Process it and get a columun defintion table
IF col_def IS INITIAL AND
iterator IS NOT INITIAL.
DATA: p_overwrites TYPE tableviewoverwritetab.
TRY.
iterator->get_column_definitions(
EXPORTING
p_tableview_id = 'itab'
CHANGING
p_column_definitions = l_col_def
p_overwrites = p_overwrites ).
CATCH cx_sy_dyn_call_illegal_method INTO iterator_error.
messages->add_message_from_exception( condition = 'print'
exception = iterator_error ).
EXIT.
ENDTRY.
*****User supplied a column definition table directly - us it
ELSEIF col_def IS NOT INITIAL.
l_col_def = col_def.
ENDIF.
****Adjust our column definition (otherwise know as Field Catalog) by the
****Iterator or Column Dfinition table.
IF l_col_def IS NOT INITIAL.
DATA: scrtext_l TYPE scrtext_l,
scrtext_m TYPE scrtext_m,
scrtext_s TYPE scrtext_s,
tooltip TYPE lvc_tip.
DATA: col TYPE salv_t_column_ref.
FIELD-SYMBOLS: <wa_col> LIKE LINE OF col,
<wa_col_def> LIKE LINE OF l_col_def.
****Get a listing of all columns
col = columns->get( ).
****Loop through all the columsn
LOOP AT col ASSIGNING <wa_col>.
****Read to see if the current columns is in our Iterator
READ TABLE l_col_def ASSIGNING <wa_col_def>
WITH KEY columnname = <wa_col>-columnname.
IF sy-subrc = 0.
****Field is in the iterator - set it visible.
<wa_col>-r_column->set_visible( abap_true ).
****Is there an override title in the Iterator - if yes
****use it for all the column headers of the output
IF <wa_col_def>-title IS NOT INITIAL.
scrtext_l = <wa_col_def>-title.
scrtext_m = <wa_col_def>-title.
scrtext_s = <wa_col_def>-title.
<wa_col>-r_column->set_long_text( scrtext_l ).
<wa_col>-r_column->set_medium_text( scrtext_m ).
<wa_col>-r_column->set_short_text( scrtext_s ).
ENDIF.
****Is there an override tooltip in the Interator - if yes
****ues it for the tooltip of the output (actually meaningless
****for only printing - but hey you never know what you might
****use this for in the future :)
IF <wa_col_def>-tooltipheader IS NOT INITIAL.
tooltip = <wa_col_def>-tooltipheader.
<wa_col>-r_column->set_tooltip( tooltip ).
ENDIF.
ELSE.
****Field is not in the Iterator - Hide it in the output
<wa_col>-r_column->set_visible( abap_false ).
ENDIF.
ENDLOOP.
ENDIF.
****Set the ALV to display (forces printing in the Dark = background or BSP)
table->display( ).
NEW-PAGE PRINT OFF.
messages->add_message2( condition = 'print'
message = 'Print Output is complete'(i01)
messagetype = 'I' ).
endmethod.
Your help is greatly appreciated.
AS.
Edited by: Anna Smith on Dec 18, 2008 4:25 PM
Maybe you are looking for
-
Relationship of Jobs to Position
Hi, When I maintain EG and ESG infotype(1013) through Jobs (Po03) should'nt these fields be automatically populated in Position (Po13) when I assign the relationship between Jobs and Positions?
-
Multiple page library in one site
is there any way to create more than one page library in the same site programmatically in SharePoint 2013?? Mohamed Abdeen
-
I open Preview in full screen mode and open two files.
How do I switch between the files? In non full-screen mode I can press cmd +` but this does not work in full-screen. I can go to Windows and choose the one I want but that is inconvenient. I tried this in Mail and Windows does not work.
-
CCB- SECURITY-Update only certain fields in a Page (MO)
application: CCB Version 2.2.0 We have a requirement, the user will not have update access to an entire Screen/Maintenance object, let us consider the example as Account. The user should not be able to change any fields in that page. But he should ha
-
What application do I choose to download illustrator cc? when I try to download the app, I get a Launch Application window that says: this link needs to be opened with an application. Send to CreativeCloud(URIHandler) below I could click on Remeber m