Urgent- Exporting database tables
Hi There,
I am using Oracle 8.0.6. I want export a table from one server to another.(both are unix machines). How can I do it?
Thanx in advance
If a table is samll, then I would recommend you to create a dblink between them and use copy command to copy the table from one db to another.
Export:
exp system/password file=exp.dmp log=exp.dmp tables=username.table_name direct=y statistics=none
ftp the exp.dmp file in binary mode to other unix server.
imp username/password file=exp.dmp log=imp.dmp fromuser=username touser=username full=y
Do you have same user exists in both databases? Do you have same tablespaces exists on both databases?
When you import, it will look for the same tablespace as exported database tablespace. Otherwise, the user who is importing revome unlimited tablespace quota and use one tablespace. also, you have to include ignore=y in this scinario.
Jaffar
Similar Messages
-
How to Import/Export database tables from one server to other in oracle8i
Hello friend,
Please can any one tell me how to import/export groups of database tables from one server with oracle to another using VB.net. It would be nice if some one can provide some code of it.
I am a software developer and I am in middle of a large project development, in which I need to export a large oracle database from one server to another efficiently.
Its very urgent so please someone help me.At command prompt (source db)
set ORACLE_SID=db_name
exp system/password@db_name full=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\exp.log filesize=2000M
Then ftp the export dump files (in binary) to the other server or copy to target server over the network.
At command prompt (target db)
set ORACLE_SID=db_name
imp system/password@db_name full=y ignore=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\imp.log filesize=2000M
If the path names of the datafiles are going to be different in the target server (as compared to the source), then precreate the tablespaces before import. Set buffer value accordingly.
Message was edited by:
FeNiCrC_Neil -
Import and export the database table
I would like to know what is the syntax of using imp.exe and exp.exe to import and export the database table?
Could anyone teach me what is the syntax and how could do the export and import in the Forms?
Thanks a loT~try: imp help=yes
Or read the documentation online on OTN. -
Its very urgent:how to insert data into database tables
Hi All,
I am very new to oaf.
I have one requirement data insert into database tables.
here createPG having data that data insert into one custom table.
but i dont know how to insert data into database tables.
i wrote the code in am,co as follows.
in am i wrote the code:
public void NewoperationManagerLogic()
ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();
OADBTransaction oadbt=getOADBTransaction();
if(!vo1.isPreparedForExecution())
vo1.executeQuery();
Row row=vo1.createRow();
vo1.insertRow(row);
in createPG processrequest co:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
am.NewoperationManagerLogic();
process form request:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("Submit")!=null)
ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
am.getOADBTransaction().commit();
please help with an example(sample code).
its very urgent.
thanks in advance
Seshu
Edited by: its urgent on Dec 25, 2011 9:31 PMHi ,
1.)You must have to create a EO based on custom table and then VO based on this EO eventually to save the values in DB
2.) the row.setNewRowState(Row.STATUS_INITIALIZED); is used to set the the status of row as inialized ,this is must required.
3.) When u will create the VO based on EO the viewattributes will be created in VO which will be assigned to the fields to take care the db handling .
You must go thtough the lab excercise shipped with you Jdeveloper ,there is a example of Create Employee page ,that will solve your number of doubts.
Thanks
Pratap -
UrGENT-DUMP while querying database table into itab(Assigned field Symbol)
Hi,
__I am getting a dump whose description is as follows__-
"" In an SQL array select, the internal table used to hold the
selected records must be at least as wide as the database table
from which the records are being read.
In this particular case, the database table is 820 bytes wide,
but the internal table is only 814 bytes wide.""
The following code had been written:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_tabl TYPE dd02l-tabname. "Table Name
SELECTION-SCREEN END OF BLOCK b1.
FIELD-SYMBOLS: <fs_itab> TYPE STANDARD TABLE,
<fs_wa> TYPE ANY,
<fs_itab1> TYPE STANDARD TABLE,
<fs_wa1> TYPE ANY.
FORM generate_internal_tab .
DATA: o_itab TYPE REF TO data,
o_wa TYPE REF TO data,
o_itab1 TYPE REF TO data,
o_wa1 TYPE REF TO data.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_tabl
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*Create Dynamic Table for it_fcat
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = o_itab
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc EQ 0 OR o_itab IS NOT INITIAL.
ASSIGN o_itab->* TO <fs_itab>.
CREATE DATA o_wa LIKE LINE OF <fs_itab>.
ASSIGN o_wa->* TO <fs_wa>.
ENDIF.
*Download the file to Application server
SELECT *
FROM (p_tabl)
INTO TABLE <fs_itab>.
So i am geting a dump in placing contents of table(p_tabl) into <fs_itab>.Should the type declarations be changed???
Please give me an solution to resolve this dump.
Thanks and regards-
SumitaYou are trying to put more fields in the internal table than what is declared presently for itab. Check if one of the fields is selected but not being passed on to a internal table field.
-
Dear All,
I am newbie to oracle, my company wants to export few tables from 9.2.0.2 database to 10.2.02. ( they are using developer 2000 4.5/ and oracle reports 6i)
The puropose of this activity is to use forms and reports of 9i into 10g to check if it works.
The configuration of Test machine is core2duo processor, 2gb ram, 500gb hard disk.
I have few questions, as i am newbie am little afraid, so please help me,
what are the precautions i have to make before running export command on 9i database?
What are teh precautions i have to make before running import command on 10g database?
My manager wants me too export it with user,synonyms,grants,priveleges as it is production database? how to do that?
How to check what are the grants and privileges of a users in 9i?
My production database is on 9i and on solaris 10 i am going to install 10g database on windows xp as test instance, is it correct to do this way??
My manager said i should use NLS_LANG as AMERICAN_AMERICA.AR8MSWIN1256 as a character set while installing database.
Note:- I have installed oracle 10g from OTN.
Please help me as early as possible.
Regards,
user9007339No, that it doesn't mean. You will have to use the exact right version at the right time. From lower version to higher you need to use source db exp tool and target db imp. From higher to lower you need to use target db exp and target db imp.
In other words:
Always use exp from lowest version and imp from target version!
See Metalink, Note:132904.1 -
Export all the database tables into CSV
I am using Oracle 10 g Release 2
I need to expot all the database tables off of an oracle schema to it's corrosponding CSV files.
Can I use 'EXP U_name/pswd GRANTS=Y TABLES=(table_A,table_B,table_C)' .?
Any advise is a plus.
Thanks in advance
JayPl post OS and database versions.
If you have access to execute database export utilities, then use the TABLES parameter as you have indicated
exp - http://docs.oracle.com/cd/E11882_01/server.112/e22490/original_export.htm#sthref1927
expdp - http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_export.htm#sthref135
HTH
Srini -
Exporting data from database tables to a XML file
Hi,
We want to export data from Oracle database tables to an XML
file. What tool can we use for this purpose, and how do we go
about it ?
Can we extract data only from an Oracle8 database, or can we
extract data from Oracle7.3 databases too ?
Any help in this regard would be appreciated.
Thanks
Dipanjan
nullDipanjan (guest) wrote:
: Hi,
: We want to export data from Oracle database tables to an XML
: file. What tool can we use for this purpose, and how do we go
: about it ?
: Can we extract data only from an Oracle8 database, or can we
: extract data from Oracle7.3 databases too ?
: Any help in this regard would be appreciated.
: Thanks
: Dipanjan
Start by downloading the XML SQL Utility and make sure you have
the approriate JDBC 1.1 drivers installed for your database.
There are samples which will get you going included in the
archive.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
DRM Export to Database Table Error
Hi,
We were testing the DRM export functionality with target as a database table.
The connection was extablished successfully and few tables were selected.
Account hierarchy's parent and child were mapped with the parent and child columns of the table.
On running the export the following error came:
"1: Error during Export. Export was unable to run. Error: Invalid parameter binding Parameter name: P6"
If anyone has worked with this functionality before or understands this error, please let us know.
Any help would be appreciated.
thanks,
MayankMake sure the Datatype you have specified mataches with that of the table,
Thanks! -
Database Table where MRP Run results are saved-Urgent
Hi Gurus
i need your help in identifying the database table where the MRP Run results are saved , this is needed for creating a custom report similar to MD45(but for entire plant) where i can look and pull the sum of all the receipts and issues, ATP Quantity for a given material in a particular plant
and ignore zero quantities in the receipts and issues field
i tried in <b>MDTB</b> table, MDTB-MNG01 Quantity received or quantity required but it has no entries maintained in it and so it cannot be used.
So can you please help me with the table where i can get this information asap
thank you very much for your time and solutionPlease use the code below which will help you in extracting data from MRP table.
You can enhance this program basing on your requirement.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A sample program to extract data from the MRP table.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REPORT ZMRPTABLE.
TABLES: MDKP, "Header Data for MRP Document
MDTB, "MRP table
MDTC, "Aggregated MRP table items
T457T. "Description of MRP elements
DATA: BEGIN OF MDTBX OCCURS 0.
INCLUDE STRUCTURE MDTB.
DATA: END OF MDTBX.
SELECT-OPTIONS: PLANT FOR MDKP-PLWRK OBLIGATORY,
MATNR FOR MDKP-MATNR OBLIGATORY.
CLEAR: MDKP, MDTB.
SELECT * FROM MDKP WHERE DTART EQ 'MD'
AND MATNR IN MATNR
AND PLWRK IN PLANT.
WRITE:/ MDKP-MATNR, MDKP-PLWRK.
IF MDKP-CFLAG EQ 'X'.
CLEAR MDTBX. REFRESH MDTBX.
IMPORT MDTBX FROM DATABASE MDTC(AR) ID MDKP-DTNUM.
LOOP AT MDTBX.
MOVE MDTBX TO MDTB.
SELECT SINGLE * FROM T457T WHERE SPRAS = 'E'
AND DELKZ = MDTB-DELKZ.
IF MDTB-PLUMI = '-'. MULTIPLY MDTB-MNG01 BY -1. ENDIF.
WRITE:/ MDTB-DAT00, T457T-DELB1, MDTB-VSTAT,
MDTB-MNG01, MDTB-LGORT.
ENDLOOP.
ELSE.
SELECT * FROM MDTB
WHERE DTNUM EQ MDKP-DTNUM
ORDER BY PRIMARY KEY.
SELECT SINGLE * FROM T457T WHERE SPRAS = 'E'
AND DELKZ = MDTB-DELKZ.
IF MDTB-PLUMI = '-'. MULTIPLY MDTB-MNG01 BY -1. ENDIF.
WRITE:/ MDTB-DAT00, T457T-DELB1, MDTB-VSTAT,
MDTB-MNG01, MDTB-LGORT.
ENDSELECT.
ENDIF.
ENDSELECT.
This is taken from www.sap-img.com
Hope this helps you. -
1. i have one html page - in that two combo boxes are there
2. first one called--> Bank Name and second one called-->Main Branch
3. i have a database table like BANK_MASTER(MAIN_BRANCH,BANK_NAME)
i am giving here some data for the above table:
(sbi-kurnool, sbi),(sbi-cadapah,sbi),(sbi-chittor,sbi),(ab-rangareddy,ab),(ab-varangal,ab) ..like that every bank has its own main branch in different location.
MY PROBLEM:
In HTML page, in the first combo box ie., Bank Name will display all the bank name using the table BANK_MASTER ie.,sbi,ab,cb,sbh ...... (its ok - i too get )
main Problem: Whenever i select a particular bank name in the first combo box, the second combo box ie.,Main Branch has to display the main branches using the table Bank_Master depending on the Selected bank name from the Bank Name Combo box ( ie., if we select the sbi, it has to display all main branches of sbi's only, but not other bank's main branches)Hi friend,
I had a similar situation and i tried to solve it by using XmlHttpRequest Object(used in AJAX).
U can checkout the below example just for further reference delete
UserForm.jsp:
==========
<head>
<script>
var xmlHttp
function showState(str)
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
alert ("Browser does not support HTTP Request")
return
var url="getState.jsp"
url=url+"?count="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChange
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
function stateChange()
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("state").innerHTML=xmlHttp.responseText
</head>
<body>
<select name='country' onchange="showState(this.value)">
<option value='india>india</option>
</select>
<br>
<div id='state'>
<select name='state' >
<option value='-1'>pickone</option>
</select>
</div>
</body>
getState.jsp
============
<%@page language="java" import ="java.util.Hashtable" import ="java.util.Set" %>
<%
String country=request.getParameter("count");
response.setContentType("text/html");
response.setHeader("Cache-Control","no-cache");
try{
Hashtable ht = (Hashtable)session.getAttribute("<ATTRIBUTE_NAME>");
String buffer="<select name='state'><option value='-1'>Pick One</option>";
Set s=ht.keySet();
Object keys[]=s.toArray();
int size=keys.length;
for(int i=0; i < size;i++){
buffer=buffer+"<option value='"+ht.get(keys).toString()+"'>"+ht.get(keys).toString()+"</option>";
buffer=buffer+"</select>";
response.getWriter().println(buffer);
catch(Exception exp){
response.getWriter().println(exp);
%> I think u may go upon replacing country with your Main Branch and vice versa -
Dear all experts,
I am able to populate all fields data from database table, using dynamic table creation.
eg,
SELECT * FROM (w_tabname) INTO TABLE <t_itab>.
where w_tabname is the table name given by the user, and t_itab is field symbol.
but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
<b>I can</b> take those fields from file into any internal table,
but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
i have tried with field symbol, it is not working (as per my knowledge.)
do i need to create any structures dynamically ?
Can anybody please help in this regards ?
Your help will be surely rewarded with points.
Waiting for reply..
Regards
VinayHi Vinay ,
Adding to the below code , you can use some more fields in the select stmt as below:-
REPORT ychatest.
PARAMETERS : p_field1 LIKE dd03l-fieldname,
P_field2 LIKE dd03l-fieldname,
p_table LIKE dd03l-tabname.
FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
Now p_field1 & p_field2 belong to the same table since you have give the user to enter only one table name.
This should work fine.
please try & let me know .
Thanks & Regards,
Daniel -
Open Hub Destination export to database table
Hi Experts,
I would like to create a multi source universe between SAP and non-SAP system. As we know the Jco connection to create a relational connection to access infocube data is not that great. I'm thinking or may be wrong in my approach that I would like to create a open hub destination of type database table on top of the infocube so that I'll have a new OHD table (/BIC/OH*) is created in BW database. Here comes my question that, can I query this new table in BW database via universe by creating a relational connection to the BW database server ?
Please let me know your thoughts and suggestions!
Thanks,
AbhiHi
I would like to create a multi-source universe between SAP and non-SAP system.
Yes...In IDT...To build a universe on SAP NetWeaver BW, you must create a multisource-enabled data foundation based on a secured relational connection to SAP NetWeaver BW. Then build the business layer on this data foundation.
I would like to create an open hub destination of type database table on top of the infocube so that I'll have a new OHD table (/BIC/OH*) is created in BW database.
Creating universe on top of OHD tables is new idea, but while creating universe in IDT, we can able to select only below info providers.
Info Object
Info Cube
DSO
Multi Providers
Virtual Info providers
So we are not able to create universe on top of OHD tables. Please find the below screenshot.
Here comes my question that, can I query this new table in BW database via universe by creating a relational connection to the BW database server ?
No.....In 4.0 IDT, OHD tables is not one of the info provider to select while creating universe. So it’s not possible.
PLEASE mark the blog helpful & answered -
How to fetch the customer debit balances form the KNC1 database table
Hi Experts,
I am creating a ABAP report which would dispaly the customer credit balances for the currenct fiscal year.
I am fetching the values form KNC1 database table.....But in this table values are stored year wise.
But I want to display for the current fiscal year that means if teh user selects the 07/2011 as the month on the sleection screen then the debit balances from 072010 to 062011 should be dispalyed.
Could anyone please help me out to fetch this the debit balaces form KNC1 database table in the above format.
Or is there any other way to solve this problem?
Awating your urgent reply.
Many Thanks,
Komal.Hi Komal,
First, you have to compute the initial period and the final period.
Next, you must read table KNC1 for the years comprised between these two periods.
Last, you must read the fields of table KNC1. For that, you should compose dynamically the name of the field, and then ASSIGN it to a FIELD-SYMBOL.
Now, just add up the values!
Please try the following code:
FIELD-SYMBOLS: <fs>.
DATA: t_knc1 TYPE TABLE OF knc1 WITH HEADER LINE.
DATA: d_debits LIKE knc1-um01s.
PARAMETERS: p_kunnr LIKE knc1-kunnr,
p_bukrs LIKE knc1-bukrs,
p_spmon TYPE spmon.
DATA: l_fieldname(20) TYPE c.
DATA: l_date LIKE sy-datum,
l_date_from LIKE sy-datum,
l_date_to LIKE sy-datum.
DATA: l_period(2) TYPE n.
DATA: l_num_times TYPE i.
START-OF-SELECTION.
"Compute the initial and final periods
CONCATENATE p_spmon '01' INTO l_date.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
months = '-1'
olddate = l_date
IMPORTING
newdate = l_date_to.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
months = '-12'
olddate = l_date
IMPORTING
newdate = l_date_from.
"Read table KNC1
SELECT *
INTO CORRESPONDING FIELDS OF TABLE t_knc1
FROM knc1
WHERE kunnr = p_kunnr
AND bukrs = p_bukrs
AND gjahr BETWEEN l_date_from(4) AND l_date_to(4).
"this will yield at most 2 records, one for present year, and another one for the previous year.
"but if you select i.e. period '01.2012', initial_date = '01.01.2011' and final_date = '31.12.2011'
" --> thus only one year --> one record
CLEAR: d_debits.
LOOP AT t_knc1.
" If there's no year change
IF l_date_from(4) = l_date_to(4).
DO 16 TIMES.
l_period = sy-index.
CONCATENATE 'UM' "compute dynamically the field name
l_period
'S'
INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>. "assign
ADD <fs> TO d_debits. "and add up
ENDDO.
ELSE.
" If there IS a year change
IF t_knc1-gjahr = l_date_from+0(4).
l_num_times = 16 - l_date_from+4(2) + 1. "you must loop 16 - initial_period + 1 times for the first year
DO l_num_times TIMES.
l_period = sy-index + l_date_from+4(2) - 1.
CONCATENATE 'UM' "compute dynamically the field name
l_period
'S'
INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>. "assign
ADD <fs> TO d_debits. "and add up
ENDDO.
ELSE.
l_num_times = l_date_to+4(2). "you must loop final_period times for the second year
DO l_num_times TIMES.
l_period = sy-index.
CONCATENATE 'UM' "compute dynamically the field name
l_period
'S'
INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>. "assign
ADD <fs> TO d_debits. "and add up
ENDDO.
ENDIF.
ENDIF.
ENDLOOP.
You'll have the result on variable 'd_debits'.
I hope this helps. Kind regards,
Alvaro -
Program to upload csv file to internal table and insert into database table
Hi I'm writing a program where I need to upload a csv file into an internal table using gui_upload, but i also need this program to insert the data into my custom database table using the split command. Anybody have any samples to help, its urgent!
Hi,
Check this table may be it will give u an hint...
REPORT z_table_upload LINE-SIZE 255.
Data
DATA: it_dd03p TYPE TABLE OF dd03p,
is_dd03p TYPE dd03p.
DATA: it_rdata TYPE TABLE OF text1024,
is_rdata TYPE text1024.
DATA: it_fields TYPE TABLE OF fieldname.
DATA: it_file TYPE REF TO data,
is_file TYPE REF TO data.
DATA: w_error TYPE text132.
Macros
DEFINE write_error.
concatenate 'Error: table'
p_table
&1
&2
into w_error
separated by space.
condense w_error.
write: / w_error.
stop.
END-OF-DEFINITION.
Field symbols
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<data> TYPE ANY,
<fs> TYPE ANY.
Selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
PARAMETERS: p_file TYPE localfile DEFAULT 'C:\temp\' OBLIGATORY,
p_separ TYPE c DEFAULT ';' OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b01.
SELECTION-SCREEN: BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS: p_table TYPE tabname OBLIGATORY
MEMORY ID dtb
MATCHCODE OBJECT dd_dbtb_16.
SELECTION-SCREEN: END OF BLOCK b02.
SELECTION-SCREEN: BEGIN OF BLOCK b03 WITH FRAME TITLE text-b03.
PARAMETERS: p_create TYPE c AS CHECKBOX.
SELECTION-SCREEN: END OF BLOCK b03,
SKIP.
SELECTION-SCREEN: BEGIN OF BLOCK b04 WITH FRAME TITLE text-b04.
PARAMETERS: p_nodb RADIOBUTTON GROUP g1 DEFAULT 'X'
USER-COMMAND rg1,
p_save RADIOBUTTON GROUP g1,
p_dele RADIOBUTTON GROUP g1.
SELECTION-SCREEN: SKIP.
PARAMETERS: p_test TYPE c AS CHECKBOX,
p_list TYPE c AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: END OF BLOCK b04.
At selection screen
AT SELECTION-SCREEN.
IF sy-ucomm = 'RG1'.
IF p_nodb IS INITIAL.
p_test = 'X'.
ENDIF.
ENDIF.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Start of selection
START-OF-SELECTION.
PERFORM f_table_definition USING p_table.
PERFORM f_upload_data USING p_file.
PERFORM f_prepare_table USING p_table.
PERFORM f_process_data.
IF p_nodb IS INITIAL.
PERFORM f_modify_table.
ENDIF.
IF p_list = 'X'.
PERFORM f_list_records.
ENDIF.
End of selection
END-OF-SELECTION.
FORM f_table_definition *
--> VALUE(IN_TABLE) *
FORM f_table_definition USING value(in_table).
DATA: l_tname TYPE tabname,
l_state TYPE ddgotstate,
l_dd02v TYPE dd02v.
l_tname = in_table.
CALL FUNCTION 'DDIF_TABL_GET'
EXPORTING
name = l_tname
IMPORTING
gotstate = l_state
dd02v_wa = l_dd02v
TABLES
dd03p_tab = it_dd03p
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
IF l_state NE 'A'.
write_error 'does not exist or is not active' space.
ENDIF.
IF l_dd02v-tabclass NE 'TRANSP' AND
l_dd02v-tabclass NE 'CLUSTER'.
write_error 'is type' l_dd02v-tabclass.
ENDIF.
ENDFORM.
FORM f_prepare_table *
--> VALUE(IN_TABLE) *
FORM f_prepare_table USING value(in_table).
DATA: l_tname TYPE tabname,
lt_ftab TYPE lvc_t_fcat.
l_tname = in_table.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = l_tname
CHANGING
ct_fieldcat = lt_ftab
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
WRITE: / 'Error while building field catalog'.
STOP.
ENDIF.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_ftab
IMPORTING
ep_table = it_file.
ASSIGN it_file->* TO <table>.
CREATE DATA is_file LIKE LINE OF <table>.
ASSIGN is_file->* TO <data>.
ENDFORM.
FORM f_upload_data *
--> VALUE(IN_FILE) *
FORM f_upload_data USING value(in_file).
DATA: l_file TYPE string,
l_ltext TYPE string.
DATA: l_lengt TYPE i,
l_field TYPE fieldname.
DATA: l_missk TYPE c.
l_file = in_file.
l_lengt = strlen( in_file ).
FORMAT INTENSIFIED ON.
WRITE: / 'Reading file', in_file(l_lengt).
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = it_rdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
WRITE: /3 'Error uploading', l_file.
STOP.
ENDIF.
File not empty
DESCRIBE TABLE it_rdata LINES sy-tmaxl.
IF sy-tmaxl = 0.
WRITE: /3 'File', l_file, 'is empty'.
STOP.
ELSE.
WRITE: '-', sy-tmaxl, 'rows read'.
ENDIF.
File header on first row
READ TABLE it_rdata INTO is_rdata INDEX 1.
l_ltext = is_rdata.
WHILE l_ltext CS p_separ.
SPLIT l_ltext AT p_separ INTO l_field l_ltext.
APPEND l_field TO it_fields.
ENDWHILE.
IF sy-subrc = 0.
l_field = l_ltext.
APPEND l_field TO it_fields.
ENDIF.
Check all key fields are present
SKIP.
FORMAT RESET.
FORMAT COLOR COL_HEADING.
WRITE: /3 'Key fields'.
FORMAT RESET.
LOOP AT it_dd03p INTO is_dd03p WHERE NOT keyflag IS initial.
WRITE: /3 is_dd03p-fieldname.
READ TABLE it_fields WITH KEY table_line = is_dd03p-fieldname
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
FORMAT COLOR COL_POSITIVE.
WRITE: 'ok'.
FORMAT RESET.
ELSEIF is_dd03p-datatype NE 'CLNT'.
FORMAT COLOR COL_NEGATIVE.
WRITE: 'error'.
FORMAT RESET.
l_missk = 'X'.
ENDIF.
ENDLOOP.
Log other fields
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: /3 'Other fields'.
FORMAT RESET.
LOOP AT it_dd03p INTO is_dd03p WHERE keyflag IS initial.
WRITE: /3 is_dd03p-fieldname.
READ TABLE it_fields WITH KEY table_line = is_dd03p-fieldname
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
WRITE: 'X'.
ENDIF.
ENDLOOP.
Missing key field
IF l_missk = 'X'.
SKIP.
WRITE: /3 'Missing key fields - no further processing'.
STOP.
ENDIF.
ENDFORM.
FORM f_process_data *
FORM f_process_data.
DATA: l_ltext TYPE string,
l_stext TYPE text40,
l_field TYPE fieldname,
l_datat TYPE c.
LOOP AT it_rdata INTO is_rdata FROM 2.
l_ltext = is_rdata.
LOOP AT it_fields INTO l_field.
ASSIGN COMPONENT l_field OF STRUCTURE <data> TO <fs>.
IF sy-subrc = 0.
Field value comes from file, determine conversion
DESCRIBE FIELD <fs> TYPE l_datat.
CASE l_datat.
WHEN 'N'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
WRITE l_stext TO <fs> RIGHT-JUSTIFIED.
OVERLAY <fs> WITH '0000000000000000'. "max 16
WHEN 'P'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
TRANSLATE l_stext USING ',.'.
<fs> = l_stext.
WHEN 'F'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
TRANSLATE l_stext USING ',.'.
<fs> = l_stext.
WHEN 'D'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
TRANSLATE l_stext USING '/.-.'.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = l_stext
IMPORTING
date_internal = <fs>
EXCEPTIONS
OTHERS = 1.
WHEN 'T'.
CALL FUNCTION 'CONVERT_TIME_INPUT'
EXPORTING
input = l_stext
IMPORTING
output = <fs>
EXCEPTIONS
OTHERS = 1.
WHEN OTHERS.
SPLIT l_ltext AT p_separ INTO <fs> l_ltext.
ENDCASE.
ELSE.
SHIFT l_ltext UP TO p_separ.
SHIFT l_ltext.
ENDIF.
ENDLOOP.
IF NOT <data> IS INITIAL.
LOOP AT it_dd03p INTO is_dd03p WHERE datatype = 'CLNT'.
This field is mandant
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-mandt.
ENDLOOP.
IF p_create = 'X'.
IF is_dd03p-rollname = 'ERDAT'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-datum.
ENDIF.
IF is_dd03p-rollname = 'ERZET'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uzeit.
ENDIF.
IF is_dd03p-rollname = 'ERNAM'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uname.
ENDIF.
ENDIF.
IF is_dd03p-rollname = 'AEDAT'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-datum.
ENDIF.
IF is_dd03p-rollname = 'AETIM'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uzeit.
ENDIF.
IF is_dd03p-rollname = 'AENAM'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uname.
ENDIF.
APPEND <data> TO <table>.
ENDIF.
ENDLOOP.
ENDFORM.
FORM f_modify_table *
FORM f_modify_table.
SKIP.
IF p_save = 'X'.
MODIFY (p_table) FROM TABLE <table>.
ELSEIF p_dele = 'X'.
DELETE (p_table) FROM TABLE <table>.
ELSE.
EXIT.
ENDIF.
IF sy-subrc EQ 0.
FORMAT COLOR COL_POSITIVE.
IF p_save = 'X'.
WRITE: /3 'Modify table OK'.
ELSE.
WRITE: /3 'Delete table OK'.
ENDIF.
FORMAT RESET.
IF p_test IS INITIAL.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
WRITE: '- test only, no update'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE.
WRITE: /3 'Error while modifying table'.
FORMAT RESET.
ENDIF.
ENDFORM.
FORM f_list_records *
FORM f_list_records.
DATA: l_tleng TYPE i,
l_lasti TYPE i,
l_offst TYPE i.
Output width
l_tleng = 1.
LOOP AT it_dd03p INTO is_dd03p.
l_tleng = l_tleng + is_dd03p-outputlen.
IF l_tleng LT sy-linsz.
l_lasti = sy-tabix.
l_tleng = l_tleng + 1.
ELSE.
l_tleng = l_tleng - is_dd03p-outputlen.
EXIT.
ENDIF.
ENDLOOP.
Output header
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: /3 'Contents'.
FORMAT RESET.
ULINE AT /3(l_tleng).
Output records
LOOP AT <table> ASSIGNING <data>.
LOOP AT it_dd03p INTO is_dd03p FROM 1 TO l_lasti.
IF is_dd03p-position = 1.
WRITE: /3 sy-vline.
l_offst = 3.
ENDIF.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data> TO <fs>.
l_offst = l_offst + 1.
IF is_dd03p-decimals LE 2.
WRITE: AT l_offst <fs>.
ELSE.
WRITE: AT l_offst <fs> DECIMALS 3.
ENDIF.
l_offst = l_offst + is_dd03p-outputlen.
WRITE: AT l_offst sy-vline.
ENDLOOP.
ENDLOOP.
Ouptut end
ULINE AT /3(l_tleng).
ENDFORM.
Regards,
Joy.
Maybe you are looking for
-
Hi Experts, I have a requirement where I need to connect the existing BI system to the new proposed BI system. I am told about the open hub services. But i believe there could be a better way of doing. Can you help me how to connect existing BI sy
-
Print layout design - AR Invoice
How to retrieve & display Business partner TNGST & CST Numbers in AR invoice Design,I have no reference to BP code in AR Invoice? (Table name - CRD7 - Fiscal ID of BP Master data)
-
Hi EveryOne, I need some help ,i want to get chart in this way , me not getting the idea how to do it. me giving the url please check it out . Thanks in avance. http://www.profiler.noaa.gov/npn/servlet/TimeSeriesServlet?beam=1&bgndColor=-w&blpprofile
-
Itunes will not update to itunes 10.5?
I've tried restarting my computer which is working on (Windows). Nothing is working I tried to restore my phone still nothing.
-
Cannot convert mx.messaging.messages::AcknowledgeMessage
I need to call upon the wiser people in these forums again. I'm getting the message TypeError: Error #1034: Type Coercion failed: cannot convert mx.messaging.messages::AcknowledgeMessage@21501561 to mx.messaging.messages.IMessage. when I call a logou