Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Set qualified multivalue-lookup table Value to main table through Java API

Hello together,

I have some trouble with a qualified multivalue lookup table and the Java API: I am currently not able to create a main-table record with a value for this qualified table using the Java API.

My scenario looks as follows:

Main Table: 'Person' [has a name, address and so on]

Qualified Lookup: 'CleansingCase' => lookup-table= 'CleansingCases':

- display field: 'Search Pattern' => Lookup Field to 'Search Patterns' table

- qualifier: 'Group' => Lookup Field to 'Groups' table

My program correctly fills the subtables 'Search Patterns' and 'Groups'. Also, the CleansingCases table was filled.

What I want to do now is to update an existing entry from the main table by assigning an Entry from the CleansingCase table. But unfortunately, I only receive a "StringException: ModifyQualifiedLinks error"

It would really be great if there was somebody out there who can help me...

Some of my coding:

QualifiedLinkArray qualifiedLinkArray = new QualifiedLinkArray();
QualifiedLink qualifiedLink = new QualifiedLink();

qualifiedLink.GetQualifiers().Add(new A2iField("Group"));
qualifiedLinkArray.Add(qualifiedLink);

int recID = <maintable-recordId> ;
int changeStamp = <maintable-record-ChangeStamp> ;

catalog.AddQualifiedLinks(<table>, "CleansingCase", recID, qualifiedLinkArray, changeStamp );

I am more than happy to provide more information if needed

Thanks in advance,

Martin

Tags:
replied

Hi Martin,

QualifiedLinkArray qualifiedLinkArray = new QualifiedLinkArray();

QualifiedLink qualifiedLink = new QualifiedLink();

//set non-qualifier

//get the record id of the lookup table for the non qualifier

<b>int lookupRecordID = getRecordID(<Lookup table name>,<Lookup DF>,<value>);

qualifiedLink.SetLookupID(lookupRecordID);</b> //set qualifier value

//in your case for qualifier Group

<b>int groupRecId = getRecordID(<Group Table>,<Group Table DF name>,<value>);

Value val = new Value(groupRecId);

A2iField field1 = new A2iField(<FieldName>,val);</b>

qualifiedLink.GetQualifiers().Add(field1);

qualifiedLinkArray.Add(qualifiedLink);

// get the main table record id for which you want to add a qualified record

int recordId = getRecordID(<Main Table Name>, <Display Field>,<Value>);

int changeStamp = getChangeStamp(<Main Table Name>, recordId);

catalog.AddQualifiedLinks(<Main Table>, <Qualified Field Name in Main Table>, recordId,qualifiedLinkArray, changeStamp);

Hope this helps, Let me know if you need additional information.

Thanks and Regards

Subbu

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question