Table column missng after input
Hi All,
I am working on ecc6 va01 transaction. We are using bespoke screen for sales order.
Problem is i am able to enter the product and quantity when i press enter ,material number is not visible and rest of the details are fine.
Table is vbap and I can see the values while debugging can anyone suggest the solution.
Thanks
Ritika
Edited by: ritika red on Jun 16, 2010 11:48 AM
Hi Ritika,
for this problem consult with ur SD consultant how he does configure it and he can solve ur problem by configure it again .
Thanks.
Girish
Similar Messages
-
OBIEE changes table column attributes after importing to rpd
Hello guys
Something interesting is happening in our OBIEE environment. There are a couple of tables we import into physical layer, after importing these tables, all the column data length gets to set to '0' and all nullable becomes 'false'. I have changed these table in the DB and there are all correct. I have also taken a copy of this rpd and test in my own local environment with the same connection pool setting, I was able to import those same tables from the same DB and the attributes remain correct.
However, when we import these tables again in our rpd in unix environment, it is again overiding all the column data length to 0 and nullable to false..
Any clues on how to investigate?Was it when it was still Siebel Analytics?
I see that it is a known issue, Any luck recalling the solutions so far? -
Standard Input Help on a table column.
Hello,
Requirement is to provide a Standard Input Help on a Table Column in Web UI. The Context node is a Value node and that column should be in editable mode.
And how can I get standard search in Web UI that is available in GUI for searching the Transaction No. in T- Code CRMD_ORDER.
Pl. help.
Thanks & Regards
AnkitHi Ankit,
If you are asking about DDIC search help, then you need to use method GETV_XYZ of the context node attribute.
Have a look on below written code:
data:
ls_map type IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING,
lt_inmap type IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB,
lt_outmap type IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB.
ls_map-context_attr = 'struct.countryorigin'.
ls_map-f4_attr = 'LAND1'. ( Search help Parameter, in your case it will be Transcation no.)
append ls_map to: lt_inmap, lt_outmap.
create object rv_valuehelp_descriptor type
CL_BSP_WD_VALUEHELP_F4DESCR
exporting
iv_help_id = 'H_T005_LAND'
iv_help_id_kind = IF_BSP_WD_VALUEHELP_F4DESCR=>HELP_ID_KIND_NAME
iv_input_mapping = lt_inmap
iv_output_mapping = lt_outmap.
Regards,
Saurabh -
How to control internal table columns dynamically based on input
i have 2 fields in the selection screen - user and tcode
we can give any number of tcodes as in put
based on requirement i need to display all the tcodes belongs to one user in one row
in other words
the out put table columns should increase dynamically based on number of tcodes entered
in the input
how to do this?
Edited by: tummala swapna on Apr 7, 2009 11:55 AMThis may be useful to you..
FIELD-SYMBOLS : <FS_TABLE> TYPE ANY TABLE.
DATA: DREF TYPE REF TO DATA,
WA_DREF TYPE REF TO DATA,
DY_LINE TYPE REF TO DATA,
ITAB_TYPE TYPE REF TO CL_ABAP_TABLEDESCR,
WA_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
STRUCT_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
ELEM_TYPE TYPE REF TO CL_ABAP_ELEMDESCR,
COMP_TAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE,
COMP_FLD TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
OTAB TYPE ABAP_SORTORDER_TAB,
OLINE TYPE ABAP_SORTORDER.
BEGIN DYNAMIC STRUCTURE FOR FINAL INTERNAL TABLE @@@@@@@@@@@@@@@@@@
STRUCT_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME('table or structure name').
COMP_TAB = STRUCT_TYPE->GET_COMPONENTS( ).
STRUCT_TYPE = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
ITAB_TYPE = CL_ABAP_TABLEDESCR=>CREATE( STRUCT_TYPE ).
CREATE DATA DREF TYPE HANDLE ITAB_TYPE.
ASSIGN DREF->* TO <FS_TABLE>.
END DYNAMIC STRUCTURE FOR FINAL INTERNAL TABLE @@@@@@@@@@@@@@@@@@ -
ORA-22275 inserting into the CLOB column using ODBC input parameters
Hi all,
I'm having problem with INSERT into the CLOB column via bound input parameters.
After calling SQLExecDirect() I'm getting following error:
[Oracle][ODBC][Ora]ORA-22275: invalid LOB locator specified
Adding defaults to the table definitions does not help. If I embed parameter values into the SQL statement - everything works just fine.
I use Oracle 9.2 with latest Oracle ODBC driver 9.2.0.4 under Windows XP.
Any ideas appreciated...
Vlad
Code looks like this:
SQLBindParameter(hstmt,1,...);
SQLBindParameter(hstmt,2,...);
SQLBindParameter(hstmt,3,...);
SQLExecDirect(hstmt,...);
SQL statement looks like this:
insert into tst_table (id,str_fld,clob_fld1,clob_fld2) values (50, ? , ? , ?)
Table looks like this:
CREATE TABLE tst_table (
id number (10,0) NOT NULL ,
str_fld nvarchar2 (50) NOT NULL ,
clob_fld1 nclob NOT NULL ,
clob_fld2 nclob NOT NULL ,
CONSTRAINT PK_tst_table PRIMARY KEY
id
I tried to add defaults to the table, but result is the same:
CREATE TABLE tst_table (
id number (10,0) NOT NULL ,
str_fld nvarchar2 (50) NOT NULL ,
clob_fld1 nclob default EMPTY_CLOB() NOT NULL ,
clob_fld2 nclob default EMPTY_CLOB() NOT NULL ,
CONSTRAINT PK_tst_table PRIMARY KEY
idYou need to provide the data at execution time (i.e. SQL_LEN_DATA_AT_EXEC(0) in the SQLBindParameter followed by a series of SQLPutData calls). If you go to Metalink
Top Tech Docs | Oracle ODBC Driver | Scripts & Sample Code
has some sample code that shows you how to do this.
Justin -
Hi Experts,
I'm implementing SAP note 1990492 which requires manual implementation. Implementation includes modifying standard tables (i.e. append
the structure FIEU_S_APP_H to table FIEUD_FIDOC_H). After this I've adjusted the table in SE14 (Database Utility). I've done checks in SE14 and it shows the table is consistent.
But during DB02 -> Space folder -> Single table analysis -> Input table name -> Indexes tab -> Upon clicking statistics, there is a warning "Column statistics not found for table".
Our basis team is implementing an Add-On in the development system related to RWD Context Sensitive Help. They cannot proceed due to the following inconsistencies found in the table.
Screenshot error from the activity:
Screenshot from DB02:
I'm an ABAP developer and have no other ideas on what to do. Thanks in Advanced.Hi All,
We were able to fix the issue through the following:
1. Call transaction
SE14.
2. Enter the name of
the table and choose "Edit".
3. Choose
"Indexes".
4. Select the index
and choose "Choose (F2)".
5. If you choose
"Activate and adjust", the system creates the index again and it is
consistent.
6. Check the object
log of this activation.
7. If an error
occurs, eliminate the cause and reactivate the index. -
Setting new cell variant for an alv table column
Hi,
I want to set a new cell variant for a column. Therefore I did the following steps:
1. Create an object of CL_SALV_WD_CV_STANDARD
2. SET_KEY( 'CELLVAR1 )
3. set_cell_design([..]-goodvalue_medium )
4. SET_EDITOR( lr_alv_input_field )
After that I added the cell variant to the column by using the method "add_cell_variant".
The last step is to call method SET_SELECTED_CELL_VARIANT.
I checked my program by using get_selected_cell_variant( ) and the return string was okay.
But when the table is displayed, the new cell variant isn't working. I defined an input field as the cell editor for my new cell variant but when the table is shown, it is just text - no input possible. In addition to that the selected cell design (goodvalue_medium , step 3) isn't working. So I think the cell variant is not used.
Can you help me?
Thanks & Regards,
HendrikHi
I wonder if you can help me please, I too am having issues implementing ALV cell changes in WDA?
I am basically trying to dynamically change the individual color of a cell (not the entire column or row) dependant on certain criteria. I apologies but find that you are the closest resource for any potential information. Please see screen shot below.
Currently my code is as follows:
see: www.picasaweb.google.co.uk/dave.alexander69/Pictures#5244416971466907938
data: lr_cv TYPE REF TO cl_salv_wd_cv_standard.
loop at table 1 row data
loop at table columns
for the date columns only...
IF <fs_column>-id(4) = 'CELL'.
get and set column header dates from select option user input - done
loop at table 2 row data (table 2 contains date ranges for row concerned)
MOVE: ls_zdata-variance TO lv_variance.
method 1 - as in sap press WD4A -:
lr_cv = cl_wd_table_standard_cell=>new_table_standard_cell(
view = view
variant_key = lv_variance ).
as mentioned...
CREATE OBJECT lr_cv.
lr_cv->set_key( 'VARIANCE' ).
lr_cv->set_cell_design( '09' ).
lr_cv->set_editor( lr_input_field ).
lr_column->add_cell_variant( lr_cv ).
lr_column->set_cell_editor( lr_input_field ).
lr_column->set_sel_cell_variant_fieldname( 'VARIANCE' ).
lr_column->set_cell_design_fieldname( value = 'COLOR_CELL' ).
lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
the only way I get cell coloring to work - but this is for entire column?
ls_zdata-color_cell = cl_wd_table_standard_cell=>e_cell_design-one.
MODIFY lt_zdata FROM ls_zdata..
ENDLOOP.
ENDIF.
IF <fs_column>-id = 'COLOR_CELL'.
CALL METHOD lr_column->set_visible( EXPORTING value = '00' ).
ENDIF.
ENDLOOP
ENDLOOP.
As you see I am in the dark a bit regarding cell variants and wonder if you can point me in a better direction.
Many thanks for any help,
Dave Alexander -
Urgent Help Required for Check Box in Table Column
Hi all,
Could any body help me to solve my problem?
First of all I have created a table whose one column is check box. The column of the tables are Name,Phone,ID,Address and a checkBox columns.In one view
the table will be found with data. I want to click on some of the rows(suppose there are 5 rows, but based on some condition I have selected the check box of 3 rows).
Next there will be a button(Supose SEND Button).
After selecting the check box I want to press that button and then a new window will come which will show two tables. one for selected rows(with the same columns name except check box) and another for Unchecked rows with the same column name(Name,Phone,ID,Address).
Could any body help me by sending the details and code?
Thanks and Regards.
SudipHi Sudip,
1) create custom controller and appropriate context structure there (dataNode(Name,Phone,ID,Address,Check))
2) create view StartView. Map data node from custom controller to node in view. Create table and bind context node attributes to appropriate table columns.
3) create view ResultView. Map data node from custom controller to node in view. Create 2 nodes (CheckedData, UncheckedData) with supply methods. Create filtering implementation in supply methods (add checked and unchecked node elements to appropriate nodes).
4) create new window with resultView as default view
4) in startView in button action handler put something like
IWDWindowInfo _windowInfo = wdComponentAPI.getComponentInfo().findInWindows("Popup");
IWDWindowManager manager = wdComponentAPI.getWindowManager();
IWDWindow _window = manager.createWindow(_windowInfo, true);
_window.open();
So, just tried localy and it works.
Best regards, Maksim Rashchynski. -
Table Column - Different UI elements in a column
Hi,
I have the following requirement. I need to create a table shown below.
COLUMN1 COLUMN2
ROW1 cell11 cell21
ROW2 cell12 cell22
I need cell11 and cell22 to be textviews and cell12 and cell21 to be inputfields. In other words, I need different cells in a table column to be of different types.
How do I do this.
ThankHi,
An easier way to switch between input field and text view is to just bind the readOnly property. Why actually switch between InputField and TextView.
Create an attribute 'EDITABLE' type Boolean in the node that is bound to the table.
1.Create all the cell editors as input field.
2.Bind the readOnly poperty with the attribuite 'EDITABLE'
3.Now pass abap_true to make it a text view and abap_false to make in input enabled.
However it is possible to switch between different UI elements using Cell Variant .
Check these links:
[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/85/48a841c1dae034e10000000a1550b0/frameset.htm]
[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/56/5e9041d3c72e7be10000000a1550b0/frameset.htm]
[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0e7461d-5e6c-2b10-dda9-9e99df4d136d]
Regards,
Radhika.
Edited by: Radhika Vadher on May 6, 2009 7:49 AM -
How to delete a row in table control(accepts only input)?
Hi All,
I have an empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output:
http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
ELSE.
"EXIT FROM STEP-LOOP.
CLEAR ZQID_CHECK.
ENDIF.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
CHAIN.
MODULE CHECK_ENTRIES ON CHAIN-INPUT.
MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
MODULE DELETE_ROW ON CHAIN-INPUT
ENDCHAIN.
ENDLOOP.
module CHECK_ENTRIES input.
CASE ok_code.
WHEN 'DEL'.
PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
ZQID_CHECK-LICHA
ZQID_CHECK-LIFNR.
ENDCASE.
endmodule.
form F_FILL_ITABCREATE using us_zqid_check_matnr LIKE MARA-MATNR
us_zqid_check_licha LIKE MCHA-LICHA
us_zqid_check_lifnr LIKE LFA1-LIFNR.
MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
us_zqid_check_licha TO WA_ID_CHECK-LICHA,
us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
APPEND WA_ID_CHECK TO T_ID_CHECK.
CLEAR WA_ID_CHECK.
endform.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
DELETE T_ID_CHECK.
ENDLOOP.
endmodule.
Edited by: Jaime Cabanban on Jan 7, 2010 8:46 PMDebugging the PBO part after deletion will help you know why the rows are getting deleted
This is the sap doc answer for you question regarding LINE.
Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT <itab> the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.
Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT <itab>. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control. -
Can we have more than 1 UI element in a single table column?
Hi All,
For example, I want to have IMAGE, ProgressIndicator and LinkToAction together as a template in a table column.
I already tried without success. I could only add single UI elements. After that, tools won't let me do it.
Any help or suggestion will be appreciated.
SubHi
You can have at one time only one UI element in the table.
if you want to have more than one type of editors in the table then you can use table cell editors as suggested above.
but i guess you are referring here to grouping more than one UI element in one editor or one column.
i think that is not possible as such.
How ever what you can do is, make use of the TABLECOLUMNGROUP.
instead of adding column directly to the table use TABLECOLUMNGROUP and add columns to this.
create three table column for three UI elements you are reffering here and put them in this one TABLECOLUMNGROUP.
and add rest of the column straight to the table.
thanks
sarbjeet -
Please help me I am not seeing Database table column names in field explorer view
Hi,
I am developing a crystal report using eclipse and sql server. After creating connection, when i drag and drop tables, The table name and its columns should apper in field explorer view. Then we drag the columns onto crystal report. Unfortunately I am just seeing only table names but not column names in field explorer view. Could anyone help me?
After downloading eclipse I have plugged in the crystal report using the following instructions
1. Click on the Help menu, and then Software Updates > Find and Install... to open the Install/Update wizard.
2. Select Search for new features to install and click Next.
3. Click the New Remote Site button. This will launch the New Update Site wizard
4. Type the Business Objects Updsate Site for the Name field and the following for the URL: http://www.businessobjects.com/products/dev_zone/eclipse/
5. Click OK to complete the wizard.
6. Enable the newly created Business Objects Update Site checkbox as well as the Callisto Discovery Site (which should appear by default with Eclipse 3.2) and click Finish.
Expand the Business Objects Update Site node and enable the Crystal Reports for Eclipse 1.0.0v555 checkbox.
8. Expand the Callisto Discovery Site and click the button "Select Required". This will automatically select the required Eclipse features necessary to successfully install Crystal Reports for Eclipse.
Thank You
Rajavardhan SarkapallyNow we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view.
If you are using SQL Server 2012/2014, then you can use
sys.dm_exec_describe_first_result_set (Transact-SQL) to gte the informations.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Trigger how to get new and old value for nested table column?
Hi,
I have created a nested table based on the following details:
CREATE TYPE typ_item AS OBJECT --create object
(prodid NUMBER(5),
price NUMBER(7,2) )
CREATE TYPE typ_item_nst -- define nested table type
AS TABLE OF typ_item
CREATE TABLE pOrder ( -- create database table
ordid NUMBER(5),
supplier NUMBER(5),
requester NUMBER(4),
ordered DATE,
items typ_item_nst)
NESTED TABLE items STORE AS item_stor_tab
INSERT INTO pOrder
VALUES (800, 80, 8000, sysdate,
typ_item_nst (typ_item (88, 888)));
Now I would like to create a trigger on table pOrder for after insert or update or delete
and I would like to track the new and old value for the columns inside nested table.
Can anybody direct me how to do it?
I would like to know the sytax for it like:
declare
x number;
begin
x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
end;
Hope my question is clear.
Thanks,
LavanHi,
Try like this:
CREATE OR REPLACE TRIGGER PORDER_I
BEFORE INSERT
ON PORDER
REFERENCING OLD AS old NEW AS new
FOR EACH ROW
DECLARE
items_new typ_item_nst;
ordid_NEW NUMBER;
BEGIN
FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price: ' || :new.items(I).price );
END LOOP;
END;Regards,
Peter -
Table Column Header Text - Refresh Table
Hi. A question about programmatically changing the Header Text property of a Table Component.
I've added code, in the backing bean Setter for the Table component, to change the header text as required.
The problem is that when the page is rendered, the header changes are not displayed initially. Only after a PPR is performed (on a different component) does the table render with my property changes displayed.
Am I doing the header text manipulation in the wrong place? Is there a way to refresh the table programmatically prior to it rendering initially (e.g. after the RENDER_RESPONSE phase?)?
Cheers.Hi Bala,
After following your invaluable advice I now have the table displaying more or less as a I need. The labels are set correctly (from the Attribute Hint that I set in the AttrDefImpl), and the Rendered property for each column is now derived from Expression Language pointing to the same AttributeHints...
However, I'm still struggling with the DisplayIndex for the table columns. I'm attempting to set the DisplayIndex column property using EL that gets a value from the VO binding FieldOrder control attribute (which contains a numeric value). However, this does not resolve properly and in the column Property Inspector the DisplayIndex doesn't seem to display correctly itself...
I'm wondering if this is because the FieldOrder control attribute is a String while the DisplayIndex takes an Integer. Is there a way to perform some conversion on this in the EL itself? Or maybe that is not the problem.
Thanks again for all your assistance! -
I am developing an ETL tool which has to create SSIS packages dynamically (and later execute them without being edited in Data Tools). One of my proto type scenarios is a simple data flow from a flat file to a flat file - without anything in between.
However there is a problem with the columns of the flat file destination - it says it doesn't have any.
Saving the package to XML and opening the destination component in the advanced editor (tab "Input and Output Properties") really shows that are no input columns defined. One click on the tab "Column Mappings" however solves the
problem. The columns and the mapping are generated, the package can run.
I already tried to place "ReinitializeMetaData()" calls nearly anywhere in the code, for both components, unfortunately without success:
destinationComponentWrapper.AcquireConnections(null);
destinationComponentWrapper.ReinitializeMetaData();
destinationComponentWrapper.ReleaseConnections();
The actual error during validation is (When the line for column mapping in the code below is commented out):
"0xC020201B - The number of input columns for Flat File Destination.Inputs[Flat File Destination Inputs] cannot be zero"
I am also trying to insert a column mapping - this leads to a com error: 0xC020201B
In this case I am wondering why Data Tools tell me that there are no input columns yet I can iterate over them - they just don't have a valid ID (0x8000004B / -2147483573) which is then causing the 0xC020201B.
See also "PROBLEM HERE" marker in the code below.
How can I make the destination component recognize the columns programmatically, as when I click on the "Column Mappings" tab of the advanced editor of the component in Data Tools?
Here is the complete proto type code:
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dts = Microsoft.SqlServer.Dts;
namespace msdatapipe
class Program
static void Main(string[] args)
Dts.Runtime.Application application = new Dts.Runtime.Application();
Dts.Runtime.Package package = new Dts.Runtime.Package();
package.Name = "Data Commander DTS Package";
// ADD PIPELINE TASK
Dts.Runtime.Executable pipelineExecutable = package.Executables.Add("STOCK:PipelineTask");
Dts.Runtime.TaskHost pipelineTaskHost = (Dts.Runtime.TaskHost)pipelineExecutable;
pipelineTaskHost.Name = "Data Commander Pipeline Task";
Dts.Pipeline.Wrapper.MainPipe pipelineTask = (Dts.Pipeline.Wrapper.MainPipe) pipelineTaskHost.InnerObject;
// ADD SOURCE COMPONENT TO THE PIPELINE TASK
String sourceFilePath = "C:\\cmi\\tmp\\data.csv";
Dts.Runtime.ConnectionManager sourceConnectionManager = package.Connections.Add("FLATFILE");
sourceConnectionManager.ConnectionString = sourceFilePath;
sourceConnectionManager.Name = "Source Connection";
sourceConnectionManager.Description = "Source Connection Manager";
sourceConnectionManager.Properties["ColumnNamesInFirstDataRow"].SetValue(sourceConnectionManager, "True");
sourceConnectionManager.Properties["Format"].SetValue(sourceConnectionManager, "Delimited");
sourceConnectionManager.Properties["TextQualifier"].SetValue(sourceConnectionManager, "\"");
sourceConnectionManager.Properties["CodePage"].SetValue(sourceConnectionManager, "65001");
sourceConnectionManager.DelayValidation = false;
// START --- MANUALLY READ COLUMNS FROM TEXT FILE AND ADD TO SOURCE CONNECTION MANAGER COLUMNS
IDTSConnectionManagerFlatFile100 sourceConnectionInterface = sourceConnectionManager.InnerObject as IDTSConnectionManagerFlatFile100;
using (StreamReader reader = new StreamReader(sourceFilePath))
String firstSourceFileLine = reader.ReadLine();
String[] columnNames = firstSourceFileLine.Split(',');
for (int i = 0; i < columnNames.Length; ++i)
columnNames[i] = columnNames[i].Substring(1, columnNames[i].Length - 2);
IDTSConnectionManagerFlatFileColumns100 sourceColumns = sourceConnectionManager.Properties["Columns"].GetValue(sourceConnectionInterface) as IDTSConnectionManagerFlatFileColumns100;
IDTSConnectionManagerFlatFileColumn100 column = null;
foreach (String columnName in columnNames)
column = sourceColumns.Add();
column.DataType = DataType.DT_TEXT;
column.ColumnDelimiter = ",";
column.TextQualified = true;
(column as IDTSName100).Name = columnName;
Console.WriteLine(columnName);
column.ColumnDelimiter = "\r\n";
// END --- MANUALLY READ COLUMNS FROM TEXT FILE AND ADD TO SOURCE CONNECTION MANAGER COLUMNS
sourceConnectionInterface.RowDelimiter = "\r\n";
Dts.Pipeline.Wrapper.IDTSComponentMetaData100 sourceComponent = pipelineTask.ComponentMetaDataCollection.New();
sourceComponent.Name = "Flat File Source";
sourceComponent.ComponentClassID = "DTSAdapter.FlatFileSource";
sourceComponent.ValidateExternalMetadata = true;
CManagedComponentWrapper sourceComponentWrapper = sourceComponent.Instantiate();
sourceComponentWrapper.ProvideComponentProperties();
// LINK CONNECTION TO THE SOURCE COMPONENT
sourceComponent.RuntimeConnectionCollection[0].ConnectionManager = Dts.Runtime.DtsConvert.GetExtendedInterface(sourceConnectionManager);
sourceComponent.RuntimeConnectionCollection[0].ConnectionManagerID = sourceConnectionManager.ID;
// Connect to the data source, and then update the metadata for the source.
//sourceComponentWrapper.Validate();
//sourceComponentWrapper.ProvideComponentProperties();
sourceComponentWrapper.AcquireConnections(null);
sourceComponentWrapper.ReinitializeMetaData();
sourceComponentWrapper.ReleaseConnections();
// ADD DESTINATION CONNECTION MANAGER
Dts.Runtime.ConnectionManager destinationConnectionManager = package.Connections.Add("FLATFILE");
destinationConnectionManager.ConnectionString = "C:\\cmi\\tmp\\data_out.csv";
destinationConnectionManager.Name = "DatComConOut";
destinationConnectionManager.Description = "Data Commander Connection Manager";
destinationConnectionManager.DelayValidation = false;
destinationConnectionManager.Properties["Format"].SetValue(destinationConnectionManager, "Delimited");
destinationConnectionManager.Properties["TextQualifier"].SetValue(destinationConnectionManager, "\"");
destinationConnectionManager.Properties["CodePage"].SetValue(destinationConnectionManager, "65001");
// ADD DESTINATION COMPONENT
Dts.Pipeline.Wrapper.IDTSComponentMetaData100 destinationComponent = pipelineTask.ComponentMetaDataCollection.New();
destinationComponent.Name = "Flat File Destination";
destinationComponent.ComponentClassID = "DTSAdapter.FlatFileDestination";
destinationComponent.ValidateExternalMetadata = true;
CManagedComponentWrapper destinationComponentWrapper = destinationComponent.Instantiate();
destinationComponentWrapper.ProvideComponentProperties();
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager = Dts.Runtime.DtsConvert.GetExtendedInterface(destinationConnectionManager);
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID = destinationConnectionManager.ID;
// CREATE PATH
Dts.Pipeline.Wrapper.IDTSPath100 pipelinePath = pipelineTask.PathCollection.New();
pipelinePath.AttachPathAndPropagateNotifications(sourceComponent.OutputCollection[0], destinationComponent.InputCollection[0]);
// DESTION CONNECTION MANAGER COLUMNS
IDTSConnectionManagerFlatFile100 destinationConnectionInterface = destinationConnectionManager.InnerObject as IDTSConnectionManagerFlatFile100;
IDTSConnectionManagerFlatFileColumns100 destinationColumns = destinationConnectionManager.Properties["Columns"].GetValue(destinationConnectionManager) as IDTSConnectionManagerFlatFileColumns100;
// START --- MANUALLY READ COLUMNS FROM DESTINATION COMPONENT AND ADD THEM TO DESTIONATION CONNECTION MANAGER COLUMNS
foreach (IDTSInput100 input in destinationComponent.InputCollection)
IDTSVirtualInput100 virtualInput = input.GetVirtualInput();
IDTSConnectionManagerFlatFileColumn100 column = null;
foreach (IDTSVirtualInputColumn100 virtualInputColumn in virtualInput.VirtualInputColumnCollection)
column = destinationColumns.Add();
column.DataType = DataType.DT_TEXT;
column.ColumnDelimiter = ",";
column.TextQualified = true;
(column as IDTSName100).Name = virtualInputColumn.Name;
column.ColumnDelimiter = "\r\n";
// END --- MANUALLY READ COLUMNS FROM DESTINATION COMPONENT AND ADD THEM TO DESTIONATION CONNECTION MANAGER COLUMNS
// NEED TO CREATE NEW META DATA AFTER COLUMNS
destinationComponentWrapper.AcquireConnections(null);
destinationComponentWrapper.ReinitializeMetaData();
destinationComponentWrapper.ReleaseConnections();
// MAP INPUT COLUMNS
foreach (IDTSInput100 input in destinationComponent.InputCollection)
IDTSVirtualInput100 virtualInput = input.GetVirtualInput();
foreach (IDTSVirtualInputColumn100 virtualInputColumn in virtualInput.VirtualInputColumnCollection)
Console.WriteLine("VIC " + virtualInputColumn.Name + "(" + virtualInputColumn.ID + ")");
destinationComponentWrapper.SetUsageType(input.ID, virtualInput, virtualInputColumn.LineageID, DTSUsageType.UT_READONLY);
foreach (IDTSExternalMetadataColumn100 metadataColumn in input.ExternalMetadataColumnCollection)
if (virtualInputColumn.Name.Equals(metadataColumn.Name)) {
// PROBLEM HERE:
// An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in msdatapipe.exe
// Additional information: Exception HRESULT: 0xC0047072
// at this point is virtualInputColumn.ID = -2147483573
destinationComponentWrapper.MapInputColumn(input.ID, virtualInputColumn.ID, metadataColumn.ID);
// if the code is commented out and the program rerun there is a package validation error instead: 0xC020201B
// 0xC020201B - The number of input columns for Flat File Destination.Inputs[Flat File Destination Inputs] cannot be zero
// NEED TO CREATE META DATA AFTER COLUMNS HAVE BEEN ADDED TO THE DESTIONATION MANAGER
// AND USAGE TYPE HAS BEEN SET OR WE'LL GET A VS_NEEDSNEWMETADATA
destinationComponentWrapper.AcquireConnections(null);
destinationComponentWrapper.ReinitializeMetaData();
destinationComponentWrapper.ReleaseConnections();
// SAVING DTSX PACKAGE FOR DEBUGGING
application.SaveToXml("C:\\Users\\CMI\\documents\\visual studio 2010\\Projects\\SSIS Tutorial\\SSIS Tutorial\\generated.dtsx", package, null);
Microsoft.SqlServer.Dts.Runtime.DTSExecResult packageResults = package.Execute();
Console.WriteLine("package execution result: " + packageResults.ToString());
// Basic check for errors
foreach (DtsError error in package.Errors)
Console.WriteLine("ErrorCode : 0x{0:X}", error.ErrorCode);
Console.WriteLine(" SubComponent : {0}", error.SubComponent);
Console.WriteLine(" Description : {0}", error.Description);
Console.WriteLine("press the return key hard to continue...");
Console.Read();I suggest you revise your code against examples given in http://blogs.msdn.com/b/mattm/archive/2008/12/30/samples-for-creating-ssis-packages-programmatically.aspx
Arthur My Blog
Maybe you are looking for
-
BPM Sample Applications Released
Hello All, I would like to announce the release of the new package of BPM sample applications using SAP NetWeaver BPM technology. SAP customers and partners will find them ready-to-run in the [Enterprise Services Workplace|http://esworkplace.sap.com
-
Has FM 9 or 10 a better working dictionary for non-english languages?
I am using FM 7 (latest update) on Windows Vista. As it is now, there's a limit of how many characters a word can have for it to be entered into the dictionary. We here in Sweden have 3 letters that are not present in the English language, å, ä and ö
-
I brought a Nokia X3-00 a week ago. Today, I Configured it to use the GPRS internet. While the internet is working fine in the phone's default browser. Opera isn't working, not the one supplied with the phone & not the one I just downloaded from Oper
-
Journal Ref2 field : AP credit note
Hi, Have noticed that in the Account Balance for Business Partner; Ref2 field is not being filled in the Journal when there is an AP Credit Note; when in actual fact this field is being filled in the AP Credit note Supplier Ref field. Any ideas where
-
Hey, Can anyone tell me the difference between PLKO and PLKZ tables. Thanks in advance. Regards, Anuj