Reading Field Labels from Lookup Table
Post Author: Ohmylord
CA Forum: Formula
I'm trying to read the field labels from the database so I can have one set of reports and have them work in multiple languages by changing the display value. I created a lookup table that has these fields and values: ID EnglishValue DisplayValue1 Customer Cliente2 CustomerNumber Numero del Clienteetc. I then created a formula field for each label (@Customer Label, @CustomerNumber Label). The formula just contains the DisplayValue field. Then I used Select Records and added a Where ID=1 or ID=2. The problem is that whatever the last value I put in for the ID applies to each of the different formulas I created. In other words, it reads the labels from the database, but they are all the same. It seems like it should be pretty easy but I'm obviously missing something. Most reports probably have 15 or so labels on them. Thanks for any help!
Post Author: Ohmylord
CA Forum: Formula
Here's some sample data from the table I created.
Translation
Autonumber
ID
EnglishLabel
DisplayValue
1
1
Customer
Cliente
2
2
Customer Number
Codice Cliente
3
3
Quote Date
Data Quota
4
4
Expiration Date
Data Scadenza
What I want on the report is 4 fields each one would show a different value. The simplified select statement I'm trying to get for the different fields is something like:Field 1 - Select DisplayValue where ID=1Field 2 - Select DisplayValue where ID=2etc for the other 2 fields. When a different user has a different language we would just populate the DisplayValue with different data.
Similar Messages
-
Unable to read field value from main table - unexpected socket read error
Hi Friends,
While executing the below code, I am able to get the value of the field 'id' but i am unable to get the value for the 'materialnumber' field. i am getting the below exception
+com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ProtocolException: java.io.IOException: Unexpected socket read. Result is -1.
at com.sap.mdm.data.commands.AbstractRetrieveLimitedRecordsCommand.execute(AbstractRetrieveLimitedRecordsCommand.java:158)
at com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand.execute(RetrieveLimitedRecordsCommand.java:157)
at updaterecords.main(updaterecords.java:126)
Caused by: com.sap.mdm.internal.protocol.manual.ProtocolException: java.io.IOException: Unexpected socket read. Result is -1.
at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.execute(AbstractProtocolCommand.java:100)
at com.sap.mdm.data.commands.AbstractRetrieveLimitedRecordsCommand.execute(AbstractRetrieveLimitedRecordsCommand.java:146)
... 2 more
Caused by: java.io.IOException: Unexpected socket read. Result is -1.
at com.sap.mdm.internal.net.DataSocket.receiveData(DataSocket.java:59)
at com.sap.mdm.internal.net.ConnectionImpl.readInt(ConnectionImpl.java:417)
at com.sap.mdm.internal.net.ConnectionImpl.nextMessage(ConnectionImpl.java:501)
at com.sap.mdm.internal.net.ConnectionImpl.receiveMessage(ConnectionImpl.java:472)
at com.sap.mdm.internal.net.ConnectionImpl.send(ConnectionImpl.java:209)
at com.sap.mdm.internal.net.ReservedConnection.send(ReservedConnection.java:105)
at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.execute(AbstractProtocolCommand.java:97)
... 3 more+
import com.sap.mdm.commands.AuthenticateUserSessionCommand;
import com.sap.mdm.commands.CommandException;
import com.sap.mdm.commands.CreateUserSessionCommand;
import com.sap.mdm.commands.DestroySessionCommand;
import com.sap.mdm.commands.GetRepositoryRegionListCommand;
import com.sap.mdm.data.Record;
import com.sap.mdm.data.RegionProperties;
import com.sap.mdm.data.ResultDefinition;
import com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand;
import com.sap.mdm.ids.TableId;
import com.sap.mdm.net.ConnectionException;
import com.sap.mdm.net.ConnectionPool;
import com.sap.mdm.net.ConnectionPoolFactory;
import com.sap.mdm.schema.FieldProperties;
import com.sap.mdm.schema.RepositorySchema;
import com.sap.mdm.schema.commands.GetFieldListCommand;
import com.sap.mdm.schema.commands.GetRepositorySchemaCommand;
import com.sap.mdm.search.Search;
import com.sap.mdm.server.DBMSType;
import com.sap.mdm.server.RepositoryIdentifier;
public class updaterecords {
public static void main(String[] args) {
try {
String serverName = "159.112.6.26";
ConnectionPool connections = null;
try {
connections = ConnectionPoolFactory.getInstance(serverName);
} catch (ConnectionException e) {
e.printStackTrace();
return;
// specify the repository to use
// alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand
String repositoryName = "DEMO";
String dbmsName = "MDMD";
RepositoryIdentifier reposId = new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.ORACLE);
// get list of available regions for the repository
GetRepositoryRegionListCommand regionListCommand = new GetRepositoryRegionListCommand(connections);
regionListCommand.setRepositoryIdentifier(reposId);
try {
regionListCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
return;
RegionProperties[] regions = regionListCommand.getRegions();
// create a user session
CreateUserSessionCommand sessionCommand = new CreateUserSessionCommand(connections);
sessionCommand.setRepositoryIdentifier(reposId);
sessionCommand.setDataRegion(regions[0]); // use the first region
try {
sessionCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
return;
String sessionId = sessionCommand.getUserSession();
// authenticate the user session
String userName = "meter1";
String userPassword = "meter1";
AuthenticateUserSessionCommand authCommand = new AuthenticateUserSessionCommand(connections);
authCommand.setSession(sessionId);
authCommand.setUserName(userName);
authCommand.setUserPassword(userPassword);
try {
authCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
return;
GetRepositorySchemaCommand cmd=new GetRepositorySchemaCommand(connections);
cmd.setSession(sessionId);
try{
cmd.execute();
}catch(CommandException e){
System.out.println(e.getLocalizedMessage());
RepositorySchema repsch=cmd.getRepositorySchema();
// the main table, hard-coded
TableId mainTableId = new TableId(1);
// specify the result definition (what to retrieve); in this example, nothing
ResultDefinition rd = new ResultDefinition(mainTableId);
// select all records
Search search = new com.sap.mdm.search.Search(mainTableId);
//get fields
GetFieldListCommand getFieldListCommand = new GetFieldListCommand(connections);
getFieldListCommand.setSession(sessionCommand.getUserSession());
getFieldListCommand.setTableId(mainTableId);
try {
getFieldListCommand.execute();
} catch (CommandException e) {
System.out.println(e);
FieldProperties[] lookupFields = getFieldListCommand.getFields();
// add fields to records to retrieve
rd.addSelectField(repsch.getFieldId("Products","Id"));
rd.addSelectField(repsch.getFieldId("Products","MaterialNumber"));
// retrieve the records
RetrieveLimitedRecordsCommand limitingCommand = new RetrieveLimitedRecordsCommand(connections);
limitingCommand.setSession(sessionId);
limitingCommand.setResultDefinition(rd);
limitingCommand.setSearch(search);
//limitingCommand.setPageSize(2000);
try {
limitingCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
return;
System.out.println("Record count is " + limitingCommand.getRecords().getCount()+"\n");
Record[] records=limitingCommand.getRecords().getRecords();
System.out.println(records[0].getFieldValue(repsch.getFieldId("Products","Id"))+ " \n");
System.out.println(records[0].getFieldValue(repsch.getFieldId("Products","MaterialNumber"))+ " \n");
// finally destroy the session
DestroySessionCommand destroySessionCommand = new DestroySessionCommand(connections);
destroySessionCommand.setSession(sessionId);
try {
destroySessionCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
return;
} catch (Exception e) {
System.out.println(e.getLocalizedMessage());
e.printStackTrace();
Kindly let me know where i am going wrong. MaterialNumber field is a TEXT not a lookup table field. Above fields are from the main table.
Thanks,
RaagsHi Friends,
I got the solution. It was the error because of not having a the below statement.
limitingCommand.setPageSize(1);
As i havent used that statement, it was trying to get 1000 records, and i dont know exactly what makes this to get that error. Anyhow., As i want to use for updation, i cn live with one record.
Thanks,
Raags -
Function Modul for read field label
hi all
i search a function modul for read the field label from data element.
Example for data element matnr, i must have field label text material.
Thx abap_beginHi,
If you give input parameters type, field and table you get data element using
RP_PRINT_GET_DATA_ELEMENT
Try also
KL_TABLE_INFO_GET
But not sure if this futfill your requirement... -
Syndicating Key mapping value from lookup table
Hi Experts,
I want to Syndicating Remote Key value from lookup table as per the remote system.
In syndicator, if I map destination field to the remote key of the lookup table, I am getting blank value.Hi Mrinmoy,
kindly check in the Data Manger whether have you maintained Remote keys for the lookup table. If yes then choose the specified remote system from Remote key override fields under Map properties in the syndicator.
Incase you cant find the remote system in the "remote key override" field for which remote key is assigned in Data manager, then you need to check the Type (outbound) of the remote system in Console admin node. Because only those Remote systems type set as Outbound can been found in Remote key Override in the syndicator.
After choosing the remote key you need to map the destination field with Remote key value as shown in the below image.
Regards
Rahul -
Migrating data from LookUp Table to Main Table without taking extract
Dear Experts,
Is there any way if we want to migrate full data from LookUp Table to Main Table in the same repository without taking the extract from MDM DM and not importing it using Import Manager?
Thanks
Gaurav Kumar SharmaHi Gaurav,
Yes there are ways,like you can create port for syndication and use MDIS to import it back but Extraction from DM would be more convenient though.You can also use APIs to syndicate the lookup data and import it back in MDM.
Can you please detail what you want to achieve?
Thanks,
Ravi -
Read Infopackage selection from a table using ABAP
Hello Experts,
I have a flat file consisting of 3 columns which I want to use as selection fields for the Infopackage. Now, is it possible to load this flat file to an ODS or a master data table and then write some ABAP in the Infopackage to read the values of the columns and populate the selection fields.
This is what I want: The columns of the flat file are - Company Code, Doc number, Fiscal Year
Now, I loaded this file into a tables (around 2 million records) and then use ABAP to populate the entire file into the selection tab of the Infopackage.
What would be the best approach for this?
Thanks in advance
VivekHi,
It's possible in theory. Just one thing, too many selections in an InfoPackage may not work (I remember about 1,000 or 10,000, not very sure).
I'd like suggest loading a range rather than so many selections. For example, say you have below documents:
1000
1001
1005
1010
Then just load from 1000 to 1010, and create a start routine in your update rule/transformation. There you can do this:
1. select records from the table where you store flat file, using the same selection (1000 to 1010)
2. For every records in DATA_PACKAGE, using READ TABLE statement to check whether that record exist in the table. If not exist then simply delete it from DATA_PACKAGE
I think that would have much better performance. Let us know if you have further questions.
Regards,
Frank -
Function module to fetch SOBID field value from hrp1001 table
Hi,
Is there any function module, to fetch the value of the SOBID field from hrp1001 table by passing RSIGN,RELAT,OTYPE,SCLAS field values to that function module.
Regards,
Shalini.Hi Sikindar,
I am not able to find these function modules.I am getting message as function module not found.Please let me know is there any other function module.
Thanks,
Shalini. -
To find a field value from a table
i want to get some field value from a data dictionary table.
for eg Tragr from Mara. in Fields list it shows the field is in Mara table. but in content screen it does not showing the field at all. Actually of 220 fields of mara table only 99 fields are shown. how to view all the fields of a particular field. is there any setting is there.Hi Deva,
When we execute any table by default SAP will display only few columns.(90 i guess) If we want to view all the columns of the table then do like this after executing the table i.e in ur table output.
Menupath->Settings->User parameters->choose radiobotton
Grid display Here u can see all the fields.
If u don't want to see all the fields then do like this.
Settings->listformat->Choosefields->Deselectall->Select what
ever fields u want using the search button in bottom and press enter. It will display only selected fields.
Some times we will come up with strange situations.
EG: In the field list some field will be there. But if u select that field from that table in select query it will give u syntax error saying field xxx does't exist in table yyy. This field is nothing but text table field. If u want to select this field then u have to select it from the text table. U can find the text table exist for some table or not in
Menupath->goto->text table. (In this case makt is text table for mara)
Just check below code for ur reference.
DATA: wa_mara TYPE mara.
SELECT SINGLE * INTO wa_mara FROM MARA .
Here if u go to mara table u have field MAKTX But above select will not return the field maktx even we are refering wa_mara to data base table mara. We have to explicitly select it from MAKT.
Hope this clarified all ur doubts.
Thanks,
Vinod. -
Insert Matching Records from Lookup Table to Main Table
First off, I want to say many thanks for all the help that I've been provided on here with my other posts. I really feel as though my SQL knowledge is much better than it was even a few short weeks ago, largely in part to this forum.
I ran into a snag, which I'm hoping someone can provide me some guidance on. I have 2 tables an import table and a lookup table. What I need to have happen is anytime there are matches between the "Types" in the 2 tables, I need a single instance
of the "Type" and all corresponding fields from the lookup table appended to the import table. There will only be a single instance of each type in the "Lookup" table. Below is an example of how the data might look and the results that
I would need appended.
tblLookup
Type Name Address City
A Dummy1 DummyAddress No City
B Dummy2 DummyAddress No City
C Dummy3 DummyAddress No City
tblImport
Type Name Address City
A John Maple Miami
A Mary Main Chicago
A Ben Pacific Eugene
B Frank Dove Boston
Data that would be appended to tblImport
Type Name Address City
A Dummy1 DummyAddress No City
B Dummy2 DummyAddress No City
As you can see only a single instance will be inserted even though there may be multiple instances in the import table. This is the part that I'm struggling on. Any assistance would be appreciated.I'm not really sure how else to explain it. With my example, the join would be on "Type" As you can see, there are 2 matching records between the tables (A and B). I would need a single instance of A and B to be inserted into the import table.
Below is a SQL statement, which I guess is what you're asking for but it will not do what I need it to do. With the example that I have below, it would insert multiple instances of type "A" into the import table.
INSERT INTO tblImport (Type, Name, Address, City)
Select tblLookup.Type, tblLookup.Name,
tblLookup.Address, tblLookup.City)
From tblLookup
Join tblImport on tblLookup.Type = tblImport.Type -
Report query not returning the field value from external table
hi
I have an issue regarding reports. I have a query having 4 fields from external table and remaining from db tables. the report query returns all the fields from the db tables and only 2 fields from external table. but the same query if I tried in plsql developer it returns all the fields values.
Can anyone please help me in this issue.
Thanks and Regards
kkDuplicate post?
value not displaying in report whereas it returns in plsql developer
value not displaying in report whereas it returns in plsql developer
Please log a SR if you do not get any reply to your thread instead of creating new one.
Thanks,
Hussein -
Display many fields of a lookup table in the main table
Hello Experts,
In MDM, I have a "Suppliers" table which is a lookup table. This table has 4 fields :
- Supplier Name (Display Field)
- Supplier Code
- Email
- Phone number
In the main table, a field "Supplier" uses the "Suppliers" lookup table. This fields displays the "Supplier Name" of the "Suppliers" lookup table.
Now I also want to display the "Email" and the "Phone Number" of the supplier. If I set these fields as Display Fields in the "Suppliers" lookup table, they appear concatenated in the main table, which I don't want.
The only way I found to display those fields is to set 2 new fields in the main table as calculated fields, eg: IF(TRUE, Supplier.Email).
Is there any way to display those fields w/o using calculated fields?
Thanks for your helpHi Christian,
Thanks for your help. Actually I am working on the SRM part of MDM, so I do not use portal to display data but the SRM-MDM UI on which I can not manage iViews.
The need is to have, for each Material displayed, the name and the contact data of the Supplier. If I concatenate those data the display is not very clear for the user. Eg:
Supplier data: TOTO, contact_at_toto.com, 1234567890
I would rather have :
Supplier: TOTO
EMail: contact_at_toto.com
Phone Number: 1234567890
As you said, the non automatic update of calculated fields is an issue in my case. So I am currently looking at assignments, which seems to be schedulable via a workflow but I don't know if it's a good mean?
Best regards,
Patrick -
Field selection from differant tables
hello all,
i need to select differant fields from differant tables when i select common fields from both the tables, is it necessary that the common field need to be a primary key in both tables.
thanks in advance
seenuHI,
No its not required that the common field be part of the primary key in both tables only thing is you need to prefix the table name if the field names are same. But if you are using a INNER JOIN then there is no need to select both fields since you know the content of both fields will be same if JOIN is ON these fileds as well.
Regards,
Sesh
Message was edited by:
Seshatalpasai Madala -
Include field u201CXREF1_HDu201D from "BKPFu201D table while posting or Parking Docs
Hi,
I want include one additional field while posting or parking any accounting document. The field i want to include is from u201CBKPFu201D table and field name is u201CXREF1_HDu201D . This is at Header level.
Please advise as to how i can achieve this.
Thanks,
SafiHi,
Checking documentation of the data element, it seems the field is used for RE (Real Estate) only. But I'm not sure.
Regards,
Teddy Kurniawan -
Bank Key field change from database table
Dear All,
At our client, 4 house banks are maintained. The bank keys entered for these are not BSR Codes but something like 100,200,300,400.
This is not correct as we need to maintain BSR Code in Bank Key field as it is required on Form 16 A (TDS Cetificate)
The Bank Key field is in display mode. I am thinking of changing wrong value from database table T012 & BNKA .
Has anybody done this before? Will it affect my past or future transactions?
Thanks & regards,
GovDear Gulshan,
What you are saying is correct & I subscribe to your view also.
Creation of House Bank all over again seems to be one of the better options.
We tried doing one more thing & which is working fine on Development.
Our primary requiremnt is to have BSR Code on the From 16 A. System picks up the Bank key for this.
We copied the standard Form 16A & created a Z. Then abaper created a subroutine. It is like when Bank key 100 comes to Form16A, replace it with say 0098500 (Correct BSR Code of the Bank)
This helped to get the correct BSR Code in Form 16A & saved us from recreation of House Bank data.
Your comments are welcome.
Regards,
Gov -
How to change the field labels from English to German language.
Hi Experts,
I have added 2 more fields for the output of the standard transaction ME2L.
I have added in English Language. Now i want to display those field labels in German Language.
How can i get this.Please help.
Thanks in Advance.
Jyothi.Jyothi,
The problem was solved?
If so, can you close the message?
Best regards,
Rafael Sá
Maybe you are looking for
-
My Ipod was in my back pocket and when I took it out it has a white screen with 3 grey lines going threw it, and not even 5mins before, it was working fine... what could i be? it also isnt hooking up to itunes... please help
-
Relation between maintainance order and capacity plannig
Hi If i create maintainance order for workcenter or resource that has been used in capacity planning in production process then is it going to affect capacity value. if it is then how and where? Thanking you.
-
XI 3.0 for deregulated market communication?
Hi, I'm trying to answer 2 questions for an Irish utility company around the use of XI for market communication, both for retail and wholesale market messages. The current EAI layer being used is SeeBeyond, and XI is being discussed as potentially a
-
Upload internal table data to Application server in Excel Sheet
Hi All, I have all my data in an internal table.I want to Upload this data to the Application server in the EXCEL sheet with the Column Header. How can i do this.Is there any standarad function module or class to to write in xls format. Can anybody h
-
Aperture and sorting MobileMe Galleries
Problem solved.