Hello StackOverflow community,
I am facing a perplexing issue with an Informattica mapping involving an Oracle source DB table and a SAP HANA DB target table.
EDIT: I have found out the reason - that's not my focus anymore.
All I want to know now is why setting ABAPVARCHARMODE
to TRUE
doesn't seem to affect the mapping.
When testing the parameter effectiveness using SAP HANA Studio's SQL console, it is behaving expectedly. (See figure 9+10 below)
Is data input through ODBC that much diffrent from running that DML in the console?
There is almost no mapping logic
Expression blocks contain default value in case of null value - which is indeed a single space character ' '
and according to the default value field in the DDL of the target DB (an empty string)- the mapping should result with the key field filled- and the non-key field should contain an empty string.
Both Database providers have an ODBC driver , and Informatica is connected to them in this manner.
To help diagnose the problem - I'm including the following:
- DDL of the source table in Oracle
CREATE TABLE source_table(
key_field NUMBER(19) not null,
cellular varchar2(15),
...extra fields...
);
ALTER TABLE source_table ADD PRIMARY KEY key_field;
Figure 1
- DDL of the target table in SAP HANA
CREATE COLUMN TABLE "TARGET_TABLE"(
"MANDT" NVARCHAR(3) DEFAULT '000' NOT NULL,
"KEY_FIELD" BIGINT CS_FIEXED DEFAULT 0 NOT NULL,
"CELLULAR" NVARCHAR(15) DEFAULT '' NOT NULL,
"UNMAPPED_FIELD" NVARCHAR(3) DEFAULT '' NO NULL,
CONSTRAINT "TARGET_TABLE~0" PRIMARY KEY( "MANDT,"KEY_FIELD" )
);
Figure 2
- "Proof of Null" of the source data - in the form of the issued query and the results
SELECT key_field,
cellular,
RAWTOHEX(cellular) AS binary_cellular,
CASE WHEN cellular IS NULL THEN 'ITS NULL' ELSE 'NOT NULL' END AS is_cellular_null
FROM source_table
WHERE key_field = '21201550228'
Figure 3
and the resuts:
KEY_FIELD | CELLULAR | BINARY_CELLULAR | IS_CELLULAR_NULL |
---|---|---|---|
21201550228 | ITS NULL |
Figure 3
4."Proof of space" of the target data - after running the mapping
SELECT mandt,
key_field,
cellular,
BINTOHEX(cellular) AS binary_cellular,
CASE WHEN cellular IS NULL THEN 'ITS NULL' ELSE 'NOT NULL' END AS is_cellular_null,
unmapped_field,
BINTOHEX(unmapped_field) AS binary_unmapped_field,
CASE WHEN unmapped_field IS NULL THEN 'ITS NULL' ELSE 'NOT NULL' END AS is_unmapped_fld_null
FROM target_table
WHERE mandt = '700' AND
key_field = '21201550228'
Figure 4
and the results:
MANDT | KEY_FIELD | CELLULAR | BINARY_CELLULAR | IS_CELLULAR_NULL | UNMAPPED_FIELD | BINARY_UNMAPPED_FIELD | IS_UNMAPPED_FLD_NULL |
---|---|---|---|---|---|---|---|
700 | 21201550228 | 20 | NOT NULL | NOT NULL |
Figure 5
- General description of the mapping (sorry no pictures, intra-net only )
"source_table" Source Definition ->
SQ_SOURCE_TABLE Source Qualifier ->
Expression ->
"target_table" Target Definition
Figure 6
The source qualifier defined as
SELECT key_field,
cellular,
...all extra fields...
FROM source_table
WHERE key_field = '21201550228'
Figure 7
The expression is only there to:
- Entering a constant '700' into the 'MANDT' extra key field of the target table
- Pass through the 'KEY_FIELD' field from the SQ
- Pass through the 'CELLULAR' field from the SQ
- Not passing through any of the other fields
Edit: Also :
- Provide a default value in case of null
- An excerpt from the trace i've issued on HANA side while running the mapping
cursor_(generated id).execute(''' INSERT INTO "TARGET_TABLE" ("MANDT","KEY_FIELD","CELLULAR") VALUES ( ?, ?, ?) ''', (u'''700''', 21201550228, u''' '''))
Figure 8
- An attempted work-around that doesn't seem to work
According to the documentation of ODBC parameters available in SAP HANA
there's a parameter called ABAPVARCHARMODE, which when set with the value TRUE
should transform any use of the single space literal' '
in any SQL/DML into an empty string literal''
.
We have configured this parameter inside the odbc.ini file on Informatica's machine.
I have tried to ODBC trace the Informatica's machine - but the trace produced the prepared statement being used w/o bind variables- I have tried to run the equivilant DML statement found in the trace (even though no single space was supposed to be there) on SAP HANA STUDIO's SQL console, making sure to turn on the ABAPVARCHARMODE beforehand, and delete the record inserted by the mapping beforehand
SET 'ABAPVARCHARMODE' = 'TRUE'
INSERT INTO "TARGET_TABLE" ("MANDT","KEY_FIELD","CELLULAR") VALUES ( '700', 21201550228, ' ');
COMMIT;
SELECT mandt,
key_field,
cellular,
BINTOHEX(cellular) AS binary_cellular,
CASE WHEN cellular IS NULL THEN 'ITS NULL' ELSE 'NOT NULL' END AS is_cellular_null
FROM target_table
WHERE mandt = '700' AND
key_field = '21201550228'
Figure 9
producing
MANDT | KEY_FIELD | CELLULAR | BINARY_CELLULAR | IS_CELLULAR_NULL |
---|---|---|---|---|
700 | 21201550228 | NOT NULL |
Figure 10
as expected