Modify column in an internal table

Hi Friends,
I have an internal table itab1 which has a column called zpo_number .
I am getting the PO from a BAPI call storing in a field w_ponumber.
I have the code below . THe table itab1 has rows all having the same matnr .
How can I modify all the rows of the table with the same w_ponumber ?
Thanks!
Loop at itab1
babpi call get po number
w_ponumber.
MODIFY itab1
endloop.

simplicity change to your original code provided:
Loop at itab1
babpi call get po number
w_ponumber.
itab1-z_ponumber  = w_ponumber.
MODIFY itab1
endloop.
Or -
Loop at itab1
babpi call get po number
itab1-z_ponumber.
MODIFY itab1
endloop.

Similar Messages

  • How to find the number of columns in an internal table DYNAMICALLY ?

    Hi,
    How to find the number of columns in an internal table DYNAMICALLY ?
    Thanks and Regards,
    saleem.

    Hi,
    you can find the number of columns and their order using
    the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = sy-repid
      changing
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif
    now describe your fieldcat . and find no of columns.
    and their order also..
    regards
    vijay

  • Adding a column in an internal table

    Hi,
    I want to know how to add different rows of a  column in an internal table.
    My code :
    Declaration Part-----
    types : begin of imchb,
            clabs like mchb-clabs,
            cumlm like mchb-cumlm,
            cinsm like mchb-cinsm,
            tot_val_stock type p decimals 3,
            pm_percent type p decimals 6,
            end of imchb.
    data : int_inv type standard table of imchb with header line,
           wa_inv like line of int_inv.
    Then I do few calculations and display it in the column pm_percent.
    Now I want to sum this column.
    Summation---
    loop
    at int_inv into wa_inv.
    at end of pm_percent.
    sum.
    endat.
    endloop.
    write :/ wa_inv-pm_percent.
    However , wa_inv-pm_percent only gives me the value of the last row of the column.
    Kindly suggest .

    Hi,
    Please try this code:
    loop at int_inv into wa_inv.
        lv_count = lv_count + 1.
        AT END OF posnr.   <------- The field you want to sum..
          gs_total-posnr      = wa_inv-posnr.
          gs_total-cov_total  = lv_count.
          APPEND gs_total TO gt_total.
          CLEAR : gs_total,
                  lv_count,
                  wa_inv.
        ENDAT.
      ENDLOOP.

  • How to insert select columns from one internal table to another

    Hi,
    How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
    regards,
    Sriram

    Hi,
    If your question is for copying data from 1 int table to other ;
    we can use
    APPEND LINES OF it_1 TO it_2.
    or if they have different columns then:
    loop at it_1 into wa_it1.
    move wa_it1-data to wa_it2-d1.
    apped wa_it2 to it_2.
    clear wa_it2.
    endloop.
    thnxz

  • Copy columns of an internal table

    hi,
    i want to copy columns of an internal table into another internal table, now i loop the original table to one workarea and then get the field i need, and then append to destination table.
    is there any more effective way ?

    hi,
    use move corresponding statement.
    Example:
    MOVE-CORRESPONDING ADDRESS TO NAME.
    and also use
    <itab2> = <itab1>.
    *if useful reward with points.*

  • Moving columns of an internal table to rows of an another internal table.

    Hi
    i have an internal table with 20 fields for single record .Now i need to move the 20 fields
    (of similar length) of single record into internal table with those 20 fields as 20 records i.e i need to make rows of first internal table into columns of second internal table.
    hope iam clear.

    HI Deepthi,
    Try with this Logic...
    IF NOT ITAB[] IS INITIAL.
          LOOP AT ITAB FROM 7.
            ITAB2-FIELD1 = ITAB-FIELD1.
            ITAB2-FIELD2 = ITAB-FIELD2.
            APPEND : ITAB2.
            CLEAR : ITAB2.
          ENDLOOP.
          DO 27 TIMES.
            CASE CNT.
              WHEN '1'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD6.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD6.
              WHEN '2'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD7.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD7.
              WHEN '3'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD8.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD8.
              WHEN '4'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD9.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD9.
              WHEN '5'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD10.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD10.
              WHEN '6'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD11.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD11.
              WHEN '7'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD12.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD12.
              WHEN '8'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD13.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD13.
              WHEN '9'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD14.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD14.
              WHEN '10'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD15.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD15.
              WHEN '11'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD16.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD16.
              WHEN '12'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD17.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD17.
              WHEN '13'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD18.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD18.
              WHEN '14'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD19.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD19.
              WHEN '15'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD20.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD20.
              WHEN '16'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD21.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD21.
              WHEN '17'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD22.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD22.
              WHEN '18'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD23.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD23.
              WHEN '19'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD24.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD24.
              WHEN '20'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD25.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD25.
              WHEN '21'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD26.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD26.
              WHEN '22'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD27.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD27.
              WHEN '23'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD28.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD28.
              WHEN '24'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD29.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD29.
              WHEN '25'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD30.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD30.
              WHEN '26'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD31.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD31.
              WHEN '27'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD32.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD32.
              WHEN '28'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD33.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD33.
              WHEN '29'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD34.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD34.
              WHEN '30'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD35.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD35.
              WHEN '31'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD36.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD36.
              WHEN '32'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD37.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD37.
              WHEN '33'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD38.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD38.
              WHEN '34'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD39.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD39.
              WHEN '35'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD40.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD40.
              WHEN '36'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD41.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD41.
              WHEN '37'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD42.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD42.
              WHEN '38'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD43.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD43.
              WHEN '39'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD44.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD44.
              WHEN '40'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD45.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD45.
              WHEN '41'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD46.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD46.
              WHEN '42'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD47.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD47.
              WHEN '43'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD48.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD48.
              WHEN '44'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD49.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD49.
              WHEN '45'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD50.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD50.
              WHEN '46'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD51.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD51.
              WHEN '47'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD52.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD52.
              WHEN '48'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD53.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD53.
              WHEN '49'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD54.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD54.
              WHEN '50'.
                READ TABLE ITAB INDEX 4.
                ITAB3-FIELD1 = ITAB-FIELD55.
                READ TABLE ITAB INDEX 5.
                ITAB3-FIELD2 = ITAB-FIELD55.
            ENDCASE.
            APPEND ITAB3.
            CLEAR ITAB3.
            CNT = CNT + 1.
          ENDDO.
        ENDIF.
      ENDIF.
    Regards,
    Santosh

  • Change the Value of column of the internal table at run time

    Hello Experts,
    With the below code i am able to determine the value hold
    by internal table at run time for a sepcific column but i am not getting the way
    of how to update the internal if one of the value is changed,
      lr_desc_table ?= cl_abap_typedescr=>describe_by_data( itab  ).
      lr_desc_struc ?= lr_desc_table->get_table_line_type( ).
    loop at itab assigning <fs_data>.
        loop at lr_desc_struc->components ASSIGNING <fs_comp_wa>.
          assign component  <fs_comp_wa>-name of structure <fs_data> to <fs_field>.
          lv_excel_row = <fs_field>.
         CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
            EXPORTING
              INTEXT  = lv_excel_row
            IMPORTING
              OUTTEXT = lv_excel_row.
          assign lv_excel_row to <fs_field>. "this is not changing the value actually hold in internal table
        endloop.
      endloop.

    Hi,
    Resolved this issue with the code mentioned below.
    Code:
    loop at lt_export_items assigning <fs_data>.
      ls_data = <fs_data>.
        loop at lr_desc_struc->components ASSIGNING <fs_comp_wa>.
          assign component  <fs_comp_wa>-name of structure <fs_data> to <fs_field>.
          lv_excel_row = <fs_field>.
          CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
            EXPORTING
              INTEXT  = lv_excel_row
            IMPORTING
              OUTTEXT = lv_excel_row.
              concatenate 'ls_data-' <fs_comp_wa>-name into  lv_var.
              assign (lv_var) to <fs_var>.
              <fs_var> = lv_excel_row.
        endloop.
        modify lt_export_items from ls_data .
        clear:ls_data.
      endloop.
    Take care,
    Sanju

  • Adding Specific columns of dynamic internal table row into another column

    Hi Gurus,
    I need to add  few columns of a dynamic internal table row into another column:
    Article description hy01 hy02 total
    101      panza         10     12      22
    102      masht         12     12     24
    dynamic internal table is created and columns hy01 hy02.... can increase
    How to add the the values in hy01 hy 02... into total.
    Regards,
    Dep

    Hi,
    If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
    Here an example how to generate a dynamic table based on another internal table, hope this will help you.
    TYPE-POOLS: slis.
    PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
    * Type ZST_T:
    *   matnr  TYPE matnr
    *   maktx  TYPE maktx
    *   hy01   TYPE i
    *   total  TYPE i
    TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
    PERFORM main.
    *&      Form  main
    *       text
    FORM main.
      DATA: lt_fieldcat     TYPE slis_t_fieldcat_alv,
            lt_t            TYPE ty_t,
            lr_new_t        TYPE REF TO data.
      FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
      "Add some lines to LT_T just to have something to display on screen
      DO 10 TIMES.
        APPEND INITIAL LINE TO lt_t.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZST_S'
        CHANGING
          ct_fieldcat      = lt_fieldcat.
      "Copy LT_T to LR_NEW_T
      PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
      CLEAR lt_t. "Not needed anymore...
      ASSIGN lr_new_t->* TO <lt_new_t>.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_new_t>.
    ENDFORM.                    "main
    *&      Form  extend_and_copy_table
    FORM extend_and_copy_table USING ut_t           TYPE STANDARD TABLE
                                     uv_nb_hy       TYPE i
                               CHANGING cr_t        TYPE REF TO data
                                        ct_fieldcat TYPE slis_t_fieldcat_alv
                               RAISING cx_sy_struct_creation cx_sy_table_creation.
      DATA: lo_tabledescr      TYPE REF TO cl_abap_tabledescr,
            lo_structdescr     TYPE REF TO cl_abap_structdescr,
            lo_new_structdescr TYPE REF TO cl_abap_structdescr,
            lo_new_tabledescr  TYPE REF TO cl_abap_tabledescr,
            lt_components      TYPE cl_abap_structdescr=>component_table,
            ls_component       TYPE cl_abap_structdescr=>component,
            lv_field_cnt       TYPE numc2,
            ls_fieldcat        TYPE slis_fieldcat_alv,
            lr_fieldcat        TYPE REF TO slis_fieldcat_alv.
      FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
                     <lt_new_t> TYPE STANDARD TABLE,
                     <ls_new_s> TYPE ANY.
      "Get the list of all components from UT_T line structure
      lo_tabledescr  ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
      lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_components  = lo_structdescr->get_components( ).
      "The new columns will be from type of column HY01
      ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
      "The new columns will have the same fieldcat info as column HY01
      READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
      "HY<lv_field_cnt> = new field name
      lv_field_cnt = uv_nb_hy + 1.
      "For each new column...
      DO uv_nb_hy TIMES.
        "Generate the new column field name
        CONCATENATE  'HY' lv_field_cnt INTO ls_component-name.
        ls_fieldcat-fieldname = ls_component-name.
        "Add the new field to the components of the new structure
        INSERT ls_component INTO lt_components INDEX 4.
        "Add the new field's fieldcat info to the fieldcat
        INSERT ls_fieldcat  INTO ct_fieldcat   INDEX 4.
        lv_field_cnt = lv_field_cnt - 1.
      ENDDO.
      "Adjust the COL_POS from fieldcat
      LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
        lr_fieldcat->col_pos = sy-tabix.
      ENDLOOP.
      "Create the new table
      lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
      lo_new_tabledescr  = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
      CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
      ASSIGN cr_t->* TO <lt_new_t>.
      "Copy all data from old to new table
      LOOP AT ut_t ASSIGNING <ls_old_s>.
        APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
        MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
      ENDLOOP.
    ENDFORM.                    "main

  • Moving columns in an internal table

    Hi Gurus,
    I have this ALV program which displays the cost element and its corresponding groups (up to 10th level only).
    My problem is on how to display the report where the first column is the cost element and the succeeding columns the cost element groups starting from the top level.
    Below is example of a hierarchy of a given cost element ( 50030000 ).
        EMPSTOTAL                            <---Top level
             ESSPENDING
                  ES5003
                       ES5003P
                           50030000              <---Cost Element
    Now, since the selection of data is from the cost element up to to the top level group.
    The internal table would look like this:
    Cost Element       Group 1      Group 2        Group 3           Group 4          Group 5             Group 6   .......
    50030000           ES5003P      ES5003       ESSPENDING    EMPSTOTAL     (blank)           (blank)......
    But this output is wrong, what  I really want is like this:
    Cost Element       Group 1            Group 2              Group 3           Group 4          Group 5             Group 6   .......
    50030000           EMPSTOTAL      ESSPENDING      ES5003            ES5003P        (blank)               (blank)......
    As you can see, what is placed next to the cost element is the Top level Group and the last is the group directly linked to the cost element.
    Can you please teach me on how to do just that?
    Thank you so much for your help.
    Regards,
    Onyx

    Hi,
    As my analysis you are passing the values to the wrong fields of the internal table. Please check the structure of your internal table . Is this in the order which you want?
    Other wise please look into how this internal table is getting filled?
    This is the sturucture mismatch probelm.
    Also look in to the fieldcatalog.
    With Regards,
    Sumodh.P

  • Question reg. modifying latest record in internal table

    Can you tell me if it is possible to modify the last appended record to the internal table?
    I just want to modify the record in the internal table which is appended at the latest. Please tell me the logic for this.
    Thanks a lot,
    Krishen

    Hi try with this:
    DATA line TYPE I.
    DATA wa_itab TYPE LINE OF it_itab.
    DESCRIBE TABLE IT_TABLE LINE line.
    READ TABLE IT_TABLE INTO wa_itab INDEX line.
    WA_TABLE-FIELD = 'new value'.
    MODIFY TABLE IT_TABLE FROM wa_itab
           TRANSPORTING field.
    Best regards.

  • MODIFY ALL LINES IN INTERNAL TABLE

    Hi,
    How to modify more than one line in an internal table? I tried using update, failed as update is not for internal tables. Your help is appriciated .
    thank you,
    surya.

    To change one or more lines using a condition, use the following statement:
    <b>MODIFY itab FROM wa TRANSPORTING f1 f2 ... WHERE cond.</b>
    This processes all of the lines that meet the logical condition cond. The logical expression cond can consist of more than one comparison. In each comparison, the first operand must be a component of the line structure. If the table lines are not structured, the first operand can also be the expression TABLE_LINE. The comparison then applies to the entire line. If the line type of the internal table contains object reference variables as component comp or if the entire line type is a reference variable, the attributes of the attr object to which the respective line reference points can be specified as comparison values using comp->attr or table_line->attr.
    The work area wa, which must be compatible with the line type of the internal table, contains the new contents, which in turn will be assigned to the relevant table line using the TRANSPORTING addition. Unlike the above MODIFYstatement, the TRANSPORTING addition is not optional here. Furthermore, you can only modify the key fields of the internal table if it is a standard table. If at least one line is changed, the system sets sy-subrc to 0, otherwise to 4.
    REPORT demo_int_tables_modify .
    DATA: BEGIN OF line,
            col1 TYPE i,
            col2 TYPE i,
          END OF line.
    DATA itab LIKE HASHED TABLE OF line WITH UNIQUE KEY col1.
    DO 4 TIMES.
      line-col1 = sy-index.
      line-col2 = sy-index ** 2.
      INSERT line INTO TABLE itab.
    ENDDO.
    line-col1 = 2.
    line-col2 = 100.
    MODIFY TABLE itab FROM line.
    LOOP AT itab INTO line.
      WRITE: / line-col1, line-col2.
    ENDLOOP.
    The list output is:
             1        1
             2      100
             3        9
             4       16
    The program fills a hashed table with a list of square numbers. The MODIFY statement changes the line of the table in which the key field col1 has the value 2.
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Key column in an internal table?

    Hi all,
    Can somebody tell me, if it is possible to create an internal table with a key-column?
    I think it is, but I do not know how? So, How can I make it? Does this keys work exactly like DB table keys?
    Thanks,
    MPM

    I'm not sure if it is correct that sorted tables can only have unique keys.
    The table keys are important for access:
    1. Every table with character fields have got a key by (SAP) definition. An unsorted standard table's key consists of all non-numeric fields. In this case the access will be sequential except for a binary search.
    2. Sorted tables may have one unique or non-unique key consisting odf one or more fields. If the key is not unique, the entry with the lowest index is accessed.
    3. Only Hash tables require a unique key
    4. Only one key per internal table is allowed (no secondary keys as in other programming languages or database definitions).
    5. See also:
    http://help.sap.com/saphelp_47x200/helpdata/en/90/8d7325b1af11d194f600a0c929b3c3/frameset.htm
    regards,
    Clemens

  • How to create New columns for the Internal Table Dynamically?

    HI Guys,
                          In my logic i have to create new columns depending on the logic which i am executing.
    My requirement is .I have to display o/p like this
    Material || Year || Period  ||  Mix ratio || Vendor ||Mix Ratio || Vendor || Mix Ratio Vendor || Mix ratio || Vendor || Mix ratio.............................from table's CKMLMV003 and CKMLMV001.Her i have to display the o/p in the above format and i have to display Vendor and Mix Ratio for 5 columns irrespective of data .If i have more than 5 columns for any record then i have to create a New columns dynamically for Vendor and Mix ratio.If anybody want my code i can Submit But plz tell with example how to do?
                    <b>The O/P must be finally shown in ALV Grid</b>
    Thanks,
    Gopi

    You must create the entire internal table dynamically, you can not add columns to a statically define internal table.  Here is an example of creating a dynamic internal table.
    Creation of internal table dynamically based on the Date Range entered
    Regards,
    Rich Heilman

  • CONVERTING ROWS OF AN INTERNAL TABLE TO COLUMNS OF ANOTHER INTERNAL TABLE

    Hi,
    I hv an internal table itab as below with 3 columns.
      name           age         place
      sandeep       24           delhi
      ajay             22           bangalore
      abhishek      25           mumbai
    internal table itab can have any number of rows.
    from this internal table i want to make another internale table itab_new as
    sandeep     ajay            abhishek
    24              22                 25
    delhi          bangalore       mumbai
    thanks

    Hi,
    Check this example:
    data:p_temp(30)  TYPE c value 'ztmp_projectreport'.
    *data declaration
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i,
          answer TYPE c.
    TYPES: BEGIN OF t_abapcode,
      row(72) TYPE c,
    END OF t_abapcode.
    DATA: it_abapcode TYPE STANDARD TABLE OF t_abapcode INITIAL SIZE 0.
    data:it_prps like prps occurs 0 with header line.
    data:colum(20) type c.
    data:ncol type i.
    data:ccol type c.
    select * into corresponding fields of table
      it_prps from prps where
    append 'report ztmp_projectreport' to it_abapcode.
    append 'data:begin of it_prps2,' to it_abapcode.
    ncol = 1.
    loop at it_prps.
      ccol = ncol.
      concatenate 'colum' ccol '(20)' into colum.
      concatenate colum 'type c,' into it_abapcode.
      add 1 to ncol. 
    endloop.
    append 'data:end of it_prps2.' to it_abapcode.
    'All your code here to fill the internal table and alv grid
    'End of all your code
    INSERT REPORT p_temp FROM it_abapcode.
          SUBMIT (p_temp) AND RETURN.
          DELETE REPORT p_temp.
    Please provide points

  • Hide or Delete Empty columns in dynamic internal table

    Hi,
                                I am having an dynamic internal table which contains more than 100 columns.
             I need to delete empty column from that table, can any one help this.

    Hello,
    If you are talking about ALV then you can just the the table for empty columns before populating fieldcataloge and hide the columns.
    If your query is still not answered please provide a detail requirement.

Maybe you are looking for