Put a string in an Internal Table

Dear All,
Hope you have a solution.
In a program, I have a field type String.
In this field I put some values separated by TAB -
I would like to take this field and put it in the header line of an internal table.
The length of the values put on the string file is not fix.
Ex: ITAB
            Field1(50)
            FIELD2(50),
            Field3(50)
            FIELD4(50)
Field_string = 'TOTO#TATA#TITI#TUTU#'
I would like to obtain
    ITAB-field1 = TOTO
    ITAB-field2 = TATA
    ITAB-field3 = TITI
    ITAB-field4 = TUTU.
And of course I don't want to write something like
    IF 1 then ITBA1-FIELD1 = u2026
    IF 2 then ITBA1-FIELD2 = u2026
  I'll be surprised that we can't do that in one coding line.
DO you have an idea ?
Thanks in advance

hi,
see the below pseudo code
DATA : text TYPE string VALUE 'toto#tata#titi#tutu',
       it_tab TYPE TABLE OF string,
       wa_tab LIKE LINE OF it_tab.
SPLIT text AT '#' INTO TABLE it_tab.
" it_tab contain four rows
LOOP AT it_tab INTO wa_tab.
"loop it_tab and do your operations
ENDLOOP.
BREAK-POINT.
Thanks

Similar Messages

  • String operations in internal table

    Dear friends..
            Good morning.
                        I wish to know.. how i segregate the field from a database table to internal table into two different internal table field. say for example.
    i have db table tab1 which has field number
    tab1 -> number
    and i have another internal table itab1 whic has two fields numa and numb
    tab1 -> numa
         -> numb
    i have value in tab1->number is 001 and 0001
    i wish to segregate this two values in to internal table
    if the value is 001 then it should be into 001 -> numa
    if the value is 0001 then it should be into 0001-> numb
    i dont know how to perform the string operations in internal table.. would you like to tell me how i fix this problem any suggetion, article, code will be great help of mine..
    thanking you
    Regards
    Naim

    Hi,
      what u can do is check the lenth
    lit_data_tab.
    lit_data_3
    lit_data_4.
    lv_char3 type char3.
    lv_char4 type char4.
    lv_length type i.
    loop at lit_data_tab.
    lv_length = STRLEN ( lit_data_tab-value ).
    if lv_length = 3.
       lv_char3 = lit_data_tab-value .
       append lv_char3 to lv_char3 type char3.
    else.
       lv_char4 = lit_data_tab-value .
       append lv_char4 to lv_char3 type char4.
    endif.
    endloop.
    if u want
    numa  numb
    003   0003.
    then u have to loop in one table and modify other.
    that is any one table should contains both the field.
    read the table with one field
    mark helpfull answers
    Regards
    Message was edited by: Manoj Gupta

  • How to read the method and put that code in 1 internal table

    Hi,
    Actually in the normal ABAP, if we want to read the report,  then we will write read report statement.
    If we want to read method then this statement will not work.
    So, to read the method and put that code in 1 internal table , which statement we need to write?
    Regards,
    Radhika

    Hi Naimesh,
    Thanks for your reply.
    As, i am not aware of ABAP Objects i am having some issues:
    Actually that is working for some methods in some classes.
    Here 1 issue is there:
    In se24 1 method is there in 1 class.
    Even by using that FM in SE37 i am able to get the program name by giving class and method name,
    but while using that FM in the program i am not able to get that program name.
    so, i am unable to read the source code of the program?
    1 example here:
    Class name is CL_GUI_FRONTEND_SERVICES.
    in this class, methods like FILE_EXIST , FILE_GET_SIZE, etc are there.
    By giving the class name and method name i am able to get the program name also,
    but while using that FM in the program i am not able to get that program name.
    so, i am unable to read the source code of the program?
    Here is my code:
    REPORT  Z16059_SCAN_METHOD.
    DATA: BEGIN OF I_PROGRAM OCCURS 0,
          LINE(256) TYPE C,
          END OF I_PROGRAM.
    DATA METHOD TYPE PROGRAM.
    DATA: BEGIN OF I_STRUCTURE,
          CLS_NAME(30) TYPE C,
          METH_NAME(61) TYPE C,
          END OF I_STRUCTURE.
    I_STRUCTURE-CLS_NAME = 'CL_GUI_FRONTEND_SERVICES'.
    I_STRUCTURE-METH_NAME = 'CL_GUI_FRONTEND_SERVICES-FILE_EXIST'.
    CALL FUNCTION 'SEO_METHOD_GET_INCLUDE_BY_NAME'
      EXPORTING
      MTDKEY             =  I_STRUCTURE
    IMPORTING
       PROGNAME          = METHOD
    EXCEPTIONS
       INTERNALMETHOD_NOT_EXISTING      = 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.
    READ REPORT METHOD INTO I_PROGRAM.
    Please help me out in this regard.
    Thanks & Regards,
    Radhika

  • Xml string to abap internal  table

    HI Experts ,
    I want to parse this XML file to abap internal table ,i read as usual  the Help and i think
    that something is missing on my code.
    There is someone can help.
    The fields is type string and the value is :
    <Containers> <Container workitemid = "00000017" IsParent = "X"><Element name = "_WF" value = "USI029"/><Element name = "_WF_PRIOR" value = "5"/><Element name = "_WF_VERSION" value = "0000"/><Element name = "_WF_NESTING_LEVEL" value = ""/><Element name = "XUBNAME" value = ""/><Element name = "XUACCNT" value = ""/><Element name = "SHORTTEXT" value = ""/><Element name =
    i use the call transformation code and there i put this code:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="XML_TAB"/>
      <tt:template>
        <Containers>
          <tt:loop name="a" ref=".XML_TAB">
            <Container>
              <tt:attribute name="Element name" value-ref="$a.name"/>
              <tt:attribute name="value" value-ref="$a.value"/>
            </Container>
          </tt:loop>
        </Containers>
      </tt:template>
    </tt:transform>
    I think that i miss something with the line :<Container workitemid = "0000007" IsParent = "X">
    the dump is:
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_MATCH_ATTRIBUTE', was not
      caught and
    therefore caused a runtime error.
    The reason for the exception is:
    XML matching error
    Expected was attribute: "Elementname" [ ] Read was element-start: "Container" [
    Please help
    Regards
    Chris
    Edited by: Chris Teb on Aug 6, 2009 9:57 AM

    H Siva,
    Thanks ,
    I try exactly like u tell and i get this dump:
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT', was not caught
      and
    therefore caused a runtime error.
    The reason for the exception is:
    XML matching error
    Expected was element-end: "Containers" [ ] Read was element-start: "Container"
    <Containers>
        <Container>
            <tt:loop name="a" ref=".XML_TAB">
            <Element >
              <tt:attribute name="name" value-ref="$a.name"/>
              <tt:attribute name="value" value-ref="$a.value"/>
              </Element>
              </tt:loop>
            </Container>
        </Containers> ->**the dump in the debugger is here .**
      </tt:template>
    </tt:transform>
    Any Idea?
    Regards
    Chris

  • DIFF: Field string ,Structure and Internal table declaration

    Hai,
           what is the diference between  Field string ,Structure in ABAP program and Internal table declaration and how it will work ?
    Thank you
    ASHOK KUMAR.

    hi,
    Look this u will get a good idea.
    *& Report  ZTYPES                                                      *
    REPORT  ZTYPES                                                  .
    * Table declaration (old method)
    DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
    END OF tab_ekpo.
    *Table declaration (new method)     "USE THIS WAY!!!
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
          wa_ekpo TYPE t_ekpo.                    "work area (header line)
    * Build internal table and work area from existing internal table
    DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
          wa_datatab LIKE LINE OF tab_ekpo.
    * Build internal table and work area from existing internal table,
    * adding additional fields
    TYPES: BEGIN OF t_repdata.
            INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
    TYPES: bukrs  TYPE ekpo-werks,
           bstyp  TYPE ekpo-bukrs.
    TYPES: END OF t_repdata.
    DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
          wa_repdata TYPE t_repdata.                 "work area (header line)
    Regards
    Reshma

  • How to decompose a string with ';' into Internal table

    Hello all,
    I need your help for find a Function module or Abap code.
    I have a file with the separator is the ';'
    Example of the contains of my file :
    521010;16;46048,00;;*Soucet*Odmena za
    524012;41;103807,00;;Zdrav.p.organizace
    524012;42;;18332,00;Zdrav.p.organizace
    I want a module function which can separate all the String separate by a ';' into a internal table :
    for example my internal table have 5 column :
    Num......|.....CC.....|............Credit....|...........Debit........|.....Label
    521010....|.....16.....|......46048,00.....|...........................|.....Soucet**Odmena za
    524012....|.....41.....|......103807,00...|...........................|.....Zdrav.p.organizace
    524012....|.....42.....|..........................|........18332,00....|.....Zdrav.p.organizace
    For read the date of my file is not a problem with ABAP Code :
    DO.
          CLEAR : ws_facm.
          break epetrini.
          READ DATASET myFile INTO test.
          IF sy-subrc EQ 0.
            IF ws_facm-codenreg = 'D'.
              APPEND ws_facm TO wt_facm.
            ENDIF.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
    Thank you for your helps.
    Best regards Emilien
    Edited by: Emilien P. on Mar 31, 2010 4:30 PM
    Edited by: Emilien P. on Mar 31, 2010 4:34 PM
    Edited by: Emilien P. on Mar 31, 2010 4:35 PM
    Edited by: Emilien P. on Mar 31, 2010 4:36 PM

    Hi,
    Try whith this:
    DATA: str1 TYPE string,
          str2 TYPE string,
          str3 TYPE string,
          itab TYPE TABLE OF string,
          text TYPE string.
    text = `What a drag it is getting old`.
    SPLIT text AT space INTO: str1 str2 str3,
                              TABLE itab.
    Let me know if it works.
    Regards,
    Moh.

  • Split a string into multiple internal tables

    Hi all,
    I need to split a string based internal table into multiple internal tables based on some sub strings in that string based internal table...
    High priority help me out...
    eg...
    a | jhkhjk | kljdskj |lkjdlj |
    b | kjhdkjh | kldjkj |
    c | jndojkok |
    d |
    this data which is in the application server file is brought into a internal table as a text. Now i need to send 'a' to one internal table, 'b' to one internal table, so on... help me
    <Priority downgraded>
    Edited by: Suhas Saha on Oct 12, 2011 12:24 PM

    Hi pradeep,
    eg...
    a | jhkhjk | kljdskj |lkjdlj |
    b | kjhdkjh | kldjkj |
    c | jndojkok |
    d |
    As per your statement "Now i need to send 'a' to one internal table, 'b' to one internal table"
    Do you want only a to one internal table and b to one internal table
    OR
    Do you want the whole row of the internal table i mean
    a | jhkhjk | kljdskj |lkjdlj | to 1 internal table
    Having the case of an internal table which is of type string,
    1) Loop through the internal table.    LOOP AT lt_tab INTO lwa_tab.
    2) Ge the work area contents and get the first char wa_tab-string+0(1)
    3)   FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
      w_tabname = p_table.
      CREATE DATA w_dref TYPE TABLE OF (w_tabname).
      ASSIGN w_dref->* TO <t_itab>.
    Follow the link
    http://www.sap-img.com/ab030.htm
    http://www.sapdev.co.uk/tips/dynamic-structure.htm
    and then based on the sy-tabix values you will get that many number of internal table
           <FS> = wa_tab-string+0(1)
          append  <FS>
    OR
    USE SPLIT statement at the relevant seperator
    revert for further clarification
    Thanks
    Sri
    Edited by: SRIKANTH P on Oct 12, 2011 12:36 PM

  • String operations on internal table text....

    Original table is consists of 2 columns:
    E        
    RFC error(SM_DHTCLNT010_READ): Error when opening connection
    E RFC error(SM_DHLCLNT010_READ): Error when opening connection
    E RFC error(SM_DHKCLNT010_READ): Error when opening connection
    E RFC error(SM_E10CLNT000_READ): 'tdhtci00.emea.gdc:sapgw02' E     No read RFC FOR SM_B72CLNT003_READ
    E     No read RFC FOR SM_B71CLNT003_READ
    S     Clients for system 'E21' found in RFC  'SM_E21CLNT001_READ'
    S     Clients for system 'E22' found in RFC  'SM_E22CLNT001_READ'
    S     Clients for system 'E23' found in RFC  'SM_E22CLNT001_READ'
    Now we need to apply string operations such that result table is 3 columns with new refined message:
    status       sid            
    Message NEW_TEXT
    E     DHT         
    RFC error               Error when opening connectionE     DHL         RFC error                       Error when opening connection
    E     DHK         RFC error                       Error when opening connection
    E     E10       RFC error                      tdhtci00.emea.gdc:sapgw02
    E     B72        No RFC LINK
    E     B71        No RFC LINK
    S     E21        DATA READ
    S     E22       DATA READ
    S     E23       DATA READ
    String conditions to arrive at new table is:
    1) to get SID column : the conditions are
    •     If the Status is “RFC Error” then next 3 Characters after the “_” must be extracted as SID
    •     Else the SID is between the first and the second inverted comma ‘
    Example:  Clients for system 'E21' found in RFC  'SM_E21CLNT001_READ'extracts “E21” as SID
    2) for message column
    ·         message “RFC Error” if the message text
    starts with “RFC Error”
    · message “no RFC Link” if the message text starts with “No read RFC*”
    · message “Data Read” if the Substring “found in RFC”</b> was found in the Message      
    3) •     If the Status is “RFC Error” then the whole Textstring behind the “: “ must be Extracted
    For example if message is RFC error(SM_DHLCLNT010_READ): Error when opening connection NEW_TEXT will be Error when opening connection
    Need ur inputs on these.
    Bset regards,
    Subba

    Hi,
    this u can acheive simply using offset:
    var_name+off(len). "
    e.g. wa_message-fld+0(3) = first threee characters
    wa_message-fld(3) same as above first three characters
    wa_message-fld+2(2) " will display second and third characte of wa_message-fld
    this u can use to set condtions like :
    if wa_message-fld(9) = 'RFC Error'.
    "process here
    endif.
    Hope this will help u...
    Jogdand M B

  • Split String value into internal table at Carriage return

    Hi All,
    I have given a string type context ( text edit  box ) to the user to enter the values. The data can have carriage returns also.
    My Requirement is that I want to split the data at carriage returns and store it in my tables.
    I tired with a constant value of '%CR_LF' as available in CL_ABAP_CHAR_UTILITIES but to no good result.
    Can the Experts suggest some solution?/??
    Thankx in advance.
    Regds,
    Srini

    Hi Srini,
    Have you looked at your string containing the text in the debugger to verify that you really have <CR>+<LF> (i.e. reflecting CL_ABAP_CHAR_UTILITIES=>CR_LF, which should be easily visible when looking at the hex codes of the string)? Maybe it's just a <LF> (i.e. CL_ABAP_CHAR_UTILITIES=>NEWLINE). Might be good to do a REPLACE first using a regular expression for identifying the line feeds and then doing the SPLIT.
    Cheers, harald
    p.s.: If you still cannot get it to work, provide some more details of what you're doing...

  • Conversion of a string output and store them into the internal table fields

    Hi,
    I'm writing a program in which I'm populating the values generated in TCODE- 'AL11' I'm able to retrieve the data in string format but I've to break the string and put the values in an internal table. The internal table has fields of various lengths and no specific position where I can use a delimiter and use the Split command.
    Kindly provide me suggestions how I can break the string and assign the values in the fields of the internal table.
    Regards,
    Sreedhar.

    Hi,
    Take the screen fields length and create an internal table.
    loop the internal table and first split the string at delimeter( use  cl_abap_char_utilities)
    CONSTANTS:
      c_delimiter        TYPE c VALUE
                              cl_abap_char_utilities=>horizontal_tab,
      c_delimiter_enter  TYPE c VALUE
                              cl_abap_char_utilities=>cr_lf.
    loop at itab into fs.
        SPLIT w_str  AT c_delimiter_enter INTO w_str w_dummy .
                                          " SPLITTING AT 'ENTER KEY'
          SPLIT w_str  AT c_delimiter INTO
                                          " SPLITTING AT 'TAB'
      fs-f1,
    fs-f2.
    append fs to itab.
    clear fs.
    endloop.

  • Converting XML string to internal table

    Hello everyone,
    I am trying to convert an XML string to an internal table. The format of the XML string is as follows:
    <node label="Compressors" NODE_ID="783" checked="1" expandStatus="false">
       <node label="Nail guns" NODE_ID="78543" checked="1" expandStatus="false"/>
       <node label="Spray guns" NODE_ID="855" checked="0" expandStatus="false"/>
       <node label="Cleaning equipment" NODE_ID="9" checked="1" expandStatus="false"/>
    </node>
    What I need is an internal table with the fields NODE_ID and checked filled. The hierarchy here doesn't matter, so I just need an internal table of a structure with 2 fields. The whole XML is hierarchical and contains only the <node> tag, which can be self-closing or not with the attributes within the tag.
    What is the best way to accomplish this?
    Performance here is quite important too, as this XML can contain over 100,000 nodes.
    Should it be done with an xpath expression, with a regex, with the iXML parser, an XSLT call transformation?
    Any help is greatly appreciated!
    Best regards,
    Vincent

    Use this FM to get into internal table
                CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
                  EXPORTING
                    im_xstring = zl_attcntx
                  IMPORTING
                    ex_string  = zl_attcont.
       SPLIT zl_attcont AT cl_abap_char_utilities=>newline INTO TABLE zit_legacy.

  • String and Internal table

    We have a large character string in the memory, e.g. of 5M.
    (1) we want to split the character string into an internal table with a field of c(1000), for example.
    (2) we want to read the internal table, and concatenate each line into one string.
    For STRLEN and CONCATENATE, it always ignores the trailing blanks. However, we don't want to LOSE ANY BLANKS.
    thanks,
    -Stanley

    I don't think there is any availble function module that does it. You may have to code for it. Also the blanks are a problem. So try something like this, which was actually suggested by Sanjay while responding to another question in this forum
    First replace all the blank space with a character that you know for sure, will not be there in your string.
    TRANSLATE mystring USING ' @'.
    Now do your STRLEN and get your string length.
    The you can split your string using the option INTO TABLE. Your itab will have only one field of 1000 length.
    Then read the internal table and concatenate them back into the long string.
    Finally, you reverse the pattern in the previous TRANSLATE statement to '@ '.
    Srinivas

  • Select query for picking data in a dynamic internal table

    Dear All,
    Please help.
    <u>The code is :</u>
    p_table1 = itab_final-tabname1.
            p_field1 = itab_final-fieldname1.         
            SELECT (p_field1) FROM (p_table1) INTO CORRESPONDING FIELDS OF TABLE <dyntable1>.      
    It is working fine when the domain is of CHAR
    The piece of code is not working where domain is DATS, CURR, DEC, etc.
    What shall I do so that it works for other domains also. Please its urgent......
    <u>ERROR that came:</u>
    An exception occurred. This exception will be dealt with in more detail
    below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
    caught, which                                                         
    led to a runtime error. The reason for this exception is:             
    The data read during a SELECT access could not be inserted into the    
    target field.                                                          
    Either conversion is not supported for the target field's type or the  
    target field is too short to accept the value or the data are not in a 
    form that the target field can accept

    Check below code
    REPORT zpwtest .
    *** Tables
    DATA: lt_data TYPE REF TO data.
    DATA: lt_fieldcatalog TYPE lvc_t_fcat.
    data : p_field type string ,
           p_table type string .
    *** Structure
    DATA: ls_fieldcatalog TYPE lvc_s_fcat.
    *** Data References
    DATA: new_line TYPE REF TO data.
    *** Field Symbols
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
                   <fs_1> TYPE ANY TABLE,
                   <fs_2>,
                   <fs_3>.
    ls_fieldcatalog-fieldname = 'MANDT'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
    ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CONNID'.
    ls_fieldcatalog-inttype = 'N'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'FLDATE'.
    ls_fieldcatalog-inttype = 'D'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'PRICE'.
    ls_fieldcatalog-inttype = 'P'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CURRENCY'.
    ls_fieldcatalog-inttype = 'C'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ASSIGN lt_data TO <fs_data>.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
         EXPORTING
           it_fieldcatalog = lt_fieldcatalog
         IMPORTING
           ep_table = <fs_data>
         EXCEPTIONS
           generate_subpool_dir_full = 1
           OTHERS = 2
    IF sy-subrc <> 0.
    ENDIF.
    *** So <FS_1> now points to our dynamic internal table.
    ASSIGN <fs_data>->* TO <fs_1>.
    *** Next step is to create a work area for our dynamic internal table.
    CREATE DATA new_line LIKE LINE OF <fs_1>.
    *** A field-symbol to access that work area
    ASSIGN new_line->*  TO <fs_2>.
    <b>
    p_field = 'mandt carrid connid fldate price currency' .
    p_table = 'sflight' .
    *** And to put the data in the internal table
    SELECT (p_field)
      FROM (p_table)
      INTO CORRESPONDING FIELDS OF TABLE <fs_1>.
    </b>
    *** Access contents of internal table
    LOOP AT <fs_1> ASSIGNING <fs_2>.
      ASSIGN COMPONENT 5 OF STRUCTURE <fs_2> TO <fs_3>.
      WRITE: / <fs_3>.
    ENDLOOP.

  • To add the multiline data into an internal table from TextEdit

    Hello Experts,
    I have one requirement that I have to use the TextEdit field. and put the values into an internal table.
    can you help me. with some sample code.
    Thanks in Advance
    Kuldeep

    The problem is solved by using the following code
    DATA: data TYPE REF TO CL_HTMLB_TEXTEDIT.
    Data itab1 type itab.
    data ?= CL_HTMLB_MANAGER=>GET_DATA(
                                    request = runtime->server->request
                                     name    = 'textEdit'
                                     id      = 'txt1'
    data text type string.
    IF data IS NOT INITIAL.
      text = data->text.
    ENDIF.
    SPLIT text AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO
          TABLE itab1.
    Kuldeep

  • Column to row display of internal table values

    Hi guys,
    I have the internal table in the following manner
    MATNR     ADSIZE     PRICE
    220p     15m     100
    220p     16m     120
    220p     17m     230
    230p     16m     200
    230p     17m     120
    230p     18m     220
    240p     17m     120
    250p     18m     560
    And want to change to the below mentioned manner, please note that there can be multiple matnr's and multiple adsizes as well.
    MATNR     15m     16m     17m     18m     ......(dynamic:depends on                                                                               
    user )
    220p     100     120     230
    230p     -     200     120     220...and so on.
    How do i display in the above manner.
    Please help.
    Thanks in advance.
    Regards,
    Santosh Kotra.

    Hi Santosh.
    I work hard in this topic. I will post my solution, try to adequate to your needs.
    If your problem is solved, talk to me about your solution.
    I create 2 dynamics tables to do this. I create a it to save the column position to populate the table for alv.
    Change the select (form select) to see with others filters.
    I hope this help you and others.
    Regards
    *& Report  ZDYNAMIC                                                    *
    REPORT  zdynamic                                .
    Tables
    DATA: lt_data TYPE REF TO data,
          lt_new  TYPE REF TO data.
    DATA: lt_fieldcatalog TYPE lvc_t_fcat.
    Structure
    DATA: ls_fieldcatalog TYPE lvc_s_fcat,
          BEGIN OF mat OCCURS 0,
            name TYPE string,
            pos TYPE i,
          END OF mat.
    Data References
    DATA: new_line TYPE REF TO data,
          tab_line TYPE REF TO data.
    Field Symbols
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
                   <fs_data1> TYPE REF TO data,
                   <fs_1> TYPE STANDARD TABLE,
                   <ntab> TYPE STANDARD TABLE,
                   <fs_2>,
                   <tab2>,
                   <fs_3>,
                   <tab3>.
    Vars
    DATA: index LIKE sy-index.
    PERFORM fieldcat.
    ASSIGN lt_data TO <fs_data>.
    ASSIGN lt_new  TO <fs_data1>.
    PERFORM cria_tab USING lt_fieldcatalog 1.
    ASSIGN <fs_data>->* TO <fs_1>.
    CREATE DATA new_line LIKE LINE OF <fs_1>.
    ASSIGN new_line->*  TO <fs_2>.
    And to put the data in the internal table
    PERFORM select.
    preencher fieldcat tabela nova
    CLEAR lt_fieldcatalog[].
    LOOP AT <fs_1> ASSIGNING <fs_2>.
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE <fs_2> TO <fs_3>.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        IF sy-index = 1.
          CLEAR ls_fieldcatalog.
          ls_fieldcatalog-coltext   = 'CARRID'.
          ls_fieldcatalog-fieldname = 'CARRID'.
          ls_fieldcatalog-inttype = 'C'.
          APPEND ls_fieldcatalog TO lt_fieldcatalog.
        ENDIF.
        IF sy-index = 2.
          CLEAR ls_fieldcatalog.
          ls_fieldcatalog-coltext   = <fs_3>.
          ls_fieldcatalog-fieldname = <fs_3>.
          ls_fieldcatalog-inttype = 'C'.
          APPEND ls_fieldcatalog TO lt_fieldcatalog.
        ENDIF.
      ENDDO.
    ENDLOOP.
    SORT lt_fieldcatalog DESCENDING BY fieldname.
    DELETE ADJACENT DUPLICATES FROM lt_fieldcatalog.
    LOOP AT lt_fieldcatalog INTO ls_fieldcatalog.
      mat-name = ls_fieldcatalog-coltext.
      mat-pos  = sy-tabix.
      APPEND mat.
    ENDLOOP.
    *create new table
    PERFORM cria_tab USING lt_fieldcatalog 2.
    add data
    ASSIGN <fs_data1>->* TO <ntab>.
    CREATE DATA tab_line LIKE LINE OF <ntab>.
    ASSIGN tab_line->*  TO <tab2>.
    LOOP AT <fs_1> ASSIGNING <fs_2>.
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE <fs_2> TO <fs_3>.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        IF sy-index = 1.
          ASSIGN COMPONENT sy-index OF STRUCTURE <tab2> TO <tab3>.
          <tab3> = <fs_3>.
        ELSEIF sy-index = 3.
          ASSIGN COMPONENT 2 OF STRUCTURE <fs_2> TO <fs_3>.
          READ TABLE mat WITH KEY name = <fs_3>.
          index = mat-pos.
          ASSIGN COMPONENT sy-index OF STRUCTURE <fs_2> TO <fs_3>.
          ASSIGN COMPONENT index OF STRUCTURE <tab2> TO <tab3>.
          <tab3> = <fs_3>.
        ENDIF.
      ENDDO.
      APPEND <tab2> TO <ntab>.
      CLEAR <tab2>.
    ENDLOOP.
    PERFORM display.
    FORM display
    FORM display.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          it_fieldcat_lvc = lt_fieldcatalog
        TABLES
         t_outtab        = <fs_1>
          t_outtab        = <ntab>
        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.
    ENDFORM.                    "display
    FORM fieldcat
    FORM fieldcat.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-coltext   = 'CARRID'.
      ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
      ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      ls_fieldcatalog-coltext   = 'CONNID'.
      ls_fieldcatalog-fieldname = 'CONNID'.
      ls_fieldcatalog-inttype = 'N'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      ls_fieldcatalog-coltext   = 'FLDATE'.
      ls_fieldcatalog-fieldname = 'FLDATE'.
      ls_fieldcatalog-inttype = 'D'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      ls_fieldcatalog-coltext   = 'PRICE'.
      ls_fieldcatalog-fieldname = 'PRICE'.
      ls_fieldcatalog-inttype = 'P'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      ls_fieldcatalog-coltext   = 'CURRENCY'.
      ls_fieldcatalog-fieldname = 'CURRENCY'.
      ls_fieldcatalog-inttype = 'C'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ENDFORM.                    "fieldcat
    FORM cria_tab
    FORM cria_tab USING catalog TYPE lvc_t_fcat qual TYPE i.
      IF qual = 1.
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = catalog
          IMPORTING
            ep_table                  = <fs_data>
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
      ELSE.
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = catalog
          IMPORTING
            ep_table                  = <fs_data1>
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
      ENDIF.
    ENDFORM.                    "cria_tab
    FORM select
    FORM select.
      SELECT mandt carrid connid fldate price currency
        FROM sflight
        INTO CORRESPONDING FIELDS OF TABLE <fs_1>
        WHERE "carrid = 'AA' AND
        fldate > '20080101'.
    ENDFORM.                    "select

Maybe you are looking for

  • Installing 9iFS on Win2K Advanced Server from 11/29 zip

    I've downloaded the 9.0.1 zip 9iFS_90110.zip (105,219,938 bytes) and tried to install on 2 separate servers with no success. I follow the install instructions: "1. Launch the Oracle Universal Installer from the CD, located in the following path: <CD-

  • Shuffle's remote

    Just bought it... and the remote doesn't really work well. The middle button sometime works, sometimes it just don't. So I can't put it on pause, neither change song or listen to playlist. Anyone have the same prob??

  • XServe 2006 RAID Card Issues

    Basically, I was gifted (some gift!) a Late 2006 XServe 2.0GHz Dual QX, with 4 GB RAM, and basically was told 'It does not boot. We give up.' So heres what I have found so far.. It has an Apple Raid Card (don't ask me much more than that, or ill have

  • How can you stretch an image using JMF API

    How is it possible to strech or zoom the video using JMF API? Streching may not distort the resolution, but, zooming might as I imagiine.

  • Software stuck in capslock but the key is not stuck, can't log in now due to the caps lock. what should I do?

    I was doing homework and the software started lagging, followed by all the font being stuck in caps lock. My keys are find and I could still turn the caps on/off. This had no effect; still caps. I used shift, still the caps stayed on. I restarted it