Read data from MDM For Lookup and Flat table using MDM ABAP API

Hi,
I have requriment to read data from MDM from FLAT and Lookup table using MDM ABAP API. My design  is like this ,
I have one ITEMS (Main table in MDM) and inside that i have one Lookup flat table ITEM_TYPE , my requriment is to read Item number and its related Item type.
From ABAP.
Please help if any body has any idea.
Regards,
Shyam

HI Guys,
I found my solution by myself. Below is the solution , hope this will help others:-
Retrieve data from MDM  using MDM ABAP API.
Step- 1. Create structure in SAP with the same name as that of MDM field code for MDM Main table.
Step-2. Create another structure in SAP having all  lookup fields of MDM , fieldname in ECC must be same as that of MDM field
code.
Step-3.Create structure in SAP for  individual lookup field(Single Field only)   with the same name as MDM Field code.
Step-4.
DATA: IT_QUERY            TYPE STANDARD TABLE OF MDM_QUERY,  "MDM_QUERY_TABLE,
      WA_QUERY            TYPE  MDM_QUERY,
      WA_CDT_TEXT         TYPE  MDM_CDT_TEXT,
      IT_RESULT_SET_KEY   TYPE  MDM_SEARCH_RESULT_TABLE,
      WA_RESULT_SET_KEY   TYPE  MDM_SEARCH_RESULT,
      WA_STRING           TYPE  STRING.
DATA:<Internal table> TYPE STANDARD TABLE OF <SAP Str Having all LOOKup Fields>    
DATA: :<Internal table>TYPE STANDARD TABLE OF <SAP Str one LOOKup field>,
     <Workarea> LIKE LINE OF :<Internal table>.
*PASS LOGICAL OBJECT NAME.
V_LOG_OBJECT_NAME = 'Logical object name defined in Customization'.
Define logon language, country & region for server
WA_LANGUAGE-LANGUAGE = 'eng'.
WA_LANGUAGE-COUNTRY = 'US'.
WA_LANGUAGE-REGION = 'USA'.
TRY.
    CREATE OBJECT LR_API
      EXPORTING
        IV_LOG_OBJECT_NAME = V_LOG_OBJECT_NAME.
ENDTRY.
CONNECT to repository. Apply particular logon language info
CALL METHOD LR_API->MO_ACCESSOR->CONNECT
  EXPORTING
    IS_REPOSITORY_LANGUAGE = WA_LANGUAGE.
*NOW PASS ITEM NO AND GET KEY FROM MDM.
CLEAR WA_QUERY.
WA_QUERY-PARAMETER_CODE  = <MDM FIELD CODE>. "Field code
WA_QUERY-OPERATOR        = 'EQ'. "Contains
WA_QUERY-DIMENSION_TYPE  = 1. "Field search
WA_QUERY-CONSTRAINT_TYPE = 8. "Text search
WA_STRING                = <Field Value>.
GET REFERENCE OF WA_STRING INTO WA_QUERY-VALUE_LOW.
APPEND WA_QUERY TO IT_QUERY.
CLEAR WA_QUERY.
*PASS ITEM NUMBER AND GET RELATED KEY FROM MDM.
TRY.
    CALL METHOD LR_API->MO_CORE_SERVICE->QUERY
      EXPORTING
        IV_OBJECT_TYPE_CODE = <MDM Main Table>
        IT_QUERY            = IT_QUERY
      IMPORTING
        ET_RESULT_SET       = IT_RESULT_SET_KEY.
  CATCH CX_MDM_COMMUNICATION_FAILURE .
  CATCH CX_MDM_KERNEL .
  CATCH CX_MDM_NOT_SUPPORTED .
  CATCH CX_MDM_USAGE_ERROR .
  CATCH CX_MDM_PROVIDER .
  CATCH CX_MDM_SERVER_RC_CODE .
ENDTRY.
Pass record id into keys.
LOOP AT IT_RESULT_SET_KEY INTO WA_RESULT_SET_KEY.
  WA_KEYS = WA_RESULT_SET_KEY-RECORD_IDS.
ENDLOOP.
WA_RESULT_SET_DEFINITION-FIELD_NAME = <Look field name>.
APPEND WA_RESULT_SET_DEFINITION TO IT_RESULT_SET_DEFINITION.
CALL METHOD LR_API->MO_CORE_SERVICE->RETRIEVE
  EXPORTING
    IV_OBJECT_TYPE_CODE      = <MDM Main Table>
    IT_RESULT_SET_DEFINITION = IT_RESULT_SET_DEFINITION
    IT_KEYS                  = WA_KEYS
  IMPORTING
    ET_RESULT_SET            = IT_RESULT_SET.
LOOP AT IT_RESULT_SET INTO
        WA_RESULT_SET.
*PASS KEYS INTO MAIN TABLE TO GET Structure for FALT or Look up Table
  TRY.
      CALL METHOD LR_API->MO_CORE_SERVICE->RETRIEVE_SIMPLE
        EXPORTING
          IV_OBJECT_TYPE_CODE = <MDM Main Table>
          IT_KEYS             = WA_KEYS
        IMPORTING
          ET_DDIC_STRUCTURE =<SAP Strct having all Look up fileds of MDM>         
  ENDTRY.
  LOOP AT <SAP Strct having all Look up fileds of MDM> INTO <Work area>.
    CLEAR WA_KEYS.
    APPEND <Work area>-field name TO WA_KEYS.
    CALL METHOD LR_API->MO_CORE_SERVICE->RETRIEVE_SIMPLE
      EXPORTING
        IV_OBJECT_TYPE_CODE = <MDM Lookup table name>
        IT_KEYS             = WA_KEYS
      IMPORTING
        ET_DDIC_STRUCTURE   = <Single Structure in SAP For Lookup field>.
    READ TABLE <Single Structure in SAP For Lookup field>. INTO <Work Area> INDEX 1.
Here you can get the value of realted lookup fields associated with main table data.
  ENDLOOP.
ENDLOOP.
LR_API->MO_ACCESSOR->DISCONNECT( ).
Edited by: Shyam Babu Sah on Nov 24, 2009 4:52 AM

Similar Messages

  • Ugrent help. User exit- Read data from BW BPS layout and write to ODS

    Hi,
    I am new to BW BPS and have a req. where i need to read data from BPS layout (EXCEL) and write it to ODS.
    Is there any function module or user exit which read data from excel layout and upload it to ODS. Or can any one help me out how can i write a code for this.
    It is urgent and i need your help.
    Appreciate any kind of input.
    Thanks
    Mamatha

    Dear Mamatha,
    read following documents. i hope it will work for you.
    [http://www.geocities.com/cynarad/reference_for_bps_programming.pdf]
    [Accessing BW Master Data in BPS Functions using ABAP ( Exit Function )|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d3dcc423-0b01-0010-4382-aa3e0784b61e]
    Regards,
    Malik
    Give me points if its helpful for you.

  • How to read data from a CLUSTER STRUCTURE not cluster table.

    Hi,
    how to read data from a CLUSTER STRUCTURE not cluster table.
    regards,
    Usha.

    Hello,
    A structre doesnt contain data.. so u cannot read from it. U need to find out table of that structure and read data from it.
    Regards,
    Mansi.

  • How to extract data from info cube into an internal table using ABAP code

    HI
    Can Anyone plz suggest me
    How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
    Thankx in advance
    regds
    AJAY

    HI Dinesh,
    Thankq for ur reply
    but i ahve already tried to use the function module.
    When I try to Use the function module RSDRI_INFOPOV_READ
    I get an information message "ERROR GENERATION TEST FRAME".
    can U plz tell me what could be the problem
    Bye
    AJAY

  • Can Oracle Portal read data from an access DB and loaded it an Oracle DB?

    Hi All.
    Does Oracle Portal provides a portlet to read data from an access db so that i can transfer it to my Oracle DB?.
    I believe Application Express does that .... Any portlet maybe ...?
    Regards, Luis ...!

    There are portlets that read from a DB to make reports, you can try to create a form portlet so you can make inputs to the database, no buil-in like you wish, has to be done manually.
    greetings.

  • How to read data from spreadsheet as a look up table

    Hello Can anybody please help me out in this..??
    I want to read data from a spreadsheet file as it is a look up table.
    I want to create a program which lets the user enter an element which is be found in the data in the spreadsheet file and gives back the number which is to the adjoining column of the element in the spreadsheet file.
    Example i have the following data in spreadsheet file:
    Range  Count
    2              10
    4              49
    6              60
    Etc.
    If i enter 2 to search the data in the spreadsheet file, i do expect the program replies back with the answer 10 and so on...
    Can anyone please help out...
    Thanks in advance...

    apok wrote:
    Why autoindex the output?  You should only have 1 output.  Besides, the Search 1D Array is simpler (no loop needed).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Lookup Table.png ‏11 KB

  • Shell scripts to read data from a text file and to load it into a table

    Hi All,
    I have a text file consisting of rows and columns as follows,
    GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001 My requirement is that, i should read the first 3 columns of this file using a shell script and then i have to insert the data into a table consisting of 3 rows in oracle .
    the whole application is deployed in unix and that text file comes from mainframe. am working in the unix side of the application and i cant access the data directly from the mainframe. so am required to write a script which reads the data from text file which is placed in certain location and i have to load it to oracle database.
    so I can't use SQL * loader.
    Please help me something with this...
    Thanks in advance.

    1. Create a dictionary object in Oracle and assign it to the folder where your file resides
    2. Write a little procedure which opens the file in the newly created directory object using ULT_FILE and inside the FOR LOOP and do INSERTs to table you want
    3. Create a shell script and call that procedure
    You can use the post in my Blog for such issues
    [Using Oracle UTL_FILE, UTL_SMTP packages and Linux Shell Scripting and Cron utility together|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • How to properly read data from one DAQ-assistant and write simultaneously with another DAQ-assistant (which is inside a loop)

    Hello.
    I'm a newbie working on my Master's thesis conserning a project that is based on old G-code made by another newbie so bear with me.
    I need to create a sequance of output controls. For this I'm using a for loop that eventually creates two triangular ramps during a period of 90 seconds. I've confirmed that this function works properly by measuring the actual output of the DAQ-decice (NI USB 6353).
    The problem is the following: During this controll-cycle I need to simultanously collect data from the same DAQ-device. At this point there is only one DAQ-assistant output-block in the main loop of the program and all the signals are derived from it to where they are needed.There is a case-structure (the bottom case structure in the picture) that contains the functions needed to collect the data during the test cycle. However these two actions, outputting data and inputting data, are not synchronized in any way which may be the reason why I get the 200279 error or alternatively the 200284 error during the test cycle. I've tried changing the sample rate, buffer size and the timeout time as adviced but nothing seems to help.
    What would be the simplest way to solve this problem?
    Help is greatly appreciated!
    Attachments:
    problem.jpg ‏206 KB

    Thanks for quick reply.
    However, I did try it (see the picture) but I still have a problem: I only get 100 samples / channel during the test sequence (all from the first seconds of the sequence) in total even though I've set the data aqcuiring DAQ-assistant as "continous" and "samples to read = 95k" and rate is 1000Hz.
    Edit.
    And lastly, I have trouble adding this "extra" DAQ-assistant to the vi. because I get an error about a resource (The 6353) being reserved, even though I connected a false constant to the "STOP" -input of the main DAQ-assistant.
    Attachments:
    is_this_what_you_meant.jpg ‏212 KB

  • Reading data from App Web List and Displaying in HostWeb.

    Hi,
    Is it possible to read list data from AppWeb and display it on a page in HostWeb?
    Any approaches to achieve this?
    Regards,
    Rivin Jose.

    Hi Rivin,
    There seems no need to query an app web from host web cause App for SharePoint is designed to work as an “advanced web part” solution, it should work as a separate
    component of a SharePoint site which shouldn’t be taken care on the host web side.
    If you simply want to display data from app web in the host web, add an App Part into a page in the host web would be the best option for you as what Dan suggests.
    Thanks         
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • I need to read data from a text file and display it in a datagrid.how can this be done..please help

    hey ppl
    i have a datagrid in my form.i need to read input(fields..sort of a database) from a text file and display its contents in the datagrid.
    how can this  be done.. and also after every few seconds reading event should be re executed.. and that the contents of the datagrid will keep changing as per the changes in the file...
    please help as this is urgent and important.. if possible please provide me with an example code as i am completely new to flex... 
    thanks.....  

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to read data from select Options in another view without using context

    I have 2 views, one for selection screen and another for displaying result.
    In selection screen view I have define a select options with the help of webdynpro component.
    Now my object is display result in result view based on entry of selection screen.
    I don't want to do binding in context node, without that how I can read data of select option
    in result view?
    Regards,
    Rasmi Ranjan Mishra

    Solve by own.
    If I define the Select options in component controller, then it will be global in nature. so i can get the value of select options
    in another view also.
    Regards,
    Rasmi Ranjan Mishra

  • Loading the data from a text file to a table using pl/sql

    Hi Experts,
    I want to load the data from a text (sample1.txt) file to a table using pl/sql
    I have used the below pl/sql code
    declare
    f utl_file.file_type;
    s varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    loop
    utl_file.get_line(f,s);
    insert into sampletable (a,b,c) values (s,s,s);
    c := c + 1;
    end loop;
    exception
    when NO_DATA_FOUND then
    utl_file.fclose(f);
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    and my sample1.txt file looks like
    1
    2
    3
    The data is getting inserted, with below manner
    select * from sampletable;
    A     B     C
    1     1     1
    2     2     2
    3     3     3
    I want the data to get inserted as
    A     B     C
    1     2     3
    The text file that I have is having three lines, and each line's first value should go to each column
    Please help...
    Thanks

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • Reading data from a text file but can't use the data outside of the function.

    I am trying to load a variable from data in a text file.
    I can read the text file fine but the variable data seems
    only to be available with in the function that reads it.
    I need to use the variable data outside of the function.
    Does anyone have any suggestions to work around this issue?
    This is the actionscript code i'm using.
    var pathVars= new LoadVars();
    pathVars.onLoad=function(ok) {
    if(ok)
    trace("Loading");
    path_var=pathVars.path;
    trace("This is within the function "+path_var);
    pathVar0="This is within the function... "+path_var;
    Yet the path_var is available here fine.
    pathVars.load("mypath.txt");
    This is where the path_var becomes undefined
    trace("This is outside the function... "+path_var);
    pathVar1="This is outside the function... "+path_var;
    This
    is a download link for the FLA zip file
    This
    is a demo of the script loading the text file

    The external traces are being executed before the file is
    loaded.

  • Static lookup lists:read data from a Java *.properties file

    Hi
    i need to make static lookup lists i am using read data from a Java *.properties file
    i am using the Class "PropertyFileBasedLookupViewObjectImpl" that wrote by Steve Muench in ToyStore.
    but i need to use the default language for that i update the loadDataFromPropertiesFile()
    method to find the correct properties file
    String temp=Locale.getDefault().getLanguage();
    String propertyFile =
    getViewDef().getFullName().replace('.', '/')+"_"+temp+ ".properties";
    the problem:
    For English(TEST_en.properties) it is good and working
    For Arabic(TEST_ar.properties) read from correct file _ar.properties
    but the dispaly character is wrong
    When Debug
    In the File 1=&#1583;&#1605;&#1588;&#1602;
    In debug 1=/u32423

    Depending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
    http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html

  • How to read data from Logical Database ADA for more than one financia year

    Hi,
    I need to read data from ADA logical database and ANLCV node for current financial year 2007 and for the next 3 years – 2008, 2009, 2010. When I do this using program attached below, I receive only data for one year, which is entered at the selection screen in the field BERDATUM. How should I modify my program to read ANLCV node for more then one year ? Could anybody help me ?
    Kind regards,
    Zbigniew Debowski
    REPORT  ZWRZD075.
    NODES: anlav, anlcv.
    START-OF-SELECTION.
    GET anlav.
    WRITE:/ anlav-anln1, ' ', anlav-anln2.
    GET anlcv.
    WRITE:/ anlcv-kansw, ' ', anlcv-knafa, ' ', anlcv-gjahr.

    Hi!
    Have you already tried your luck in Java Programming forum?
    Regards,
    Thomas

Maybe you are looking for