How to extract sap data for a particular year - sap

I am trying to extract BSEG data from SAP systems. I want to set a filter on field GJAHR for year 2018 so that data for that particular year will be extracted. Below is the code snippet:
if(fields != null){
JCoTable table = function.getTableParameterList().getTable("FIELDS");
for (String field : fields) {
table.appendRow();
table.setValue("FIELDNAME", field);
}
}

If you use the function module RFC_READ_TABLE, there is a table parameter called OPTIONS, which has one column named TEXT. Here the condition for GJAHR = 2018:
JCoTable options = function.getTableParameterList().getTable("OPTIONS");
options.appendRow();
options.setValue("TEXT", "GJAHR EQ 2018");

Related

How to write Azure storage table queries for non-existent columns

We have a storage table where we want to add a new integer column (It is in fact an enum of 3 values converted to int). We want a row to be required when:
It is an older row and the column does not exist
It is a new row and the column exists and does not match a particular value
When I just use a not equal operator on the column the old rows do not get returned. How can this be handled?
Update
Assuming a comparison always returns false for the non-existent column I tried somethinglike below (the value of the property will be always > 0 when it exists), which does not work either:
If the (Prop GreaterThanOrEqual -1) condition returns false I assume the value is null.
If not then, the actual comparison happens.
string propNullCondition = TableQuery.GenerateFilterConditionForInt(
"Prop",
QueryComparisons.GreaterThanOrEqual,
-1);
propNullCondition = $"{TableOperators.Not}({propNullCondition})";
string propNotEqualValueCondition = TableQuery.CombineFilters(
propNullCondition,
TableOperators.Or,
TableQuery.GenerateFilterConditionForInt(
"Prop",
QueryComparisons.NotEqual,
XXXX));
Note: The table rows written so far do not have "Prop" and only new rows will have this column. And expectation is the query should return all old rows and the new ones only when Prop != XXXX.
It seems that your code is correct, maybe there is a minor error there. You can follow my code below, which works fine as per my test:
Note: in the filter, the column name is case-sensitive.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("test1");
string propNullCondition = TableQuery.GenerateFilterConditionForInt(
"prop1", //note the column name shoud be case-sensitive here.
QueryComparisons.GreaterThanOrEqual,
-1);
propNullCondition = $"{TableOperators.Not}({propNullCondition})";
TableQuery<DynamicTableEntity> propNotEqualValueCondition = new TableQuery<DynamicTableEntity>()
.Where(
TableQuery.CombineFilters(
propNullCondition,
TableOperators.Or,
TableQuery.GenerateFilterConditionForInt(
"prop1",//note the column name shoud be case-sensitive here.
QueryComparisons.NotEqual,
2)));
var query = table.ExecuteQuery(propNotEqualValueCondition);
foreach (var q in query)
{
Console.WriteLine(q.PartitionKey);
}
The test result:
Here is my table in azure:

NetSuite sublist column order (suitescript 2)

Is there any way to add a sublist field via a user event script and define its column position? By default the field is added as the last column. It appears you can move form fields around, but can't change sublist column order.
We can able to edit sublist column postion.
But it can be vary based on your records either transaction or suitlet script or any other things just elaborate your question pls.
// For This Example we create a first Field
var field1 = form.addField({
id : 'textfield1',
type : serverWidget.FieldType.TEXT,
label : 'Text'
});
// For This Example we create a first Field
var field2 = form.addField({
id : 'textfield2',
type : serverWidget.FieldType.TEXT,
label : 'Text'
});
form.insertField({
field : field2,
nextfield : 'textfield1'
});

operator (plus add) in entity framework core send an error

When using sql select I need a counter for my sequence row like this:
var result = from d in data
select new[]
{
Convert.ToString((count++))
};
but this syntax gives the following error message:
An expression tree may not contain an assignment operator Vehicle.app..NETCoreApp,Version=v1.0
When using LINQ (e.g. from x in data select { ... }) the expression in the selection is translated into a SQL statement and executed in the database. How would an assignment like count++ work in a database? I think you're better off with selecting the records from the database and apply the sequence number on the in memory list of data rather than on the queryable collection which represents the database. For example:
var data = (from d in data select new { ... }).ToList();
var result = data.Select(new { id = Convert.ToString(count++), ... }).ToList();

Error in programmatically copying data to SpFieldChoice field SharePoint 2010

I am new to sharepoint, I have a custom field type derived from SpFieldChoice , my field allows users to select multiple values, I have a requirement of replacing some old custom columns with the new column and copy the data in old column to the new column. the old column also allows the users to select multiple values by ticking checkboxes, I have the following code to copy the data to new field.
foreach (SPListItem item in list.Items)
{
if (item[oldField.Title] == null)
{
item[newFld.Title] = string.Empty;
item.Update();
}
else
{
string[] itemvalues = item[oldField.Title].ToString().Split(new string[] {";#"}, StringSplitOptions.None);
StringBuilder multiLookupValues = new StringBuilder();
multiLookupValues.Append(";#");
for (int cnt = 0; cnt < (itemvalues.Length) / 2; cnt++)
{
multiLookupValues.Append (itemvalues[(cnt * 2) + 1].ToString() + ";#");
}
item[newFld.Title] = multiLookupValues.ToString();
item.SystemUpdate(false) ;
}
}
This code works fine until the length of resulting stringbuilder is less than 255 charachters , but when this length is greater then 255 I get the following Exception.
Invalid choice Value. A choice field contains invalid data.Please check the value and try again.
Is there any other way of copying data to SpFiledChoice, How can I resolve this problem? please help me.
Do the update multiple times so that the string doesn't exceed - i.e. value +=. However, if the problem is that the value can't be longer that 255, you have to consider how you are doing the choices. If it is exceeding the length and updating the value multiple times doesn't work (and a Site Column will have the same limitations), you can do the next best thing:
1) Create a new list that will hold the choices
2) Change the destination field to be a lookup
3) Update accordingly for each item (picking up the ID from the lookup field)
There's no limit to this.
David Sterling
david_sterling#sterling-consulting.com
www.sterling-consulting.com

Searching a tables XML filed using Linq, can it be done?

I have a database table with transactions. In one of the fields there is an XML message, the field type is “xml”. In this XML there is an employee filed and it is this field that I need to search. I want to retrieve all the rows that match the employee number supplied at runtime. Is it possible to do this with Linq ?
Shown here is some example XML from one of the rows in the transaction table. The field is called “Message”. I need to look at the “employee” value and return the row if it match what was supplied by the user.
<interface>
<mac>1452345234</mac>
<device>device1</device>
<id>1234567</id>
<terminal>
<unit>1</unit>
<trans>
<event>A3</event>
<employee>3333</employee>
<time>2008-10-02T11:41:00.0000000+00:00</time>
</trans>
</terminal>
</interface>
Yes, it is easily possible with LINQ:
var matchList = from t in transactions
where XDocument.Load (new StringReader (t.Message))
.Descendants ("employee")
.Count (node => node.Value == employeeNr) > 0
select t;
Simple way:
List<YourRecord> GetRecords(string EmployeeId)
{
return TheTable.where(r => r.Message.Contains("<employee>" + empId + "</employee>")).ToList();
}