Shifting field contents in an internal table

is there any way to shift field contents from one field to another in an internal table
for eg.
itab
fieldA(1)-fieldB(10)
1--20000--
2--20001---
final itab
fieldA(1)-fieldB(10)
1--120000---
2--220001---
i need to use LOOP to do this. is there any other way to achieve this WITH OUT A LOOP?
Thanks,
ravi.

I wouldn't really call this a shift, because you are keeping the value of fielda.  If fielda were to be blank, then you could "shift" all at one time without a loop.
For example.
Data: begin of itab occurs 0,
      fielda(1) type c,
      fieldb(10) type c,
      endo of itab.
Data: begin of itabf occurs 0,
      fieldb(10) type c,
      endo of itabf.
itabf[] = itab[].
I think that the final itab would look like this.
<b>fieldb</b>
120000
220001
But, of course, this is not your requirement, so I think that you need to do a loop to "copy" the first value in to fieldb.
Data: begin of itab occurs 0,
      fielda(1) type c,
      fieldb(10) type c,
      endo of itab.
Data: begin of itabf occurs 0,
      fielda(1) type c,
      fieldb(10) type c,
      endo of itabf.
Loop at itab.
itabf-fielda = itab-fielda.
concatenate itab-fielda itab-fieldb
         into itabf-fieldb.
condense itabf-fieldb no-gaps.
append itabf.
endloop.
Regards,
Rich Heilman

Similar Messages

  • The contents in a internal table

    Hi Experts,
    I have a doubt in filling the contents of an internal table with the database table fields reference.
    For eg: There is an internal table like this:
    data: begin of t_conditions occurs 0,
                 kschl like rv13a-kschl,
                 vkorg like komg-vkorg,
                 kunnr like komg-kunnr,
                 matnr like komg-matnr,
                 kbetr(15) type c,
                 datab(10) type c,
                 datbi(10) type c,
          end of t_conditions.
    in the above example, the "matnr" he has taken with the reference field "komg-matnr"..
    Please look at the following internal table:
    data: begin of t_material occurs 0,
                    matnr(18) type c,
                    matkl(9)  type c,
                    bismt(18) type c,
          end of t_material.
    In the above 2 examples the declaration of "matnr" field is diffrent from one with the other.
    in 1st eg., he has taken as: <b>matnr like komg-matnr</b>
    where as in the 2nd eg: <b>matnr(18) type c,</b>
    my question is: how can i know where to declare as in the 1st eg., and where to use like in the 2nd eg.,
    Please clarify.
    I greatly appreciate your help.
    Thanks,

    Hi sey
    If you see in the domain level both the DOMIAN's will be the same. So it doesn't matter. All the matnr will have a character type of size 18.
    for the programmer reference they will using the table name in which they want to select the data.
    i.e for the first ex. he will be selecting data from the KOMG table and in the second from the MARA table.
    but both the Matnr type are same.
    <b>there is a small change since the second ex doesn't use any table it is simply of type c. the difference is when you reference to any Data DICTIONARY object then it can contain certain conversion exits, etc. so it will apply for your reference data typr</b>
    regards
    kishore
    Message was edited by: Harikishore Sreenivasulu

  • How to get the field name of an internal table during runtime?

    How to get the field name of an internal table during runtime?

    Hi  Sudhir,
    Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
    Example Code:
        <b>  DATA: v_field(60).                        " Insert this code.
         GET CURSOR FIELD v_field.        " Insert this code.</b>
         <b>CHECK v_field = 'ITAB-KUNNR'.    " Insert this code. (or)
    Write: v_field.</b>
    Regards,
    Ramganesan K.

  • How to add one more field to an exist internal table

    hi abapers
    i am a very new abap programmer and just started learning it.
    i want to know How to add one more field to an exist internal table.
    lemme me put my question in a very simple way.
    i have a internal table having fields f1,f2,f3 and which also that internal also contains some data.
    now i want to add two more fields (mm & nn) to that internal table now.
    how can i do that.
    and i wanna know the websites names where i can find some brain teasing questions in abap programming.
    eagerly waiting for ur reply
    regards,
    Maqsood A Khan

    Hi, MAQSOOD.
    You can insert more fields in your internal table like this.
    refer this code snippet.
    DATA : BEGIN OF tbl_itab OCCURS 0.
            INCLUDE STRUCTURE zsdtc009.
    DATA :  vkorg   LIKE vbak-vkorg,  "inserted one
            vtweg   LIKE vbak-vtweg,  "inserted one
            vkbur   LIKE vbak-vkbur,  "inserted one
            vkgrp   LIKE vbak-vkgrp,  "inserted one
           END OF tbl_itab.
    you can also read the book "Teach yourself abap in 21 days"
    at http://cma.zdnet.com/book/abap/
    but that book is just about basic concept of abap and report program.
    it doesn't give a lecture for on-line program.
    you can get pdf version books(about abap, sap...things) from sap.
    http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm
    I wish I could help you.
    Regards
    Kyung Woo.

  • How to pass the contents of an internal table to the IDoc FIDCC2?

    Hi,
    I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
    I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
    Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
    Regards,
    Balaji. R

    Hi balaji,
    use function IDOC_INBOUND_FROM_FILE. This will do half the process.
    Documentation is missing, but program RSEINB00 explains something,
    also some links
    [http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
    [RSEINB00 does not work in background]
    [RSEINB00 flat file to idoc uploading in XI]
    [Loading flat idoc via report RSEINB00 into integration server fails]
    Hope it helps.
    Regards,
    Clemens

  • Function module for comparing contents of two internal tables

    Hi All,
    Is there any function module to compare contents of two internal tables of same structure?
    If yes please let me know.
    Thanks in advance.
    Amol

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • Are field symbols and Dynamic internal tables consistant?

    Hi,
    Are field symbols and Dynamic internal tables
    always consistent?
    In my program I m creating a dynamic itab and assignig values to it using <FS>, sometimes the program fails to execute assign <Fs> statement...
    this happens once in 3 to 4 runs
    any solution...
    I have proper clear and refresh statements in program.
    Thanks,
    Hardik

    Anurag,
    Thanks for a quick reply. Here I am sending a small piece of my code.
    MOVE-CORRESPONDING OUTTAB TO DYNTAB.
          CLEAR IT_UDATE.
          CLEAR : T_KBETR .
          READ TABLE IT_UDATE WITH KEY UDATE = OUTTAB-UDATE.
          CONCATENATE 'DYNTAB-KBETR' IT_UDATE-CO_POS INTO T_KBETR.
          ASSIGN (T_KBETR) TO <FS> .
          SUBRC5 = SY-SUBRC .
          IF SUBRC5 = 0 .
              <FS> =  OUTTAB-KBETR .
          ENDIF .
    read statement will always return CO_POS .
    while debuging this code a few times
    <b>ASSIGN (T_KBETR) TO <FS> .</b>
    returns sy-subrc = 4
    and that was leading the program to short dump earlier.
    now, as I have a check DYNTAB-KBETR holds no value on display.
    this happens very few times. (most of the times report is displaying desired output)
    Thanks,
    Hardik

  • Field description of an internal table

    Hi,
    I am trying to read the field description of an internal table, which consists of fields from different DD tables. I am able to read the descriptions of a DD table by using FM 'DDIF_FIELDINFO_GET'.
    Can you please suggest me how can read the text descriptions of an internal table fields in a Language other than English.
    Thanks
    Lokman

    Here is my code. I am trying to use imternal table instead of DD table. If I use internal table I get short dump. The language is OK withh DD table.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
           EXPORTING
              TABNAME   = 'ZFISB_TRANSFERS'
               TABNAME    = trsf_sel_tab
               LANGU     =  SY-LANGU
            TABLES
                DFIES_TAB = trsf_field_tab.
    *delete trsf_field_tab where fieldname <> 'NR' OR FIELDNAME <> 'TDATE'
    *OR
    FIELDNAME <> 'FYEAR'.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield         = 'NR'
                value_org        = 'S'
                callback_program = 'ZFI_SCHOOL_BANKING_APP'
                callback_form    = 'TRANSFERS_F4CALLBACK'
           TABLES
                field_tab        = trsf_field_tab
                value_tab        = trsf_sel_tab
                return_tab       = return_tab
           EXCEPTIONS
                parameter_error  = 1
                no_values_found  = 2
                OTHERS           = 3.

  • Reg: field names of an Internal table

    Hi all,
    I'd like to display all the field names of the internal table or a structure.
    I want it very urgent.
    Use ful answers will be awarded greatly.
    Thanks in advance.
    Jagan Mohan.

    Hi Jagan,
      Use the below code.
    TYPE-POOLS: SYDES.
    DATA: TD TYPE SYDES_DESC.
    DATA: BEGIN OF WA OCCURS 0,
           CONTINUE     TYPE C,
           NAME(15)     TYPE C,
          END OF WA.
    TYPES:BEGIN OF STR1,
            NUM(3) TYPE N,
            NAME(20) TYPE C,
          END OF STR1.
    *DATA: ITAB LIKE T247 OCCURS 0 WITH HEADER LINE.
    *DATA: ITAB TYPE STR1 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF ITAB OCCURS 0,
           NUM(3) TYPE N,
           NAME(20) TYPE C,
          END OF ITAB.
    DESCRIBE FIELD ITAB INTO TD.
    WA[] = TD-NAMES[].
    LOOP AT WA.
      IF WA-NAME = SY-REPID.
        DELETE WA.
        CONTINUE.
      ENDIF.
      SEARCH WA-NAME FOR '-'.
      IF SY-SUBRC = 0.
        DELETE WA.
        CONTINUE.
      ENDIF.
      SEARCH WA-NAME FOR '='.
      IF SY-SUBRC = 0.
        DELETE WA.
        CONTINUE.
      ENDIF.
    ENDLOOP.
    LOOP AT WA.
      WRITE: / WA-NAME.
    ENDLOOP.

  • Move Field symbol data to Internal table

    Dear All,
                     Please suggest how to move field symbol data to internal table. The requirement is I have dynamic data in Field symbol which to move to table parameter of a function module.
    Thanks in Advance
    Rams.

    Dear All,
                    In need to pass tabular data  i.e. multiple entries from field symbol to the table parameter of the custom function module.
    Field symbol is declared as below:
    FIELD-SYMBOLS: <FS_EXCEL_TAB> TYPE STANDARD TABLE,
                                 <FS_TABLE_HEADER> .
    DATA WA_PD LIKE PRICE_DOWNLOAD.
    APPEND <FS_TABLE_HEADER> TO <FS_EXCEL_TAB>.
    CLEAR <FS_TABLE_HEADER>.
      WA_PD-VKORG = <FS_EXCEL_TAB>-VKORG.u201D Problem while using this statement
      APPEND WA_PD TO PRICE_DOWNLOAD.
       CLEAR WA_PD.
    Field symbol <FS_EXCEL_TAB>  is populated like this.
    VKORG | KUNNR_SH | KUNNR_SP |
    0015      | 102105       | 102105       |
    Now I need to move this data to table in tables parameter of custom fucntion module.
    Thanks in advance,
    Rams

  • Getting field names of an internal table

    Hi all,
    Does anyone know if exists a statement, function module or method that gets the field names of an internal table ?
    Thanks in advance,
    David

    Hi,
    See this
    REPORT typedescr_test.
    TYPES:
    BEGIN OF my_struct,
    comp_a type i,
    comp_b type f,
    END OF my_struct.
    DATA:
    my_data TYPE my_struct,
    descr_ref TYPE ref to cl_abap_structdescr.
    FIELD-SYMBOLS:
    <comp_wa> TYPE abap_compdescr.
    START-OF-SELECTION.
    descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).
    WRITE: / 'Typename :', descr_ref->absolute_name.
    WRITE: / 'Kind :', descr_ref->type_kind.
    WRITE: / 'Length :', descr_ref->length.
    WRITE: / 'Decimals :', descr_ref->decimals.
    WRITE: / 'Struct Kind :', descr_ref->struct_kind.
    WRITE: / 'Components'.
    WRITE: / 'Name Kind Length Decimals'.
    LOOP AT descr_ref->components ASSIGNING <comp_wa>.
    WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
    <comp_wa>-length, <comp_wa>-decimals.
    ENDLOOP.

  • ALV display using dynamic field catalog and dynamic internal table

    hi ,
    please guide me for ALV display using dynamic field catalog and dynamic internal table.
    Thank you.

    Hi Rahul,
    maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
    Regards Rudi

  • Data from field symbol into an internal table or workarea

    Hi Experts,
    I have field symbol in which i get the data. I want to get this data into an internal table of type any or into an work area. How is this possible.
    My declaration for field symbol is as follow:
    FIELD-SYMBOLS: <l_t_data> TYPE any.
    DATA l_r_data TYPE REF TO data.
        CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
        ASSIGN l_r_data->* TO <l_t_data>.
    I get the data in this field symbol <l_t_data>. by passing into a funtion module. and I get the data into it. Now i have to assign the values of this field symbol to any internal table or to a work are how do i do it. Please help.
    Regards,
    Prashant.

    Not exactly sure what you need here, but.....
    FIELD-SYMBOLS: <l_t_data> TYPE TABLE.   "<<-- Change this
    FIELD-SYMBOLS: <l_s_data> TYPE ANY.      "<<---Add This
    DATA l_r_data TYPE REF TO data.
    CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
    ASSIGN l_r_data->* TO <l_t_data>.
    Loop at <l_t_data> assigning <l_s_data>.
    * Do what ever using <l_s_data>
    Endloop.
    Regards,
    Rich Heilman
    Edited by: Rich Heilman on Feb 28, 2008 2:42 PM

  • Wirte the content of an internal table into a text file

    Hello Experts,
    how can I wirte the content of an internal table into a text file and putit on my local
    desktop ?
    Regards
    ertas

    Hi,
      You can use the FM GUI_DOWNLOAD for this purpose.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'c:\testmmv.txt'
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = LT_STR
      FIELDNAMES                      = 
    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.
    Implement suitable error handling here
    ENDIF.
    With regards,
    Vamsi

  • How to drop the contents on an internal table?

    Dear all,
    can some one suggest me the code to drop the content of an internal table.
    VJ

    Following are the different ways of DELETIONS from ITAB, DTAB and FILE:
    DELETE FROM dbtab       WHERE cond.
    DELETE FROM (dbtabname) WHERE cond.
    - DELETE dbtab.
    DELETE *dbtab.
    DELETE (dbtabname) ... .
    - DELETE dbtab       FROM TABLE itab.
    DELETE (dbtabname) FROM TABLE itab.
    - DELETE dbtab  VERSION vers.
    DELETE *dbtab VERSION vers.
    Delete from an internal table
    - DELETE itab.
    - DELETE itab INDEX idx.
    - DELETE itab FROM idx1 TO idx2.
    - DELETE itab WHERE cond.
    - DELETE ADJACENT DUPLICATES FROM itab.
    Delete a program
    - DELETE REPORT prog.
    Delete text elements
    - DELETE TEXTPOOL prog LANGUAGE lg.
    Delete a data cluster from a database table
    - DELETE FROM DATABASE dbtab(ar) ...ID key.
    Delete a data cluster from the cross-transaction application buffer
    - DELETE FROM SHARED BUFFER dbtab(ar) ...ID key.
    Delete a file
    - DELETE DATASET dsn.
    Delete a screen
    - DELETE DYNPRO f.
    Thanks,
    Santosh

Maybe you are looking for

  • Pages 5 is a downgrade! Don't use.

    I used Pages instead of InDesign. Now Pages 5 is missing important features such as facing pages vertical rules guides proper opening of older documents style shorcuts All my bought Pages-Templates cannot be opened at all. Don't use it.

  • ITunes doesn't recognize my iPhone -- Help!

    Reaching out for help.... iTunes does not recognize my iPhone. Given the number of threads and help documents, this may not sound new - the baffling part is that it DOES recognize my iPod, but not my iPhone. I am running Windows Vista on a Mac Pro us

  • IPad music app does not show track artists in compilations

    Hello community, i have a problem with my iPad's music app. When browsing compilations, it does not show the artist of each track like my iPhone does. Both devices are sync'ed with the same iTunes library, and the 'Part of a compilation' flag is set

  • How can I stop and remove a downloading guitar lesson?

    I started to download a free GB guitar lesson but then noticed the download would be 300MB which is much too big for my capped broadband. I paused it but every time GB opens it asks whether I want to continue downloading. I don't and I am worried it

  • I think my software is down if i update it will it fix my problems?!?

    hey i think my phone has software issues if i updatemy software to 6.0 wil that solve my problems for the moement of will it need to be sent to pple it self?