Select name1 frm kna1 table on basis of customer number

hi below is my PAI code
my requiremnt is to select name1 field from kna1 table where
kan1-kunnr = t_ZCUST_EM_create-ship_to
where to code it pls suggest and how it will be displayed in the screen 200 ie when user press enter the name1 should automatically populate and display on the screen...
PROCESS AFTER INPUT.                                                                               
MODULE CANCEL_200 AT EXIT-COMMAND.                                                                               
LOOP WITH CONTROL TABLE_ZCUST_EM_CREATE ."AT T_AIMS_OPN_CREATE ." .".
   MODULE USER_COMMAND_0200.                                                                               
CHAIN.                                                                               
FIELD t_ZCUST_EM_create-ship_to .                                                                               
MODULE set_field_validation ON CHAIN-REQUEST.

hi anji
here is my code i ahve written in PAI event but facing problem that whne i save entering the third firled in table zcustemal which has ship_to ship to name
and email id, kunnr is matched against kna1 table and eror msg comes if the kunnr in not in kna1 table it is working ok
now also name 1 is being populated in the field in the screen as per my code
but problem is
1) when just typing kunnr and email id ( and press save without enter the data for all three is saved ie kunnr name1 ( which is selected from table kna1) and e mail id
2) but whne i press enter after entering kunnr number on screen and then enter email id an dsave email id is not saved only kunnr and name1 is saved pls suggest
where should i code dont know pls suggest??????
CODe in screen
PROCESS BEFORE OUTPUT.
  LOOP   WITH CONTROL TABLE_ZCUST_EM_CREATE."AT T_ZCUST_EM_CREATE
    MODULE STATUS_0200.
  ENDLOOP.
*Process after input
PROCESS AFTER INPUT.
  MODULE CANCEL_200 AT EXIT-COMMAND.
  LOOP WITH CONTROL TABLE_ZCUST_EM_CREATE ."AT T_zcust_em_CREATE ." .".
    CHAIN.
      FIELD t_ZCUST_EM_create-ship_to .
      MODULE set_field_validation ON CHAIN-REQUEST.
    ENDCHAIN.
    MODULE USER_COMMAND_0200.
  ENDLOOP.
  module read_table_value_0200.
<b>MODULE set_field_validation INPUT.</b>
nv added for  three email id and ship_to name
  select single * from zcustemail   where ship_to eq
  t_zcust_em_create-ship_to
  and ship_to_name = t_zcust_em_create-ship_to_name
  and email_id = t_zcust_em_create-email_id.
  if sy-subrc eq 0.
    t_gui1-fcode = 'BACK'.
    append t_gui1.
    t_gui1-fcode = 'EXIT'.
    append t_gui1.
    t_gui1-fcode = 'SAVE'.
    append t_gui1.
    SET PF-STATUS 'AIMS_200' excluding t_gui1.
    message e001 with 'Record already Exists in Zcusteamil'(001).
  else.
*nv
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
             INPUT         = t_zcust_em_create-ship_to
          IMPORTING
              OUTPUT       = t_zcust_em_create-ship_to.
     select single kunnr from kna1 into v_kunnr
     where kunnr = t_zcust_em_create-ship_to.
    if sy-subrc = 0.
       select single name1 from kna1 into t_zcust_em_create-ship_to_name
       where kunnr = t_zcust_em_create-ship_to.
      SET PF-STATUS 'AIMS_200'.
       else.
       message E001 with 'customer number does not exists'.
   endif.
*nv
  endif.
ENDMODULE.                 " set_field_validation  INPUT
*Setting it for select/deselect entries
  move:t_zcust_em_create to t_zcust_em_create_sel.
  append t_zcust_em_create_sel.
  clear:t_zcust_em_create_sel.
*Getting internal table t_zcust_em_create with control
  read table t_zcust_em_create
         with key ship_to = t_zcust_em_create-ship_to.
*Getting internal table for create entries: screen-200
  if sy-subrc ne 0 and t_zcust_em_create-ship_to ne space .
    append  t_zcust_em_create     .
    move:t_zcust_em_create to t_zcust_em_create_tmp.
    append t_zcust_em_create_tmp .
    clear:t_zcust_em_create_tmp  ,
          t_zcust_em_create      .
  endif.
  clear:t_cols.
*Getting the value of  w_fill_200.
  describe table t_zcust_em_create lines w_fill_200.

Similar Messages

  • Performance Issue on Select Condition on KNA1 table

    Hi,
    I am facing problem when i am selecting from the table KNA1 for given account group and attribute9 it is taking lot of time .
    Please suggest the select query or any other feasible soln to solve this problem
    select
    kunnr
    kotkd
    from kna1
    where kunnr eq parameter value and
    kotkd eq 'ZPY' and katr9 = 'L' or 'T'.
    Firstly i am using in in katr9 then i removed dur to performance issue using read further please suggest further performanace soln

    Hi,
    The select should be like:
    select
    kunnr
    kotkd
    from kna1
    where kunnr eq parameter value
        and kotkd eq 'ZPY'
         and katr9 in r_katr9. "  'L' or 'T'.
    create a range for katr9 like r_katr9 with L or T.
    Because while selecting the entries from KNA1, it will check for KATR9 = L and then KATR9 = T.
    Hope the above statement is useful for you.
    Regards,
    Shiva.

  • Fields on selection field frm different tables

    Dear Techis
    I want to shw my selection screen with filds from different tables so hw i use select statement i dont want to use join statement so will anybody pls tell me alternative soln with example
    Thanks

    Hi,
    U can use for all entries see the example.
    i am using tow table like ekko ,ekpo.
    REPORT  z_sn_report                             .
    TYPE-POOLS: SLIS.
    TABLES: ekko , ekpo.
    types: BEGIN OF ty_ekko,
            ebeln TYPE ekko-ebeln,
            bukrs TYPE ekko-bukrs,
            lifnr TYPE ekko-lifnr,
          END OF ty_ekko.
    types: BEGIN OF ty_ekpo,
            ebeln TYPE ekpo-ebeln,
            ebelp TYPE ekpo-ebelp,
            matnr TYPE ekpo-matnr,
            menge TYPE ekpo-menge,
            netpr TYPE ekpo-netpr,
          END OF ty_ekpo.
    types: BEGIN OF ty_final,
            ebeln TYPE ekko-ebeln,
            bukrs TYPE ekko-bukrs,
            lifnr TYPE ekko-lifnr,
            ebelp TYPE ekpo-ebelp,
            matnr TYPE ekpo-matnr,
            menge TYPE ekpo-menge,
            netpr TYPE ekpo-netpr,
          END OF ty_final.
    data: it_ekko type standard table of ty_ekko with header line,
          it_ekpo type standard table of ty_ekpo with header line,
          it_final type standard table of ty_final with header line.
    DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_ebeln for ekko-ebeln.
    parameters: p_bukrs like ekko-bukrs.
    selection-screen: end of block b1.
    select ebeln
           bukrs
           lifnr
           from ekko
           into table it_ekko
           where ebeln in s_ebeln
           and bukrs = p_bukrs.
    if not it_ekko[] is initial.
    select ebeln
           ebelp
           matnr
           menge
           netpr
           from ekpo
           into table it_ekpo
           for all entries in it_ekko
           where ebeln = it_ekko-ebeln.
           endif.
    loop at it_ekpo.
    read table it_ekko with key ebeln = it_ekPo-ebeln.
    if sy-subrc  = 0.
    it_final-ebeln = it_ekko-ebeln.
    it_final-bukrs = it_ekko-bukrs.
    it_final-lifnr = it_ekko-lifnr.
    it_final-ebelp = it_ekpo-ebelp.
    it_final-menge = it_ekpo-menge.
    it_final-netpr = it_ekpo-netpr.
    append it_final.
    clear it_final.
    endif.
    endloop.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'IT_FINAL'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = IT_FIELDCAT[]
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = 'Z_SN_REPORT'
        I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = ' '
        I_CALLBACK_TOP_OF_PAGE            = ' '
        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      =
        I_GRID_SETTINGS                   =
        IS_LAYOUT                         =
         IT_FIELDCAT                       = IT_FIELDCAT[]
        IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 =
        IT_SORT                           =
        IT_FILTER                         =
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
         I_SAVE                            = 'X'
        IS_VARIANT                        =
        IT_EVENTS                         =
        IT_EVENT_EXIT                     =
        IS_PRINT                          =
        IS_REPREP_ID                      =
        I_SCREEN_START_COLUMN             = 0
        I_SCREEN_START_LINE               = 0
        I_SCREEN_END_COLUMN               = 0
        I_SCREEN_END_LINE                 = 0
        IT_ALV_GRAPHICS                   =
        IT_HYPERLINK                      =
        IT_ADD_FIELDCAT                   =
        IT_EXCEPT_QINFO                   =
        I_HTML_HEIGHT_TOP                 =
        I_HTML_HEIGHT_END                 =
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           =
        ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = IT_FINAL
      EXCEPTIONS
        PROGRAM_ERROR                     = 1
        OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • How to join KNA1 table with SOOD, SOST or SOES table?

    Hi,
    I am creating an infoset and I cant join KNA1 with any of the following tables: SOST, SOES or SOOD.
    I am looking to get the following fields from the following table:
    KNA1 - KUNNR: Customer Number
    SOES - STATUS: Status
    SOOD- OBJNAM : Send Method
    SOOD - OBJDES : Document Title
    SOOD - CRONAM : Created by
    SOES- MSGV1 : Recipient
    SOST - STAT - DATE : Send date
    SOST - STAT - TIME : Send time
    I tried adding knvp table to find a common field but cant seem to join them. SOST, SOES and SOOD are easily joined with each other but KNA1 or KNVP cannot be joined, is there any intermediate table that I should use to join these tables to get the customer number against them or is there any other solution. kindly help.
    Regards,
    Moaz

    Hi,
    please try to connect KNA1 with SOOD using
    CALL METHOD cl_binary_relation=>read_links
       EXPORTING
         is_object           = ls_lpor
         it_relation_options = lt_relat
       IMPORTING
         et_links            = lt_links.
    where ls_por-instid = kna1-kunnr, ls_por-typeid = 'KNA1' and ls_por-catid = 'BO'
    and  lt_relat contains a line option 'I' 'EQ' 'NOTE'.
    Regards,
    Klaus

  • How to select values frm table giving the condition value at runtime in SQL

    Hi All,
    How to select values from a table by giving the condition value at runtime in SQL
    My SQL statement is select * from employee where empno=<empno>, this empno I want to provide at run time. Also I don't have any bind variables defined. Can anyone please tell how can I achieve this. Also do I have to write a SQL or pl/sql statement.

    Hi Roshni Shankar,
    You can use substitution variable in case of SQL.
    SQL> select * from employees where emplployee_id = &emp_id;
    Enter value for emp_id: 100
    old   1: select * from employees where emplployee_id = &emp_id
    new   1: select * from employees where emplployee_id = 100If you want to put condition on varchar values then eighter provide values in single quotes or use single quote for substitution variable.
    SQL> select * from employees where last_name = &emp_name;
    Enter value for emp_name: 'King'
    old   1: select * from employees where last_name = &emp_name
    new   1: select * from employees where last_name = 'King'
    no rows selected
    SQL> select * from employees where last_name = '&e_name';
    Enter value for e_name: King
    old   1: select * from employees where last_name = '&e_name'
    new   1: select * from employees where last_name = 'King'In case of pl/sql you can pass values to procedure and you can use those values at run time.
    create or replace procedure test (p_emp_id number)
    as
       v_last_name      varchar2(100);
    begin
       select last_name
       into    v_last_name
       from  employees
       where employee_id = p_emp_id;
       dbms_output.put_line(p_emp_id ||'    ->    '||v_last_name);
    end;
    show errors
    SQL>exec test(100);
    SQL>exec test(101);Edited by: Gaurav Bhide on Oct 29, 2012 4:07 AM

  • Select statement using 2 tables

    Hi Experts,
    In the following code, i have to select "v_likp-charg" into the "concatenate" statement.
    could you please let me know, how can i do that.
    help is appreciated,
    code:
    <b>data: i_kna1 type t_kna1 occurs 0,
          v_kna1 type t_kna1,
          i_likp type t_likp occurs 0,
          v_likp type t_likp.
    data: begin of t_kna1,
            kunnr like kna1-kunnr,
            name1 like kna1-name1,
           end of t_kna1.
    data: begin of t_likp,
            matnr like likp-matnr,
            charg like likp-charg,
            kunnr like likp-kunnr,
          end of t_likp.
    data: begin of v_output,
             record(500),
          end of v_ouput.
    loop at i_kna1 into v_kna1.
    concatenate: v_kna1-kunnr
                 v_kna1-name1
    i want "v_likp-charg" to be here..******
          into v_output seperated by c_tab.
    append v_ouput.</b>
    thanks,

    You need to make a connection to the customer master file.  In this case, you will have a 1 to many relationship with KNA1 and LIKP.  Do you want to output only one record for each customer number?
    Assuming that you already have the v_likp internal table, you can just read it with key.
    loop at i_kna1 into v_kna1.
    clear v_likp.
    read table i_likp into v_likp with key kunnr = v_kna1-kunnr.
    concatenate: v_kna1-kunnr
    v_kna1-name1
    v_likp-charg
        into v_output seperated by c_tab.
    append v_ouput.
    Regards,
    Rich Heilman

  • Select data from a table and a view: field with same content and different type

    hi all,
    I need data from a table hrp1001 and a view V_USR_NAME. What they have in common are the content of the fields SOBID and BNAME .
    It will be easier if those fields add a same type but they dont.
    Any suggestions for a workaround?
    Thanks

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • Select record from database table

    how to select a record from data-base table for current month in module-pool, i.e if current month is august then records selected should between 1/08/10 to 31/08/10.
    And, i also want to select records for last month i.e if current month is august then records selected should be between 1/07/10 to 31/07/10.
    And one thing more, it should work for every scenario. Like for months are changing then it should work according to that.
    Example: If month changes to October then current month ll be October and last month ll become September.
    Plz help me out.
    Moderator message: you chose a better forum this time, but the question is still too basic to be asked here, please (re)search yourself first, these forums are not catering to beginners.
    locked by: Thomas Zloch on Aug 8, 2010 9:41 PM

    Hi Nishant,
    You can use the option <b>ORDER BY </b> in your SELECT clause.
    This is the SAP Documentation for <b>ORDER BY </b> option.
    <i>Variant 1</i>
    <b>...ORDER BY PRIMARY KEY</b>
    <b>Effect</b>
    Sorts the selected lines in ascending order by the primary key of the database table. This variant is only permitted for SELECT * ....
    <i>Notes</i>
    Since views do not have a primary key, specifying ORDER BY PRIMARY KEY only makes sense with database tables. If, however, you do specify ORDER BY PRIMARY KEY with a view, all fields of the view are sorted in ascending order.
    <i>Variant 2</i>
    <b>ORDER BY f1 ... fn</b>
    <i>Effect</i>
    Sorts the selected records in ascending order by the specified column references f1 ... fn. If a list is also specified in the SELECT clause, the column references f1, ..., fn must appear in this list.
    By supplementing the statement with DESCENDING, you can sort in descending order using any of the fields f1, ..., fn.
    The default sort sequence is ascending order, but you can make this explicit by adding the addition ASCENDING.
    Consider this code this will select the latest 10 records form DB table(Note can use <b>Variant 2</b> for DB tables also.
    REPORT zarun_1.
    DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT * FROM mara
                INTO TABLE it_mara
                <b>UP TO 10 ROWS                "No of rows you need(give 1 here)
               ORDER BY matnr DESCENDING.    "Specify the Key Fields here.</b>
      LOOP AT it_mara.
        WRITE : / it_mara-matnr,
                  it_mara-mtart.
      ENDLOOP.
    Regards,
    Arun Sambargi.
    Message was edited by: Arun Sambargi

  • Need to Improve  pefromance for select statement using MSEG table

    Hi all,
    We are using a select statement using MSEG table
    which takes a very long time to run the program which is scheduled in back ground.
    Please see the history below.;
    1) Previously this program was using SELECT-ENDSELECT statement inside the loop i.e.
    LOOP AT I_MCHB.
    To get Material Doc. Details
          SELECT MBLNR
                 MJAHR
                 ZEILE INTO (MSEG-MBLNR,MSEG-MJAHR,MSEG-ZEILE)
                 UP TO 1 ROWS
                 FROM MSEG
                WHERE CHARG EQ I_MCHB-CHARG
                 AND  MATNR EQ I_MCHB-MATNR
                 AND  WERKS EQ I_MCHB-WERKS
                 AND  LGORT EQ I_MCHB-LGORT.
          ENDSELECT.
    Endloop.
    The program was taking 1 hr  for  20 k data
    2)The above statement was replaced by ALL ENTRIES to remove the SELECT-ENDSELECT from the loop.
    ***GET MATERIAL DOC NUMBER AND FINANCIAL YEAR DETAILS FROM MSEG TABLE
        SELECT MBLNR
               MJAHR
               ZEILE
               MATNR
               CHARG
               WERKS
               LGORT
                   INTO TABLE I_MSEG
                   FROM   MSEG
                   FOR ALL ENTRIES IN I_MCHB
                   WHERE CHARG EQ I_MCHB-CHARG
                   AND   MATNR EQ I_MCHB-MATNR
                   AND   WERKS EQ I_MCHB-WERKS
                   AND   LGORT EQ I_MCHB-LGORT.
    3)After getting the further technical analysis from BASIS team , And with the suggestion to optimize the program by changing the INDEX RANGE SCAN to
           MSEG~M.
    SELECT MBLNR
               MJAHR
               ZEILE
               MATNR
               CHARG
               WERKS
               LGORT
                   INTO TABLE  I_MSEG
                   FROM   MSEG
                   FOR ALL ENTRIES IN I_MCHB
                   WHERE MATNR EQ I_MCHB-MATNR
                   AND   WERKS EQ I_MCHB-WERKS
                   AND   LGORT EQ I_MCHB-LGORT.
    At present the program is taking 3 to 4 hrs in back ground .
    The table is complete table scan using index
    MSEG~M.
    Please suggest to improve the performance of this
    many many thanks
    deepak

    The benchmark should be the join, and I can not see how any of your solutions can be faster than the join
    SELECT   .....
                  INTO TABLE  ....
                  UP TO 1 ROWS
                  FROM mchb as a
                  INNER JOIN mseg as b
                  ON    amatnr EQ bmatnr
                  AND  awerks  EQ bwerks
                  AND  algort    EQ blgort
                  And   acharg  EQ bcharg
                  WHERE a~ ....
    The WHERE condition must come from the select on MCHB, the field list from the total results
    you want.
    If you want to compare, must compare your solutions plus the select to fill I_MCHB.
    Siegfried
    Edited by: Siegfried Boes  on Dec 20, 2007 2:28 PM

  • How to select data from cluster table

    hi experts,
                   I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
    how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
    please advice.
    mani

    Hi Manikandan,
    The following code may be helpful to understand how to select the data from cluster table.
    Types: Begin of ty_kna1,
    Kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_kna1,
    begin of ty_bseg,
    belnr type bseg-belnr,
    kunnr type bseg-kunnr,
    end of ty_bseg,
    begin of ty_final,
    belnr type bseg-belnr,
    kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_final.
    Data: it_kna1 type table of ty_kna1,
    wa_kna1 type ty_kna1,
    it_bseg type table of ty_bseg,
    wa_bseg type ty_bseg,
    it_final type table of ty_final,
    wa_final type ty_final.
    Select kunnr adrnr from kna1 into table it_kna1 where....
    if sy-subrc = 0.
    select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
    endif.
    sort it_kna1 by kunnr.
    Loop at it_bseg into wa_bseg.
    move wa_bseg-belnr to wa_final-belnr.
    read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
    if sy-subrc = 0.
    move: wa_kna1-kunnr to wa_final-kunnr,
    wa_kna1-belnr to wa_final-belnr.
    endif.
    append wa_final to it_final.
    clear wa_final.
    endloop.
    Loop at it_final into wa_final.
    write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
    endloop.
    Reward if useful.
    Thankyou,
    Regards.

  • Select r/3 kna1 from CRM

    Hi Gurus,
    I have to look at R/3 tabla kna1 and knvp. I'm in CRM but I don't know how to search in the r/3 system.
    Please help.
    Thanks

    Hi,
    There's an RFC-enabled function module which allows you to select data in a remote R3 system - I think it's called RFC_TABLE_READ (or something similar).  Basically, you just supply your selection criteria in one table and a list of fields you'e looking for (along with the table name, of course) and then you get a list of matching records back.
    Hope this helps,   Andy

  • How to Compare Data length of staging table with base table definition

    Hi,
    I've two tables :staging table and base table.
    I'm getting data from flatfiles into staging table, as per requirement structure of staging table and base table(length of each and every column in staging table is 25% more to dump data without any errors) are different for ex :if we've city column with varchar length 40 in staging table it has 25 in base table.Once data is dumped into staging table I want to compare actual data length of each and every column in staging table with definition of base table(data_length for each and every column from all_tab_columns) and if any column differs length I need to update the corresponding row in staging table which also has a flag called err_length.
    so for this I'm using cursor c1 is select length(a.id),length(a.name)... from staging_table;
    cursor c2(name varchar2) is select data_length from all_tab_columns where table_name='BASE_TABLE' and column_name=name;
    But we're getting data atonce in first query whereas in second cursor I need to get each and every column and then compare with first ?
    Can anyone tell me how to get desired results?
    Thanks,
    Mahender.

    This is a shot in the dark but, take a look at this example below:
    SQL> DROP TABLE STAGING;
    Table dropped.
    SQL> DROP TABLE BASE;
    Table dropped.
    SQL> CREATE TABLE STAGING
      2  (
      3          ID              NUMBER
      4  ,       A               VARCHAR2(40)
      5  ,       B               VARCHAR2(40)
      6  ,       ERR_LENGTH      VARCHAR2(1)
      7  );
    Table created.
    SQL> CREATE TABLE BASE
      2  (
      3          ID      NUMBER
      4  ,       A       VARCHAR2(25)
      5  ,       B       VARCHAR2(25)
      6  );
    Table created.
    SQL> INSERT INTO STAGING VALUES (1,RPAD('X',26,'X'),RPAD('X',25,'X'),NULL);
    1 row created.
    SQL> INSERT INTO STAGING VALUES (2,RPAD('X',25,'X'),RPAD('X',26,'X'),NULL);
    1 row created.
    SQL> INSERT INTO STAGING VALUES (3,RPAD('X',25,'X'),RPAD('X',25,'X'),NULL);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT * FROM STAGING;
            ID A                                        B                                        E
             1 XXXXXXXXXXXXXXXXXXXXXXXXXX               XXXXXXXXXXXXXXXXXXXXXXXXX
             2 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXXX
             3 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXX
    SQL> UPDATE  STAGING ST
      2  SET     ERR_LENGTH = 'Y'
      3  WHERE   EXISTS
      4          (
      5                  WITH    columns_in_staging AS
      6                  (
      7                          /* Retrieve all the columns names for the staging table with the exception of the primary key column
      8                           * and order them alphabetically.
      9                           */
    10                          SELECT  COLUMN_NAME
    11                          ,       ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) RN
    12                          FROM    ALL_TAB_COLUMNS
    13                          WHERE   TABLE_NAME='STAGING'
    14                          AND     COLUMN_NAME != 'ID'
    15                          ORDER BY 1
    16                  ),      staging_unpivot AS
    17                  (
    18                          /* Using the columns_in_staging above UNPIVOT the result set so you get a record for each COLUMN value
    19                           * for each record. The DECODE performs the unpivot and it works if the decode specifies the columns
    20                           * in the same order as the ROW_NUMBER() function in columns_in_staging
    21                           */
    22                          SELECT  ID
    23                          ,       COLUMN_NAME
    24                          ,       DECODE
    25                                  (
    26                                          RN
    27                                  ,       1,A
    28                                  ,       2,B
    29                                  )  AS VAL
    30                          FROM            STAGING
    31                          CROSS JOIN      COLUMNS_IN_STAGING
    32                  )
    33                  /*      Only return IDs for records that have at least one column value that exceeds the length. */
    34                  SELECT  ID
    35                  FROM
    36                  (
    37                          /* Join the unpivoted staging table to the ALL_TAB_COLUMNS table on the column names. Here we perform
    38                           * the check to see if there are any differences in the length if so set a flag.
    39                           */
    40                          SELECT  STAGING_UNPIVOT.ID
    41                          ,       (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_A
    42                          ,       (CASE WHEN ATC.DATA_LENGTH < LENGTH(STAGING_UNPIVOT.VAL) THEN 'Y' END) AS ERR_LENGTH_B
    43                          FROM    STAGING_UNPIVOT
    44                          JOIN    ALL_TAB_COLUMNS ATC     ON ATC.COLUMN_NAME = STAGING_UNPIVOT.COLUMN_NAME
    45                          WHERE   ATC.TABLE_NAME='BASE'
    46                  )       A
    47                  WHERE   COALESCE(ERR_LENGTH_A,ERR_LENGTH_B) IS NOT NULL
    48                  AND     ST.ID = A.ID
    49          )
    50  /
    2 rows updated.
    SQL> SELECT * FROM STAGING;
            ID A                                        B                                        E
             1 XXXXXXXXXXXXXXXXXXXXXXXXXX               XXXXXXXXXXXXXXXXXXXXXXXXX                Y
             2 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXXX               Y
             3 XXXXXXXXXXXXXXXXXXXXXXXXX                XXXXXXXXXXXXXXXXXXXXXXXXXHopefully the comments make sense. If you have any questions please let me know.
    This assumes the column names are the same between the staging and base tables. In addition as you add more columns to this table you'll have to add more CASE statements to check the length and update the COALESCE check as necessary.
    Thanks!

  • Updating a field in KNA1 table

    Hii ABAP Gurus,
    Please help me out from the following situation....
    Will reward points for the helpfull answers.
    I have a requirement where i need to update only 1 field in KNA1 table.... for that iam using
    update kna1 set loevm = 'X' where kunnr eq wa_output-kunnr.
    But i know u people will suggest me to use BAPI. in that case i tried to use BAPI.
    (BAPI_CUSTOMER_CREATEFROMDATA1)
    I have never worked on BAPI....Can any one please help me out regarding how to use this BAPI and what to pass in and out.
    call function 'BAPI_CUSTOMER_CREATEFROMDATA1'       
         exporting                                      
              pi_personaldata     =                     
            PI_OPT_PERSONALDATA =                     
              pi_copyreference    =                     
       IMPORTING                                      
            CUSTOMERNO          =                     
            RETURN              =                     
    THANKS IN ADVANCE AND WILL REWARD POINTS FOR THE HELPFULL ANSWERS

    Hello Govardhan-
    As your requirement says to modify only one field in kna1.I dont think bapi is necessary for this just try the below code.
    Data:i_kna1 type table of kn1,
            w_kna1 type kna1.
    select ...... from kna1 into table i_kna1
                                   where kunnr EQ 'XYZ'.
    loop at i_kna1 into w_kna1.
    w_kna1-loevm  = 'X'.
    modify kna1 from w_kna1.
    endloop.
    Cheers,
    ~Srini....

  • How To get selected row in a table

    Hi experts
                        I have been using a table in which I am using a column Tree by nesting . I have written code for dynamically expanding table tree . But I want to know current selected element of the table, for this i have done following
    steps
    1) created an action on Action <b>lead select </b> of the table .
    which has a parameter with type node element .
    2) now i need to use parameter mapping in domodify view .
    as
    IWDTable tab =  (IWDTable) view.getElement("CatalogTable");
            tab.mappingOfOnLeadSelect().addSourceMapping<b>("XYZ",</b> "element");
    But i dont know what is correct parameter <b>XYZ</b> to be passed.
    also if i am wrong in approach please let me know .
    Regards
    Abhay

    Hi
                I have used following code also but its not working
    IWDTable table  =  (IWDTable) view.getElement("CatalogTable");
    table.mappingOfOnLeadSelect().addSourceMappin               ("IWDNodeElement", "LeadSelect");
    and I have created an action
    public void onActionOnleadSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogElement LeadSelect )
        //@@begin onActionOnleadSelect(ServerEvent)
        wdContext.currentContextElement().setDebug4(LeadSelect.getID());
        //@@end
    but when i select one row its giving error
    <b>com.sap.tc.webdynpro.services.exceptions.WDIllegalArgumentException: Parameter IWDNodeElement not found</b>

Maybe you are looking for

  • Access to a FG from another running program

    Group, Is there any way to "get a hold of" a reference of a functional global running inside another vi?  I have a program that uses a functional global to pass data between vi's of a program.  I have this program starting up as a service when I star

  • Isight camera not working after the last update

    After reboot of the last OS update Isight camera not working... i've tried photobooth, ichat, skype and it doesn't show up anywhere. in fact, when i go to system profiler, it doesn't show isight under USB connections at all. just to give you a recap

  • IPad and Media Manager Issues

    I just installed the Verizon Media Manager App on my iPad and it will not pull anything from my pc.  It keeps telling me to register.  It lets me sign in with my id, lets me bookmark things, but I cannot pull media from my PC.  It is very frustrating

  • How can I inserting file's line into a oracle table in physycal order

    How can I insert the file's line into a oracle table in the same physycal order that they exists in the file ? I am using "SQL to FILE" km to performing file load into Oracle table, but the order which the records are insered into the oracle table do

  • Reciept & consumption report

    hi expert ,               I create the receipt & consumption report but my output comes not correct as per requirement so please help me to resolve this problem.. i post my code FORM GET_DATA . SELECT   A~MATNR   A~MBLNR   A~ERFMG   A~BWART   A~MENGE