One Star

[resolved] tsapinput with variable input

Hi all,
I'm new to Talend and I am already facing a quite difficult problem for a newbie.
I need to extract some data from SAP clustered table CDPOS using a call to RFC_READ_TABLE function
using a tsapinput. I have to pass some filtering conditions as costants and other 2 as variable values 
coming from an Oracle table.
The job works fine if I set all the values as constants by setting the parameter "TEXT" of type "table_input"
like: "MANDANT = '400' AND " , "CHANGENR = '19193234' AND ", "OBJECTID = '00100000000458520000' "
(it is like an array of strings, each one max 72 charaters in length, merged at runtime AFAIK)
but it doesn't work if I try to pass some variable data like:
"MANDANT = '400' AND " , "CHANGENR = '19193234' AND ", "OBJECTID = '" + ((String)globalMap.get("row2.OBJECTID")) +"'"
What is the correct way to pass variable parameters to tsapinput component? No luck using a tFixedFlowInput or, 
more probably, it is not used in the right way.
I am using TOS 5.5.1.r118616. Ask me if more details are needed.
One Star

Re: [resolved] tsapinput with variable input

Now I'm trying with a tflowToSapRfcTable but it seem that no global var is set ( I get a unknown column errro while retrieving 
globalMap.get("column_name") )
Smiley Sad
One Star

Re: [resolved] tsapinput with variable input

After a tOracleInput which extracts 2 column from a table, I used a tFlowToIterate to transform each field of each row extracted to a global variable. The trick part was the way to pass this data to a tSAPInput to extract some other data from the CSOD SAP table
using the function module "RFC_READ_TABLE".
To achieve this you have to know that:

this function uses a table (a kind of array of strings limited to 72 characters per element) as where condition
you specify the fields to extract passing them as a table (array of strings) in the input field "FIELDS" (put them as "FIELD1","FIELD2",...)
the output is another table (this time an array of strings of 512 bytes) in wich each rows is a csv made of the fields you specify in the "Fields" variable separated from the character spefied in "DELIMITER" input field
If you have multiple condition you have to split it in multiple strings like:
"Sap_Table_Field_1 = '" + ((String)globalMap.get("global_var_1")) +"' ","Sap_Table_Field_2 = '" + ((String)globalMap.get("global_var_2")) +"' ", " Sap_Table_Field_3 = 'some_constant'"
Pay attention to: 

put a space before and after "=" 
single quote to delimitate values (the red single quote like 'some_constant' and before and after ((String)globalMap.get("global_var_#"))  )
limitate output length to 512 charatcters (see SAP documentation) and take in mind that if a field is
defined as CHAR 254 ( as  VALUE_NEW and VALUE_OLD in table CDPOS), the field is always filled with blanks at the end even if it uses just a char.

Hoping this can help newbies and not.