Replace single values in a internal table

Hi all,
I have two internal tables.
In the first table (itab) I have some values which I have to "decode" using the second table (itabtext).
This means that I have to pick every line and replace in the itab a value like "01" with "text for 01" from itabtext.
In the itabtext "01" is the key for  "text for 01".
What is the best way to handle this?
Thanks a lot,
Fabian

Thanks for your answer but I still have the problem. The tables (two texttables instead of one what I wrote in the first message) are the following:
DATA: BEGIN OF lt_proclocktexts OCCURS 0.
DATA: lockprocid(2) TYPE c,
      text(40) TYPE c.
DATA: END OF lt_proclocktexts.
DATA: BEGIN OF lt_lockreastexts OCCURS 0.
DATA: lockprocid(2) TYPE c,
      lockreason(2) TYPE c,
      text(40) TYPE c.
DATA: END OF lt_lockreastexts.
The table where I want to replace fields are the following:
DATA: BEGIN OF lt_proclocks OCCURS 0.
DATA: mandt type MANDT,
      lockreason(40) TYPE c,
      lockprocid(40) TYPE c,
      GPART type GPART_KK,
      LOOBJ type LOOBJ_KK.
DATA: END OF lt_proclocks.
When lt_proclocks-lockprocid similar to a lt_proclocktexts-lockprocid the lt_proclocks-lockprocid should be replaced by the lt_proclocktexts-text.
When lt_proclocks-lockreason AND lt_proclocks-lockprocid is similar to a combination in the lt_lockreastexts the ID in field lt_proclocks-lockreason should be also replaced (additionally to the lt_proclocks-lockprocid field).
Thanks,
Fabian

Similar Messages

  • To populate values into single field in an internal table

    Hi Friends,
    How we need to populate values into single field in an internal table.
    E.g itab consits of single field ( name)
           i need to assign values to this field name .like
          peter,
          john,
          abrahm,
          daneyal
    Pls tell me i how i need to code for this
    Thanks ,
    Parnith

    Hi,
    Please look at the below code :
    DATA : BEGIN OF itab OCCURS 0 ,
             name(20) TYPE c,
           END OF itab.
    START-OF-SELECTION.
      itab-name = 'Peter'.
      APPEND itab.
      CLEAR itab.
      itab-name = 'John'.
      APPEND itab.
      CLEAR itab.
      itab-name = 'Abrahm'.
      APPEND itab.
      CLEAR itab.
      itab-name = 'Daneyal'.
      APPEND itab.
      CLEAR itab.
      LOOP AT itab.
        WRITE : / itab.
      ENDLOOP.
    Thanks,
    Sriram Ponna.

  • Transferring checkbox values on ALV to value in the internal table?

    Hi,
    I'm using an ALV grid (CL_GUI_ALV_GRID) to display an internal table.  I want users to be able to select one or many rows and those checked lines to be marked as X in my internal table.  I have a field, check(1), in my internal table displayed on the ALV, but when I tick one line on the ALV and debug, I don't see an X in the check field on that line in my internal table.
    I've successfully written code to select and deselect all lines and those values copy back to my internal table so why don't the single lines?
    CASE sy-ucomm.
        WHEN 'SELECT_ALL'.
    *   select all lines
          LOOP AT tbl_data INTO wa_data.
            MOVE 'X' TO wa_data-check.
            MODIFY tbl_data FROM wa_data.
          ENDLOOP.
        WHEN 'DESELECT'.
    *   deselect all lines
          LOOP AT tbl_data INTO wa_data.
            CLEAR wa_data-check.
            MODIFY tbl_data FROM wa_data.
          ENDLOOP.
    ENDCASE.
    Do I have to add some code in the PAI to transfer the values?
    Any suggestions welcome,
    Gill

    Yes, I have.
    The checkbox is appearing on the screen and is populated/cleared when I click the select/deselect buttons (this transfers the values in my internal table to the screen).  But when I just tick one line and then debug that line isn't showing as having X in the check field in my internal table.
    Somehow I need to transfer the tick values on screen to my internal table.

  • Distinct values from dynamic internal tabls

    Hi All,
    I have a dynamic internal tables like <dy_table> , i want to get distinct  values from this internal tables,
    how to do that, structure of dynamic internal tables is dynamic acc. to user conditions.
    regards,
    Anuj

    Hi Anuj
    Just try this,
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = tb_fields_for_it
    IMPORTING
    ep_table = gp_dyn_table.
    ASSIGN gp_dyn_table->* TO <gt_table>.
    ASSIGN LOCAL COPY OF INITIAL LINE OF <gt_table> TO <fs_table>.
    LOOP AT tb_output.
    *To assign value for serial number.
    ASSIGN COMPONENT 1 OF STRUCTURE <fs_table> TO <ls_field>.
    <ls_field> = tb_output-sno.
    UNASSIGN <ls_field>.
    *To assign value for Sales Organization.
    ASSIGN COMPONENT 2 OF STRUCTURE <fs_table> TO <ls_field>.
    <ls_field> = tb_output-vkorg.
    UNASSIGN <ls_field>.
    *To assign Rate for its respective Condition type.
    LOOP AT tb_konp WHERE knumh = tb_output-knumh.
    READ TABLE tb_fieldcat1 WITH KEY fieldname = tb_output-kschl.
    IF sy-subrc EQ 0.
    lv_count = tb_fieldcat1-col_pos.
    ASSIGN COMPONENT lv_count OF STRUCTURE <fs_table> TO <ls_field>.
    IF tb_konp-konwa EQ '%'.
    tb_konp-kbetr = tb_konp-kbetr / co_10.
    <ls_field> = tb_konp-kbetr.
    ELSE.
    <ls_field> = tb_konp-kbetr.
    ENDIF.
    ENDIF.
    ENDLOOP.
    lv_count = lv_count + 1.
    APPEND <fs_table> TO <gt_table>.
    CLEAR <fs_table>.
    ENDLOOP.
    Hope this proves helpful to you.

  • How to download values in an internal table into an excel file

    is there any fn module to download the values in an internal table into an excel file..

    hi
    the function module "GUI_DOWNLOAD"  downloads the data from
    an internal table into a file (can be xl, dat ,doc etc) .
    Plz follow the usage below ;
    Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.
    Data : lv_filename TYPE STRING.
    lv_filename = pa_pfile.
    CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
       BIN_FILESIZE                  =
         FILENAME                      = lv_filename
         FILETYPE                      = 'ASC'
       APPEND                        = ' '
        WRITE_FIELD_SEPARATOR         = 'X'
       HEADER                        = '00'
       TRUNC_TRAILING_BLANKS         = ' '
       WRITE_LF                      = 'X'
       COL_SELECT                    = ' '
       COL_SELECT_MASK               = ' '
       DAT_MODE                      = ' '
       CONFIRM_OVERWRITE             = ' '
       NO_AUTH_CHECK                 = ' '
    IMPORTING
       FILELENGTH                    =
       TABLES
         DATA_TAB                      = tb_download         " table data to b downlaoded
      EXCEPTIONS
        FILE_WRITE_ERROR              = 1
        NO_BATCH                      = 2
        GUI_REFUSE_FILETRANSFER       = 3
        INVALID_TYPE                  = 4
        NO_AUTHORITY                  = 5
        UNKNOWN_ERROR                 = 6
        HEADER_NOT_ALLOWED            = 7
        SEPARATOR_NOT_ALLOWED         = 8
        FILESIZE_NOT_ALLOWED          = 9
        HEADER_TOO_LONG               = 10
        DP_ERROR_CREATE               = 11
        DP_ERROR_SEND                 = 12
        DP_ERROR_WRITE                = 13
        UNKNOWN_DP_ERROR              = 14
        ACCESS_DENIED                 = 15
        DP_OUT_OF_MEMORY              = 16
        DISK_FULL                     = 17
        DP_TIMEOUT                    = 18
        FILE_NOT_FOUND                = 19
        DATAPROVIDER_EXCEPTION        = 20
        CONTROL_FLUSH_ERROR           = 21
        OTHERS                        = 22
    IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    Pankaj

  • Passing '**********' to screen field value instead of internal table value

    Hi All,
    I have written BDC, in which when i pass value for second screen "Description type field"  it's passing '*************************' instead of internal table value.
    It's picking correct value for first internal table value. Could anyone please give an idea why it's happening?
    Please find the code:
    LOOP AT it_record.
    header data for BDC
       AT NEW CLASS.
        IF sy-tabix <> 1.
            perform bdc_dynpro      using 'SAPLCLMO' '7777'.
            perform bdc_field       using 'BDC_OKCODE'
                                    '=SAVE'.
            CALL TRANSACTION 'CLWM' USING bdcdata
                          MODE p_mode
                          UPDATE 'S'
                          MESSAGES INTO messtab.
            clear : bdcdata[],bdcdata.
        ENDIF.
        perform bdc_dynpro      using 'SAPLCLMO' '0200'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-CLASS'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'RMCLM-CLASS'
                                      it_record-class.
        perform bdc_dynpro      using 'SAPLCLMO' '7777'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-KLBEZ'.
        perform bdc_field       using 'RMCLM-KLBEZ'
                                      it_record-klbez.
        perform bdc_field       using 'RMCLM-STATU'
                                      '1'.
        perform bdc_dynpro      using 'SAPLCLMO' '7777'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=MERK'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-KLBEZ'.
        perform bdc_field       using 'RMCLM-KLBEZ'
                                      it_record-klbez.
        perform bdc_field       using 'RMCLM-STATU'
                                      '1'.
        MOVE 1 TO IDX.
        ENDAT.
    line item data for BDC
            perform bdc_dynpro      using 'SAPLCLMO' '7777'.
            perform bdc_field       using 'BDC_OKCODE'
                                       '/00'.
            perform bdc_field       using 'BDC_CURSOR'
                                        'RMCLM-RELEV(02)'.
            CONCATENATE 'RMCLM-MERKMA(' IDX ')' INTO FNAM.
            perform bdc_field       using FNAM
                                        it_record-merkma.
            CONCATENATE 'RMCLM-RELEV(' IDX ')' INTO FNAM.
            perform bdc_field       using   FNAM
                                       it_record-relev.
            IDX = IDX + 1.
      ENDLOOP.
    Thanks,
    Ujjwal

    Hi Ujjwal
    The reason behind this is that you are using AT NEW.... ENDAT block in your coding.
    When you use AT NEW field statements, the fields in the work area after the field get converted into ********.
    Check values in your work area I_RECORD in debugging inside AT NEW statement and you will understand what I am saying.
    In your case all the fields from header line of I_RECORDS which come after field CLASS are getting converted into *******,
    hence the error.
    Try using a temporary work area, say w_record. Pass value of I_record to w_record before AT NEW statement.
    And use w_record-fields instead of I_record-fields. And your program should work.

  • Initializing values in an internal table

    hi
    how to initialize values in a internal table
    according to my requirement i need to initialize (both character and currency) values present in the internal table based on certain conditions
    vamsi

    hi
    As i understood you want to clear only selected fileds not the complet record..
    create a Field symobl the loop at the table.. inside the loop check the condtion the just clear the filed.
    example: you have itab type mara.
    then
    FIELD-SYMOBOLS <FS_WA_ITAB> TYPE MARA.
    LOOP AT ITAB ASSIGNING <FS_WA_ITAB>.
    IF X = XXX (YOUR CONDITION)
    CLEAR: <FS_WA_ITAB>-FIELD2,
                 <FS_WA_ITAB>-FIELD3. (If u want to clear only filed2 and field3)
    clear <FS_WA_ITAB>. (if you want to cleatr the complete record)
    ENDIF.
    ENDLOOP.
    Why iam suggestin the filed-symobol is.. it is direcltly work on internal table body so u no need to update the table agian
    Please Close this thread.. when u r problem is solved
    Reward if Helpful
    Regards
    Naresh Reddy K

  • How to check a field value within an Internal table

    Hi Friends,
    My requirement is:
    I have a line item of PO records, in that each line item of Plant field should not diffe with other line items. If it differs or say the records have different plant values line items, then I have to throw an error message.
    Below example for better understanding.
    lineitem Plant
    010       ABC
    020       ABC
    030       XYZ
    040       LKG
    So, my report will throw an error like "All line items must be identical'.
    How to do proceed it.Please advise.
    Thanks & Regards
    Sankar.

    Hi Sankar
    first you need to fetch all the values in one internal table from your PO.
    After that create an internal table with only plant field and move all the plan values in this table.
    let assume ITAB is a table with all the values. and ITAB1 with plant only.
    wa_itab is the work area for ITAB and wa_itab1 is WA for ITAB1.
    ITAB has all the values and ITAB1 has all the values only for plant.
    delete adjacent duplicate from itab1 compairing plant.
    loop at itab1 into wa_itab1. " this will fetch all the plant values in workarea.
    read table itab into wa_itab where wa_itab-plant = wa_itab1-plant.  " this will fetch only the values matching to the table itab1
    if su-subrc <> 0.       
    message 'plants are not similar' TYPE 'E'.
    elseif sy-subrc = 0.
    write your code*.
    endif.
    endloop.
    hope this will help you.
    Thanks
    Lalit Gupta

  • Check the range of values of an internal table with the statement IN

    Hi,
    I'd like to know how to check if the current contents of a field are in the set described by an internal table.
    I know I have to use the statement <b>IN</b>, but I don't know exactly how to define the internal table. In my case, I have a single field (<i>tipo_doc</i>) in my internal table which stores 4 different values: C, I, K, L.
    I want to use the statement <b>IN</b> as shown next:
    SELECT * FROM VBFA APPENDING CORRESPONDING FIELDS OF TABLE it_flujo_docs WHERE ( VBELN = it_total_fact-vbeln )
                          AND ( VBTYP_V <b>IN</b> itab).
    Then I'd like to know how the internal table <i>itab</i> should be defined. It should be something like this I think, but it doesn't work:
    DATA: BEGIN OF itab OCCURS 0,
            tipo_doc LIKE zpedidos-tipo_doc,
            tipo_doc-sign = 'I',
            tipo_doc-option = 'EQ',
            tipo_doc-low = C,
            tipo_doc-high = L,
        END OF it_tipo_doc_ped.
    I'd appreciate if someone could tell me the proper way to define it.
    Thanks in advance,
    Gerard

    Hi,
    Please follow this.
    RANGES R_VBTYP FOR VBFA-VBTYP_V.
    R_VBTYP-SIGN = 'I'.
    R_VBTYP-OPTION = 'EQ'.
    R_VBTYP-LOW = 'C'.
    CLEAR R_VBTYP-HIGH.
    APPEND R_VBTYP.
    Do the same for value 'I', 'K' and 'L'.
    Now in the SELECT statement replace the following
    VBTYP_V IN itab
    with
    VBTYP_V IN R_VBTYP.
    Thanks
    Vinod

  • Removing a character in a value from the internal table

    Hi guys!
    <b>example: i_table-field = "10,20"</b>
    I want to remove " " because creating csv creates this automatically because it has a value that includes comma. I am also using comma separator for my program so if I would remove the " " before splitting the values there will also be an effect on my program... can anyone can help me with this?
    thanks in advance! good day guys!

    Hi Michael,
    In the scenario of yours, you are left with two options.
    1. Format the XLS file properly before converting it to CSV. here If you convert the quantity, currency columns to the text columns then you will not get " into CSV file.
    2. Define the quantity, currency fields in your internal table as of type char. For eg. Curr of length 18, should be defined as fields of CHAR20 (two characters for " "), then once you separate all the fields based on comma, just repalce all the occurances of " using REPLACE.
    But what I suggest is better use option 1. The decision is totally depend on the number of time you want to use the program.
    Reward points if useful.
    Regards,
    Atish

  • Selecting values into same internal table from 2 differrnt select statement

    Hi Friends,
    code :
    types :
       begin of ty_bsad,
         augbl type bsad-augbl,
      end of ty_bsad.
    begin of ty_bsad1,
         augbl type bsad-augbl,
         belnr type bsad-belnr,
      end of ty_bsad1.
      select augbl
               from bsad
              into table it_bsad
              where belnr = l_vbeln and
                       bukrs = l_bukrs and
                      kunnr  = l_kunrg.
           if sy-subrc = 0 .
               select belnr
                         into table lt_bsad1
                         from bsad
                        for all entries in lt_bsad
                       where augbl = lt_bsad-augbl and
                                kunnr = l_kunnr  and
                                burks  = l_bukrs and
                                blart   = 'xy'.
    now my requiremnt is i need to get both the augbl and belnr in single internal table but not in differnrnt internal table.
    how can i get it.
    Regards,
    Priyanka.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:53 AM

    HI.
    No Need to create two internal table because your feyching values from same table BSAD with diffrent where condition.try this code.it s work.
    select augbl
    from bsad
    into table it_bsad
    where belnr = l_vbeln and
    bukrs = l_bukrs and
    kunnr = l_kunrg and
    blart = 'xy'.
    else Refer this code.
    LOOP AT it_bill_data INTO wa_bill_data.
        MOVE-CORRESPONDING wa_bill_data TO wa_final_data.
        READ TABLE it_material_data INTO wa_material_data
                                    WITH KEY matnr = wa_bill_data-matnr.
        IF sy-subrc = 0.
          wa_final_data-meins_mara = wa_material_data-meins.
        ENDIF.
        APPEND wa_final_data TO it_final_data.
    ENDLOOP.
    Regards.
    Jay
    Edited by: Jay on Jan 8, 2009 2:53 PM
    Edited by: Jay on Jan 8, 2009 2:57 PM
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:56 AM

  • Display data to edit based on fields and its value defined in internal tabl

    I need to display data in a internal table for editing in a screen.
    you have a internal table with field name , data types and its value. I need to display data in a screen ( sceen painter not in a report) row by row in vrtical format.
    The internal table's structure not fix. you can have any number of fields in the internal table.
    Can you please send me code if it is available with you or send me any senario in SAP if any ...so that i can debug to extract the code..
    have to display data vertically as below in editable format,
    for example,
    Airline
    Flight Number
    Flight date
    Flight price
    Airline Currency
    Plane Type
    Maximum capacity
    Occupied econ.
    Total
    No of fields will change.
    also F4 help needs to be attached with each field.
    I think it can be done through step loop. can anybody give sample code or tell me where to find in SAP or somewhere else?
    it will be great help to me..
    Sanjeev

    Hi
    just check out this program DEMO_DYNPRO_STEP_LOOP.

  • BRFplus: Problem updating values in an internal table in a loop expression

    Hi
    I'm looking into the loop expression type of BRFplus and I have come across a problem updating an internal table, I'm trying to create and populate the table using a loop, here is the functionality I'm trying to achieve:
    In a rule set create an internal MONTH_TBL table containing 12 rows of two columns: MONTH_NUM containing values 1 through 12 and MONTH_VAL containing an amount (initially 0,00 EUR in all 12 rows).
    After initializing the table traverse through SFLIGHT table and for each row add PRICE from the table to MONTH_VAL in the row of MONTH_TBL corresponding to the month of FLDATE field in SFLIGHT.
    The initialization of MONTH_TBL works as intended, as does the traversal of and retrieval of values from SFLIGHT. The problem however is the update of the internal table MONTH_TBL (defined as result data object for the function). I don't get an error, but the tables does not get updated, and I cannot seem to find out what the problem is. I would have attached an XML extract of the function + ruleset for information, but it dosen't seem like that is possible, I could e-mail it on request (for SAP employees with access to system QU5 the function is LOOP_TEST in application Z_KLAUS_TEST).
    I hope that this is sufficient information to understand the issue that I'm dealing with.
    best regards
    Klaus Stenbæk, KMD

    Hi Klaus,
    The Loop expression is part of NW 7.02 which is not yet released. When you experience the problem as part of a test you should have a contact at SAP for dealing with problems/errors. Usually SAP-internal messages are used for this purpose. Please clarify with your SAP contact how the model is.
    BR,
    Carsten

  • How to search for a field and its value in an internal table

    Hi,
    I want to search for a field(which i dont know whether it exists or not) in an internal table and on finding that field, I have to update the value of that field. How do I do it? I think its similar to how SEARCH works but i wanted to know the internal table eqivalent of it.

    Hi Sujay,
    this code will help ful to u, just gi through it,
    TABLES : KNA1,VBAK,VBAP.
    ***********INTERNAL TABLE DECLARATIONS****************
    DATA : IT_KNA1 TYPE TABLE OF KNA1,
           WA_KNA1 TYPE KNA1.
    DATA : IT_VBAK TYPE TABLE OF VBAK,
           WA_VBAK TYPE VBAK.
    DATA : IT_VBAP TYPE TABLE OF VBAP,
           WA_VBAP TYPE VBAP.
    START-OF-SELECTION.
      SELECT * FROM KNA1
      INTO TABLE IT_KNA1
      WHERE KUNNR = P_CUST.
      IF NOT IT_KNA1 IS INITIAL.
        SELECT * FROM VBAK
        INTO TABLE IT_VBAK
        FOR ALL ENTRIES IN IT_KNA1
        WHERE KUNNR = IT_KNA1-KUNNR.
        IF NOT IT_VBAK IS INITIAL.
          SELECT * FROM VBAP
          INTO TABLE IT_VBAP
          FOR ALL ENTRIES IN IT_VBAK
          WHERE VBELN = IT_VBAK-VBELN.
        ELSE.
          WRITE : / 'Customer',P_CUST,'does not exist ......'.
        ENDIF.
      ELSE.
        WRITE: / 'sales order does not exist for',P_CUST.
      ENDIF.
    Rewards points plz if useful
    Ganesh.

  • How to Fill values in BAPI internal table ?

    I am creating sales order from ABAP Dynpro , all the values are getting passed to bapi except those in internal table, it gives lead selection error and whn i change the cardinality of the Node to 1.1 to shows the page but whenever i create the SO it gives WRONG_DATA error . I debugged it and found the data in the internal table for material is not getting passed.

    Hi Jasjit,
    Could you be a bit more clear about the issue you are facing.
    Try using the cardinality 0:n for node that holds the data that you are passing as internal table to bapi.
    Regards,
    Sravan Varagani

Maybe you are looking for