READ TABLE bdcmsg WITH KEY msgtyp = 'E' msgtyp = 'A'.

In the ECC6.0 system,the following code is showing syntax error (msgtyp should be used only once)
    READ TABLE bdcmsg WITH KEY msgtyp = 'E' msgtyp = 'A'.
Can anyone pls give me a solution.
Regards
Sajid

HI,
you can read the table only with different keys.
e.g.
READ TABLE bdcmsg WITH KEY msgtyp = 'E' msgart = 'A'.
I think you need to work with an workingarea so that you can go over more then one msgtyp.
e.g.
DATA: spfli_tab TYPE SORTED TABLE OF spfli
                WITH UNIQUE KEY carrid connid,
      spfli_key LIKE LINE OF spfli_tab.
FIELD-SYMBOLS <spfli> TYPE spfli.
SELECT *
       FROM spfli
       INTO TABLE spfli_tab
       WHERE carrid = 'LH'.
spfli_key-carrid = 'LH'.
spfli_key-connid = '0400'.
READ TABLE spfli_tab FROM spfli_key ASSIGNING <spfli>.
IF sy-subrc = 0.
ENDIF.
regards
Nicole
Edited by: Nicole Lorenz on Mar 18, 2008 5:44 AM
Edited by: Nicole Lorenz on Mar 18, 2008 5:45 AM

Similar Messages

  • Read Table ITAB with key Dynamic Value = Value

    Here is sample Intenral table
    Columnname-C01 / C02 / C03
    Value-123 / 456 /789
    I would like to search value of the internal table according to dynamic value given by the code.
    i.e.
    read table ITAB with key <Dynamic Value> index 1.

    Hi Rupesh,
    Just try the following piece of code:
    TYPES: BEGIN OF str,
            A TYPE C,
            B TYPE I,
            C(2) TYPE C,
           END OF STR.
    DATA itab TYPE TABLE OF str WITH HEADER LINE.
    itab-A = 'X'.
    itab-B = '100'.
    itab-C = 'YZ'.
    APPEND itab.
    PERFORM c_itab_read USING 'A' 'X'.
    PERFORM c_itab_read USING 'B' '100'.
    PERFORM c_itab_read USING 'C' 'YZ'.
    FORM c_itab_read USING key TYPE ANY val TYPE ANY.
      READ TABLE itab WITH KEY (KEY) = val.
      IF SY-SUBRC IS INITIAL.
        WRITE: 'Hurray!'.
      ENDIF.
    ENDFORM.
    Hope this helps.
    Reqard points if query answered.
    Cheers,
    ~i1

  • Read Table ITAB with key Dynamic Value index 1

    Here is sample Intenral table
    Columnname-C01 / C02 / C03
    Value-123 / 456 /789
    I would like to search value of the internal table according to dynamic value given by the code.
    i.e.
    read table ITAB with key <Dynamic Value> index 1.

    Hi,
    Apart from read, you can also use <b>SEARCH</b> statement.
    Syntax
    SEARCH
    Searches for strings.
    Syntax
    SEARCH <f>|<itab> FOR <g> [ABBREVIATED]
                              [STARTING AT <n1>]
                              [ENDING AT <n2>]
                              [AND MARK]
                              [IN BYTE MODE|IN CHARACTER MODE].
    Searches the field <f> or table <itab> for the string in the field <g>. The result is stored in SY-FDPOS. The additions let you hide intermediate characters, search from and to a particular position, and convert the found string into uppercase. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions.
    Hope this information is useful to you.
    Regards,
    Saumya

  • Read table itab with key

    Hi,
    Unfortunately i've been almost a year out of abap,so its kinda rusty, so pls bear with my question. I've to develop this upload program, which would read from file, but the catchy part is that to filter out the records by either pernr, bukrs, subty or any of the criteria simultaneously. I'm using select-options for  pernr, subty, bukrs, but the problem is how do i filter it out, what sort of logic/ algorithm should i be using, READ TABLE itab WITH KEY or a LOOP statement, could any 1 give any suggestions as to how i should be designing the logic. please advise

    Hi
    You want to upload data from a file on the basis of some criteria.
    In this case I think you need to upload all the data from the file to an internal table.
    Now the internal table contains all the data from the file.
    then filter the data from that table on the basis of PERNR, BUKRS or SUBTY.
    Like Below:
    delete ITAB where PERNR not in S_PERNR (S_PERNR is your select option).
    similarly for SUBTY or BUKRS.
    Or if you want all these 3 fields together then use OR condition.
    Like:
    delete ITAB where PERNR not in S_PERNR  OR
    delete ITAB where PERNR not in S_SUBTY OR
    delete ITAB where PERNR not in S_BUKRS.
    the above code will delete all the data from ITAB where the data doesn't match with the entries in S_PERNR, S_SUBTY and S_BUKRS.
    I hope this will work for you,
    If you didn't get it then post your code.
    Thanks
    LG

  • What is the difference between READ TABLE ITAB WITH KEY  and  TABLE KEY

    Hi Experts,
    what is the difference between
    READ TABLE <ITAB> WITH KEY <K1> = <C1>
                                                    <Kn> = <Cn> .
    and 
    READ TABLE <ITAB> WITH TABLE KEY <K1> = <C1>
                                                              <Kn> = <Cn> .
    Thanks
    Akash.

    Hi akashdeep,
    Nice question. I also tried to find out, but no much success. My opinion is that for practical purposes there is no difference.
    It may have difference in case of searching, especially sorted tables. (binary search or normal linear search).
    Case1: If our table is sorted table with defined key fields, and we give WITH TABLE KEY, then faster binary search is used.
    Case2 : If our table is sorted table with defined key fields, and we give WITH  KEY, (and no field contained in the keys), then normal linear search is used.
    regards,
    amit m.

  • Read Table into WITH KEY

    Hi GURUS,
    Need your help, I wrote  the below piece of code in my report program and I DINT GET ANY DATA IN "wa_it_ekpo"???
    and there is no syntactical error when I execute the program pls help me get data into   "wa_it_ekpo"..
    LOOP AT it_lips into wa_it_lips.
    MOVE-CORRESPONDING  wa_it_lips TO wa_asnmain_ref.
    SORT it_ekpo DESCENDING by ebeln ebelp .
    READ TABLE it_ekpo  INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel  ebelp = wa_it_lips-vgpos .
    MOVE-CORRESPONDING  wa_it_ekpo TO wa_asnmain_ref.
    *APPEND wa_it_ekpo to it_ekpo.
    *MOVE-CORRESPONDING
    *CONCATENATE wa_it_lips wa_it_ekpo INTO WA_ASNMAIN_ref.
    *CLEAR wa_it_lips.
    ENDLOOP.
    Thanks,
    Dep

    I call form populate_data passing value Suppose s_vbeln = u2018180000056u2019.
    FORM populate_data USING val_vbeln.
    s_vbeln = val_vbeln.
    SELECT single likpVBELN likpTRMTYP likpLIFNR likpERNAM likp~BLDAT from likp
      into (wa_ittab1-vbeln , wa_ittab1-trmtyp, wa_ittab1-lifnr, wa_ittab1-ernam, wa_ittab1-bldat ) where vbeln = s_vbeln.
    APPEND wa_ittab1 to it_tab1.
    SELECT single LIPSWERKS LIPSVGBEL FROM lips into (wa_ittab4-werks , wa_ittab4-vgbel) where lips~vbeln = s_vbeln.
    APPEND wa_ittab4 to it_tab4.
    SELECT SINGLE NAME1 FROM T001W INTO WA_ITTAB3-NAME1T WHERE T001W~WERKS = WA_ITTAB4-WERKS.
    SELECT SINGLE BEDAT FROM EKKO INTO WA_ITTAB3-BEDAT WHERE EKKO~EBELN = WA_ITTAB4-VGBEL.
    SELECT SINGLE NAME1 FROM LFA1 INTO WA_ITTAB3-NAME1 WHERE LFA1~LIFNR = WA_ITTAB1-LIFNR.
    SELECT SINGLE ADRNR FROM EKPO INTO WA_ITTAB3-ADRNR WHERE EKPO~EBELN = WA_ITTAB4-VGBEL.
    DATA it_ekpo_unf    TYPE ekpo OCCURS 0.
    DATA wa_it_ekpo_unf TYPE ekpo.
    DATA it_ekpo        TYPE ekpo OCCURS 0.
    DATA wa_it_ekpo     TYPE ekpo.
    DATA it_lips_unf    TYPE lips OCCURS 0.
    DATA wa_it_lips_unf TYPE lips.
    DATA it_lips        TYPE lips OCCURS 0.
    DATA wa_it_lips     TYPE lips.
    SELECT VGBEL VGPOS MATNR EAN11 ARKTX LGORT  FROM lips INTO CORRESPONDING FIELDS OF TABLE it_lips_unf WHERE lips~vgbel = WA_ITTAB4-VGBEL.
    LOOP AT it_lips_unf into wa_it_lips_unf.
    SHIFT wa_it_lips_unf-vgpos LEFT DELETING LEADING '0'.
    APPEND wa_it_lips_unf to it_lips.
    ENDLOOP.
    SELECT EBELN EBELP MENGE MEINS UMREZ  FROM EKPO INTO CORRESPONDING FIELDS OF TABLE it_ekpo_unf WHERE ekpo~ebeln = WA_ITTAB4-VGBEL.
    LOOP AT it_ekpo_unf into wa_it_ekpo_unf.
    SHIFT wa_it_ekpo_unf-ebelp LEFT DELETING LEADING '0'.
    APPEND wa_it_ekpo_unf to it_ekpo.
    ENDLOOP.
    LOOP AT it_lips into wa_it_lips.
    MOVE-CORRESPONDING  wa_it_lips TO wa_asnmain_ref.
    SORT it_ekpo DESCENDING by ebeln ebelp .
    READ TABLE it_ekpo  INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel  ebelp = wa_it_lips-vgpos .
    MOVE-CORRESPONDING  wa_it_ekpo TO wa_asnmain_ref.
    ENDLOOP.

  • Error in reading table TFK056A with interest key

    While posting interest I am getting the following error "Error in reading table TFK056A with interest key". I have configured my interest keys well. Please assist.

    Hi Panashesean,
    The reason for this error could be you have in the line items an interest key (ikey) which is missing in table TFK056A. Though you have a different interest key in the master record the system will consider the line item first.
    Interest Key Documentation states:
    "If more than one interest key is defined for a line item, these interest keys are normally prioritized as follows:
    1. Interest key in line item
    2. Interest key that is defined for transactions identified as additional receivables
       An interest can depend on the operative company code in the rule for
       additional receivables.
    3. Interest key in dunning level
    4. Interest key in contract account master record"
    You need to remove the interest key in the line item for the system to use the master record ikey OR or define (ikey) in table TFK056A.
    I hope this works.
    regards,
    David

  • Read table field with getString()

    public String[] getExportSParams(JCO.Function function, String structure,
                   String[]tablefield) {
              JCO.ParameterList export = function.getExportParameterList();
              JCO.Structure structures = export.getStructure(structure);
              String[] exportField = null;
              for (int i =0; i<tablefield.length;i++){
                   exportField<i> = structures.getString(tablefield<i>);
              return exportField;

    Bit confusing.
    Assuming that what ever you had given in your question is exactly the "copy paste" from your code...
    ?Both "tableField" and "exportField" are arrays right.  Why are you using those variables directly in places where you are supposed to use a "String".
    ?You are trying to put some string into exportField (which is an array) which is not yet initialized.
    Can you try this out -
    /* I guess, you are trying to extract the content of the structure into an array of strings and send it back */
    public String[] getExportSParams(JCO.Function function, String structure,
    String[]tablefield) {
    JCO.ParameterList export = function.getExportParameterList();
    JCO.Structure structures = export.getStructure(structure);
    String[] exportField = null;
    if(tablefield!=null && tablefield.length>0)
            exportField=new String[tablefield.length];
            for (int i =0; i<tablefield.length;i++){
            exportField<i> = structures.getString(tablefield<i>);
    return exportField;

  • Read table with key doubt

    Hi guys!
    Please, what can i do when i use the
    Read table xxxx WITH KEY tab_key = value ASSIGNING <fs>
    statement and there is more than one entry with the specified selection criteria? How can i return the values to an internal table?
    I need to get all the entries and i don't have the full table key.
    thanks!

    Hi Fabio,
    An efficient way to do this is to have your table sorted by a specific key.  Let's say I have a table with the feild material number.
    You can do this:
    data: lv_index like sy-tabix.
    sort itab by material_number.
    ready table itab with key material_number = yournumber
    binary search.
    if sy-subrc eq 0.
      move sy-tabix to lv_index. " this holds the index of your first material record
    now we loop at the table start at that index
      loop at itab index lv_index.
    perform your processing
    if we come accross a different material number - exit the loop.
      if itab-material_number ne yournumber.
        exit.
      endif.
    endloop.
    endif.
    This way you only processes the records you are looking for.
    thanks.
    JB

  • Question about reading generic tables with keys

    Hello
    I'm wondering if it's possible to read a generic table with key statement:
    FIELD-SYMBOLS:
        <lv_key>         TYPE zconf_key,
        <lt_data_bi>     TYPE INDEX TABLE,
        <lt_data_ai>     TYPE INDEX TABLE,
        <ls_data_bi>     TYPE any,
        <ls_data_ai>     TYPE any.
    * create data types
      CREATE DATA lt_data_bi TYPE (ls_node-data_table_type).
      ASSIGN lt_data_bi->* TO <lt_data_bi>.
      CREATE DATA lt_data_ai TYPE (ls_node-data_table_type).
      ASSIGN lt_data_ai->* TO <lt_data_ai>.
    * do check
      LOOP AT <lt_data_ai> ASSIGNING <ls_data_ai>.
        ASSIGN COMPONENT 'KEY' OF STRUCTURE <ls_data_ai> TO <lv_key>.
        READ TABLE <lt_data_bi> WITH KEY key = <lv_key>
        ASSIGNING <ls_data_bi> BINARY SEARCH.
    I receive the message: "The specified type has no structure and therefore no component called KEY" in the read statement above.
    Does anyone has an idea what I can do here?
    Regards,
      Mathias

    Mathias Glockner wrote:
    >     READ TABLE <lt_data_bi> WITH KEY key = <lv_key>
    In your structure ls_data_bi there is no field called KEY . please check whether you have field KEY in structure
    a®s

  • Invalid Cursor when I want to modify itab with READ TABLE ?

    Following code causes a core dump and says invalid cursor.
    What should I do if I want to change gt_itab .?
    REPORT  ZEV_READ_TABLE.
    data: begin of gt_itab occurs 0,
           key like vbrk-vbeln,
           name(10) type C,
           amount type i,
          end of gt_itab .
    start-of-SELECTION.
          gt_itab-key = 1.
          gt_itab-name = 'erkan'.
          gt_itab-amount = 10.
          append gt_itab.
          gt_itab-key = 2.
          gt_itab-name = 'dilem'.
          gt_itab-amount = 20.
          append gt_itab.
          LOOP AT gt_itab.
            write:/ gt_itab-key,
                    gt_itab-name,
                    gt_itab-amount.
          ENDLOOP.
          Read table gt_itab with key Key = 1.
           if sy-subrc = 0.
              gt_itab-amount = 100.
              modify gt_itab.
           endif.
    Kind Regards.
    Erkan VAROL

    Change the code this way & try
    modify gt_itab index sy-tabix.

  • How to assigne multiple value in key of read table

    Hi gurus,
    I want read table xxxx with key field1 = ' xxx' or field1 = 'yyy'.
    how to assign multiple value as key for the same field while reading internal table.
    Regards
    sagar

    Hi ,
    You can loop the internal table like
    loop at  <table xxxx> where field1 = ' xxx' or field1 = 'yyy'
    or you can write two read statements to read the internal table in wrk area.
    read table   <table xxxx> with key field1 = ' xxx'.
    if sy-subrc <>0
    read table   <table xxxx> with key field1 = 'yyy'.
    if sy-subrc = 0
    endif.
    else.
    do your data processing.
    endif.
    Thans.

  • Read statement with key syntax

    Hi all,
    In read statement, is there a possibility to use 'contains string (CS)' instead of '=' in with key?
    I have a requirement to fetch from an internal table, the record whose field1 value contains a particular string.
    Thanks,
    David.

    HI
    it won't accept CS in read table clause. syntax error will be displayed.
    for more clarity just execute the falloing code.
    DATA: BEGIN OF ITAB OCCURS 0,
            MATNR LIKE MARA-MATNR,
            ERSDA LIKE MARA-ERSDA,
            ERNAM LIKE MARA-ERNAM,
          END OF ITAB.
       SELECT MATNR
              ERSDA
              ERNAM
              FROM MARA
              INTO TABLE ITAB
              WHERE ERNAM = 'BOHNSTEDT'.
       IF SY-SUBRC EQ 0.
         SORT ITAB BY MATNR ASCENDING.
         READ TABLE ITAB WITH KEY MATNR CS '3'.
         IF SY-SUBRC EQ 0.
          WRITE: ITAB.
         ENDIF.
       ENDIF.

  • Read table with syntax error

    I would like to have this in my report in ABAP 7:
              READ TABLE ti_prococolos WITH KEY
                                   protocol = lc_protocol
                                   status    = 'abc'
                                   status    = 'ced'.
    But I receive the following error, when verifying the syntax:
    Key field "STATUS" has been used more than once. This is not allowed .     
    How can I solve this?
    Thanks!

    The READ statement is used to read a specific row of the internal table, in this case it appears that you are saying that you want a record if the STATUS is either abc or def.  You can't do that with the READ.  You would need to use the LOOP.
    Loop at ti_prococolos where protocol = lc_protocal
                                        and ( status = 'abc' or status = 'ced' ).
    * do what ever here, and EXIT after since you only want one row.
    EXIT.
    endloop.
    Regards,
    RIch Heilman

  • Read Statement with key

    Hi,
    How can I modify this Read statement as Read with same
    keys is not allowed.
    DATA: BEGIN OF itab OCCURS 0,
          matnr LIKE marc-matnr,
          werks LIKE marc-werks,
          steuc LIKE marc-steuc,
           END OF itab.
    wgc_werk = 'BR10',
    wgc_werk1 ='BR20'.
        READ TABLE itab WITH KEY matnr = it_mvke-matnr
                                         werks = wgc_werk
                                         werks = wgc_werks1
                                         BINARY SEARCH.

    Hi,
    You are trying to use read statement inorder to fetch a single record isn't it? if you are trying to search for a record having either
    WERKS = 'BR10' or WERKS = 'BR20' then you need to modify your code.
    i.e. as below
    DATA: BEGIN OF itab OCCURS 0,
    matnr LIKE marc-matnr,
    werks LIKE marc-werks,
    steuc LIKE marc-steuc,
    END OF itab.
    wgc_werk = 'BR10'.
    wgc_werk1 ='BR20'.
    READ TABLE itab WITH KEY matnr = it_mvke-matnr
    werks = wgc_werk.
    if sy-subrc ne 0.
       READ TABLE itab WITH KEY matnr = it_mvke-matnr
                                                   werks = wgc_werk1.
       if sy-subrc eq 0.
          "your post reading process here
       endif.
    endif.
    BINARY SEARCH.
    Reward points if this helps,
    Kiran

Maybe you are looking for

  • Word 2013 Crashes When Opening A Word 2007 Or Older Document

    I have this issue on every computer in our office. An outside source is sending in Word documents in docx format. Each time we try to open one of the files, Word with error out and close. My wifes company uses Office 2010 and she can open the documen

  • OSX 10.5.8 upgrade to use iCloud

    I have OSX 10.5.8. How can I upgrade to get Mountain Lion so that I can use iCloud?

  • PIR consumption at different plant

    Hello dear gurus, Here's a tough one; I have a situation (quite common) where there's a supply chain with one manufacturing plant and a number (like 4) of distribution plants. (CPG) Normaly in SAP in such a situation you need to maintain PIRs for eac

  • BPS Attribute as Variable filled with User-Exit

    Hello, how is it possible to set a variable from the type "attribute" in BPS with an User-Exit? Example: Characteristic = Material, Attribute = Material class How can I set valid entries for Material class in a User-Exit? Thanks for help in advance E

  • BBM 5.0 question

    So I have the new bbm but half of my contacts say that they can't see my display name or picture.  Does anyone know how I can fix this?  Thanks!