on 06-03-2009 4:29 AM
Hi experts,
i required to insert a text value from web dynpro java screen to a MDM look up table.
can you please help me with your suggestions or code snippet to do it.
regards
Narendra
Use the create Record command
- Create an Empty Record using the following API of RecordFactory
public static Record createEmptyRecord(TableId table)
Record lookUpRecord = RecordFactory.createEmptyRecord(TableId table)
- Get Field Ids of all the fields and set appropriate values
FieldId fi1 = repositorySchema.getFieldId( TableCode, FieldCode )
MDMValue mdmVal1 = new MDMValue(String) ;
lookupRecord.setFieldValue( fi1, mdmVal1) ;
do similarly for all the fields
Use Create Record Command with Connect
ion Object, Set the user Session string into it.
try{
CreateRecordCommand command = new CreateRecordCommand (Conneciton Object ) ;
command.setUserSession( UserSession ) ;
command.setRecord(lookupRecord) ;
command.execute( ) ;
//if successful, you can get the recordId from the above command.
command.getRecord().getId( ) ;
}
catch( Exception e)
{ }
PS: I just wrote this code as i was replying to assist you and is not a copied lines of code from my project. There may be some typing mistakes.
Regards,
Nitin
Edited by: Nitin Mahajan on Jun 4, 2009 8:03 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Narendra, please mark the query answered if it is resolved.
~Nitin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just for the logic,
Create / update a record in the lookup table as you would create record in the main table.
No change in execution,
After this, get the record Id if the record in the lookup table is new and set it to the lookup field value of the main table to do the mapping.
If you need i can send you the code.
Regards,
Nitin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narendra,
For inserting a new value to the lookup table you can do the following:
Use CreateRecordCommand to create a nw record in Lookup Table. Only difference here will be the TableId that you will pass. Pass the table Id of the lookup table instead of Main Table.
Pseudo code:
1. Create the user Session
2. create an object of CreateRecordCommand
3. Create an Empty Record with the required values for the fields
4. Execute the command after setting the required parameters
Hope this helps!!
Cheers,
Arafat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narendra,
Check the below link. Code would be same just in the place of table name pass the code of lookup table.
Since you are using WebDynpro. You need to create the context elements and bind them with the screen or ui elements. On click of button say Save, you will get the valyes from ui elements into the context elements, just type cast these values in the format MDM expects and use the code shown in the below link.
Regards,
Jitesh Talreja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.