Appending internal table which is referenced by field-symbol

Hi,
I have a selection screen field called SP$00005 which is not known until runtime as the field is selected in Adhoc Query (SAP Query) by the user.
In the customer exit I am attempting to write code to default in a range to this field - it is a date field and I want to enter the range 01.04.2007 - 30.04.2007.
As select-options require the appending of the screen field table SP$00005 I need a way of adding an entry to this table.
Please see my latest attempt below which appends the correct value to the field symbol <startdate> but this entry does not appear in the internal table SP$00005 when stepping through at runtime.
Can anyone suggest a possible solution?
Thanks,
Alan
  data: ref_field(8) type c.
  field-symbols: <startdate> type table. "table = STANDARD by default
  types: begin of sp$00005, "type definition required for syntax check
              sign(1),
              option(2),
              low type d,
              high type d,
            end of sp$00005.
  data: lt_ref type ref to data.
  ranges: selection for sy-datum.
  ref_field = 'SP$00005'.
  create data lt_ref type table of (ref_field).
  assign lt_ref->* to <startdate>.
assign (ref_field) to <startdate>. "- raises type error
  move 'I' to selection-sign.
  move 'BT' to selection-option.
  move '20070401' to selection-low.
  move '20070430' to selection-high.
  append selection to <startdate>.

Hi,
I tried the following which appends <startdate> with the new entry but the underlying referenced table SP$00005 is still not updated.
Any ideas?
Thanks,
Alan
  field-symbols: <startdate> type any table,
                 <l_line> type any,
                 <l_field> type any.
  data: ref_field(8) type c.
  types: begin of sp$00005, "type definition required for syntax check
           sign(1),
           option(2),
           low type d,
           high type d,
         end of sp$00005.
  data: lt_ref type ref to data.
  ranges: selection for sy-datum.
  data: new_line type ref to data.
  ref_field = 'SP$00005'.
  create data lt_ref type table of (ref_field).
  assign lt_ref->* to <startdate>.
  create data new_line like line of <startdate>.
  assign new_line->* to <l_line>.
  if <l_line> is assigned.
move values using assing stt.
  endif .
  move 'I' to selection-sign.
  move 'BT' to selection-option.
  move '20070401' to selection-low.
  move '20070430' to selection-high.
  assign selection to <l_line>.
  insert <l_line> into table <startdate>.

Similar Messages

  • Sorting internal table with variable no of fields

    Hi ,
    I want to sort the internal table with variable no of fields . Every time the  report is run the number of fields as well as the sequence by which the table has to be sorted changes . How to do this .
    regards

    Hi,
    Please try this.
    DATA: BEGIN OF ITAB OCCURS 0,
            F1(4),
          END OF ITAB.
    DATA: BEGIN OF ITAB2 OCCURS 0,
            F1(1),
            F2(1),
            F3(4),
          END OF ITAB2.
    ITAB-F1 = '01AC'.
    APPEND ITAB.
    ITAB-F1 = '02AB'.
    APPEND ITAB.
    ITAB-F1 = '01CD'.
    APPEND ITAB.
    ITAB-F1 = '02CA'.
    APPEND ITAB.
    LOOP AT ITAB.
      ITAB2-F1 = ITAB-F1+2(1).
      ITAB2-F2 = ITAB-F1+3(1).
      ITAB2-F3 = ITAB-F1.
      APPEND ITAB2.
    ENDLOOP.
    SORT ITAB2 BY F1 ASCENDING
                  F2 DESCENDING.
    LOOP AT ITAB2.
      WRITE: / ITAB2-F3.
    ENDLOOP.
    REWARD POINTS IF HELPFUL

  • Internal table containing any number of fields.

    Hi all ,
    I had a requirement where in i have to create a generalised Function module for downloading the excel sheet to presentation server with some non editable fields.
    Here i need to pass an internal table contaning different fields each time with different data in it to be saved in the excel sheet in the presentation server.
    But iam unable to understand how to declare the import parameter i.e. an internal table which can accept different data whenever it is called and display the same in the output.
    Please help me with the fields in the internal table and the corresponding types in the internal table.
    Thanks in advance,
    Venu.

    Hi ,
    Thanks for ur reply,
    but still i have one problem i.e. since i can get any field as input how to know the type of it ?
    I need to display the contents of the table in the output excel sheet so i actually need to know its type and the corresponding column name as heading in the output excel sheet.
    Thanks in advance,
    Venu.

  • Data Maintain in a table form another table....using field symbols.

    Hi,
    I am using dynamic table concepts.I am using field symbols.I need to maintain two tables of similar structure.
    when i append data it will enter into both tables.when i unassign first table and reassign it ,i am getting back that data again into first table ..how to slve this problem.i need to start first table as fresh table and second table contain copy of the first table.

    Hi,
    maybe you should clarify your problem a bit more by pasting some code and try to explain it a bit more in detail.
    Roy

  • Which internal table is storing MSEG-ZEILE field in bapi BAPI_GOODSMVT_CREA

    Dear Sap Gurus,
    I am facing one problem . i am using standard bapi for migo transaction i.e. BAPI_GOODSMVT_CREATE . it is working fine. Now i want to modify this bapi for some of our own developed fileds that is stored in another table say  ZMSEG . i have found all fields in bapi of table mseg and put those fileds in our developed table  zmseg  but  i  am unable to find one  field  MSEG- ZEILE . Plz guide me from which internal table this filed  MSEG-ZEILE  is coming . The appropriate answers will be highly appreciated.
    Thanks & Regards,
    Amit Ranjan

    Hi
    U can't find out the field ZEILE in BAPI field, just as somebody said you before, that field will be automatically calculated before saving the document.
    So u can calculate it by yourself for your table ZMSEG
    Anyway it doesn't make sense to change the BAPI in order to store the data in own z-table, there is an exit to do it:
    EXIT_SAPLMBMB_001
    Why don't you use it?
    Max

  • Runtime error in Dynamic internal table with AMOUNT and Quantity Fields..

    Dear friends,
    I am attempting write a dymanic Select Statement (with joins).
    And the sleect query looks like this..
      SELECT (LT_SEL_LIST)
      INTO CORRESPONDING FIELDS OF
      TABLE <DYN_TABLE>
      FROM (LT_FROM_LIST)
      WHERE (LT_WHERE3).
    Here the into table is a dynamically created internal table..
    which is created by ...this
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IT_OUTPUT2[]
        IMPORTING
          EP_TABLE        = DY_TABLE.
    the it_output2 contains the the fieldcatlog information of dynamically given fields :-
    like:-
           TABNAME
           FIELDNAME
           DATATYPE
           LENG
           INTTYPE
           ROLLNAME
           DECIMALS
           REFTABLE
           REFFIELD
    i mean the internal table is constructed with reference to all the bove metadata.
    Problem:- This query run fine with all the fields Except AMOUNT AND QUANTITY fields....
    When the selection list contain VBAK-NETWR or MSEG-MENGE..It throws a runtime error.
    "The data read during a SLECT access couldnt be inserted into the target field,either conversion is not supported for
    the target field's type or the target field is too short."
    after this I even tried to construct the dynamic table with CFILEDNAME and QFIELDNAME in the Fieldcatalog.
    so now my fieldcatlog looks like this:---
    LOOP AT IT_DD03L..
      IF IT_DD03L-DATATYPE = 'CURR'.
           TABLEFIELD-CFIELDNAME = IT_DD03L-FIELDNAME .
           ENDIF.
       IF IT_FIELDCAT3-DATATYPE = 'QUAN'.
           TABLEFIELD-QFIELDNAME = IT_DD03L-FIELDNAME .
      ENDIF.
           TABLEFIELD-TABNAME     = IT_DD03L-TABNAME.
           TABLEFIELD-FIELDNAME   = IT_DD03L-FIELDNAME.
           TABLEFIELD-DATATYPE    = IT_DD03L-DATATYPE.
           TABLEFIELD-INTLEN      = IT_DD03L-LENG.
           TABLEFIELD-INTTYPE     = IT_DD03L-INTTYPE .
           TABLEFIELD-ROLLNAME    = IT_DD03L-ROLLNAME.
           TABLEFIELD-DECIMALS    = IT_DD03L-DECIMALS.
           TABLEFIELD-REF_TABLE   = IT_DD03L-REFTABLE.
           TABLEFIELD-REF_FIELD   = IT_DD03L-REFFIELD.
    APPEND TABLEFIELD.
    CLEAR TABLEFIELD.
    ENDLOOP.
    Note:- this is a test code so ignore performance issues...
    Please help me with some code ...to avoid the Runtime erorr.
    Thanks,
    jeevan.

    Hi Jeevan,
    Why are moving only few fields from DD03L table to your field catalog? Why don't you use move-corresponding? The following code works for me in ECC6.0.
    data: it_dd03l type table of dd03l initial size 0,
          ls_dd03l type dd03l,
          lt_fldcat TYPE lvc_t_fcat,
          ls_fldcat TYPE lvc_s_fcat,
          ls_where(72) TYPE c,
          lt_where LIKE TABLE OF ls_where,
          lt_fld LIKE TABLE OF ls_where,
          lt_data_dy TYPE REF TO data.
    field-symbols: <ft_data> TYPE STANDARD TABLE.
    select * into table it_dd03l from dd03l
        where tabname = 'VBAK'
          and ( fieldname = 'VBELN' or fieldname = 'NETWR' ).
    check sy-subrc eq 0.
    loop at it_dd03l into ls_dd03l.
      move-corresponding ls_dd03l to ls_fldcat.
      append ls_fldcat to lt_fldcat.
      move ls_dd03l-fieldname to ls_where.
      append ls_where to lt_fld.
      if ls_dd03l-fieldname = 'VBELN'.
        clear ls_where.
        concatenate ls_dd03l-fieldname ' <> ''''' into ls_where.
        append ls_where to lt_where.
      endif.
    endloop.
    check not lt_fldcat is initial.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = lt_fldcat
          IMPORTING
            ep_table                  = lt_data_dy
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
        IF sy-subrc <> 0.
          RAISE no_configuration_data.
        ENDIF.
        ASSIGN lt_data_dy->*  TO <ft_data>.
    check sy-subrc eq 0.
    select (lt_fld) from VBAK into corresponding fields of table
        <ft_data>
        where (lt_where).
    Thanks
    Bala

  • Sort the internal table based on the vendor field

    hello experts,
    I am stuck with a small problem...
    I am uploading the data for partner association for vendors through lsmw BI program.
    I am collecting all the records in the end of trasaction and downloading all those records on to the apps server.
    I declared one internal table as
    TYPES: BEGIN OF type_erecord,
            mesg(1000) TYPE c,
            END OF type_erecord.
    DATA: t_precord type standard table of type_erecord initial size 0,
                w_precord type type_erecord.
    I am concatenating all the fields and moving to the internal table..
    concatenate zvendor_master-source  zvendor_master-lifnr  blf00-lifnr                   
                      zvendor_master-lname    zvendor_master-parvw
                      zvendor_master-psource  zvendor_master-pname
                      zvendor_master-lifn2        bwyt3-lifn2
                      zvendor_master-ekorg      zvendor_master-werks   
                      w_PLANT-muplant           zvendor_master-defpa
                      v_message
          into w_precord-mesg separated by c_pipe.
          append w_precord to t_precord.
    now at the end I have to sort this internal table t_precord based on blf00-lifnr
    can any one guide me how to do it
    Thanks for your anticipation
    Nitesha

    OK...
    Than you can create one more table and do the process of sorting and than put data into the final table.
    TYPES: BEGIN OF type_erecord,
    mesg(1000) TYPE c,
    END OF type_erecord.
    DATA: t_precord type standard table of type_erecord initial size 0,
    w_precord type type_erecord.
    TYPES: BEGIN OF type_erecord_1,
    mesg(1000) TYPE c,
    lifnr type blf00-lifnr ,  "<<<
    END OF type_erecord_1.
    DATA: t_precord_1 type standard table of type_erecord initial size 0,
    w_precord_1 type type_erecord.
    I am concatenating all the fields and moving to the internal table..
    concatenate zvendor_master-source zvendor_master-lifnr blf00-lifnr
    zvendor_master-lname zvendor_master-parvw
    zvendor_master-psource zvendor_master-pname
    zvendor_master-lifn2 bwyt3-lifn2
    zvendor_master-ekorg zvendor_master-werks
    w_PLANT-muplant zvendor_master-defpa
    v_message
    into w_precord_1-mesg separated by c_pipe.
    w_precord_1-lifnr = blf00-lifnr .  " <<<
    append w_precord_1 to t_precord_1.   " <<<
    SORT T_PRECORD_1 by LIFNR.  " <<
    LOOP AT T_PRECORD_1 into w_precord_1.
      move-corresponing w_precord_1 to w_precord.
      append w_precord to T_PRECORD.
      clear  w_precord .
    endloop.
    Regards,
    Naimesh Patel

  • Delete and internal table with not eqaul to fields

    Hi I have an internal table I want delete few records with fields not equal to the variable v_lifnr, v_name1 and v_city,
    structure of internal table has fields LIFNR, NAME1, CITY, TEXT1 and TEXT2.
    I dont want to go by deletin in loop.

    Hi ,
    i want to delete a internal table record based on the values which are NOT in the ranges ..
    I am facing a syntax error with not operation in some system s
    code looks like below !
    i am not facing this problem when there in  no not in ranges.
    Thanks .
    RANGES: RA_FFIDS FOR /VIRSA/ZFFUSERS-ZVIRFFID.
    data : BEGIN OF IZVIRFFTRANSLOG OCCURS 0.
            INCLUDE STRUCTURE /VIRSA/ZFFTNSLOG.
    DATA:   DESC LIKE RS38M-REPTI,
          END OF IZVIRFFTRANSLOG.
    data : IT_ZFlight_T LIKE IZVIRFFTRANSLOG OCCURS 0 WITH HEADER LINE.
    IF NOT IT_ZFlight_T_TCODE[] IS INITIAL.
        DELETE IT_ZFlight_T_TCODE WHERE ZVIRFFID NOT IN RA_FFIDS.
       DELETE IT_ZFlight_T WHERE ZVIRFFID NOT IN RA_FFIDS.
    ENDIF.

  • Differences between Internal table with Occurs 0 and Field-Groups?

    Is there really any difference between just using an internal table with an OCCURS 0 statement-- which would write the entire table to paging space-- and using field-groups? How is Field-Groups is more effective than Internal tables with occurs 0 when it comes to performance?
    Could anybody please give some information regarding above question?
    Thanks,
    Surya.

    hi,
    occurs 0 means it wont create any extra memory. based on the records only the memory is allocated to internal tables at run time. but when an internal table is created it can hold data of type to which it is declared.
    i.e data: itab like mara occurs 0 with header line.
    can take data only from mara table
    we can also do in another way as using types keyword we can declare a standard structure and create a internal table of that type. its also not that useful as we have to change the structure depending on changes for storing data.
    for this purpose field symbols are used. field symbols can hold any data means that they can point to tables, fields, any standard or user-defined types. field symbols actually points to respective types by which we can directly access to that types using field symbols.
    filed symbols works more faster than internal tables.
    if helpful reward some points.
    with regards,
    Suresh.A

  • How to define an internal table which have to be dynamic

    Hallo,
    here's a problem that i have to solve (but how ?).
    I defined an internal Table with 2 columns:
    col1: tablename
    col2: fieldname
    This table is filled with an unknown number of datasets like this:
    dataset1: A001 KAPPL
    dataset2: A001 KNUMH
    dataset3: A903 KUNNR    and so on.
    I don't know which tablenames and fieldnames are contained.
    Now i have to read those fields (e.g. KAPPL) from those tables (e.g. A001) into an internal table.
    But i don't know how to define this internal table.
    Could anyone help me please ?
    Thanks a lot.
    Silvio

    Hi Wirth
    DATA:
    w_tabname TYPE w_tabname,
    w_dref TYPE REF TO data,
    table_name TYPE tadir-obj_name.
    FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
    READ YOUR INTERNAL TABLE (DATA SET) AND GET THE TABLE NAME,
    AND PASS IT TO W_TABNAME.
      w_tabname = A001.
    CREATE DATA w_dref TYPE TABLE OF (w_tabname).
      ASSIGN w_dref->* TO <t_itab>.
      Now use <t_itab> as your internal table to fetch data .
      <t_itab> will have the structure of A001.
    SELECT *
            FROM (w_tabname) UP TO 10 ROWS
      INTO TABLE <t_itab>.
    Regards
    Hareesh Menon

  • Modify the structure of internal table which created dynamically!!!

    HI All,
    I am creating internal table dynamically using the below syntax.  Now I need to remove few of the fields from the internal table structure. Could you please help me how to go ahead in these cases?
    * Create table dynamically for local data
      CREATE DATA gv_table_l TYPE TABLE OF (<fs_tabname>).
      CREATE DATA gv_wa_l    TYPE (<fs_tabname>).
      ASSIGN gv_table_l->*   TO <fs_local_tab>.
      ASSIGN gv_wa_l->*      TO <fs_local_wa
    >.
    Please let me know if you have any thoughts.
    Thanks,
    Raghu.

    Hi ,
    check this wiki
    [Internal Table|http://wiki.sdn.sap.com/wiki/display/Snippets/Howtocreateinternaltable+dynamically]
    in your case ...
    1.Get filed list based on the type ...make use of  "cl_abap_datadescr=>describe_by_type('MARA'), check for syntax or sample programs...
    2.Delete fields which you dont want to be in your internal table....
    3.Create internal table using method " CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE" ref attached link for sample code by Pinaki...
    regards
    Prabhu

  • Extract datasets?? Internal Tables??.. & Field Groups??..

    Hello Dear ABAP Ace's,
    Please let me know if what are differences between Extract datasets, Internal Tables, & Field Groups????? And what are the similarities?? Also let me know the uses of extract datasets & Field groups???
    Thanks in advance.
    Regards.
    Farooq

    Hi,
    There are two ways of processing large quantities of data in ABAP - either using internal tables or extract datasets.
    An internal table is a dynamic sequential dataset in which all records have the same structure and a key. They are part of the ABAP type concept. You can access individual records in an internal table using either the index or the key.
    Extracts are dynamic sequential datasets in which different lines can have different structures. Each ABAP program may currently only have a single extract dataset. You cannot access the individual records in an extract using key or index. Instead, you always process them using a loop.
    Check these links :
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
    http://www.geocities.com/SiliconValley/Grid/4858/sap/ABAPCode/Fieldgroups.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
    Regards
    L Appana

  • Append Internal table?

    Hi all,
    I am fetching some data from a MARA table to internal table int_temp.
    again i am fetching some more records from MARA...here i want to append these records to the same internal table int_temp.
    how to do this...
    SAchin

    Hi,
    Use like :
    append lines of int_temp1 to int_temp2.
    Pls reward points if useful.
    Regards,
    Renjith Michael.

  • Comapare internal tables which are in tree format

    Hi guys,
    Consider internal table
         level | material-no.|quantity
          1 | mat-1 |              10
          2  |             mat-5  |             1
          3            |   mat-2    |           1
          3   |   mat-4  |      12
          2    |  mat-12      |  11
          3    |  mat-15      |  12
    ................................>mat1  ends here..it contains mat5 and mat 12 which in turn contain          
    .......................mat2 & 4 and mat 15 respectively.
          1    |  mat-8     |    1
          2    |  mat-6     |     3
          2    |  mat-100    |    5
    ......................................>mat 8 ends here
          1  |    mat -6    |    13
    .......................................>mat 6 ends here
      This data is in one internal table, here there are 3 main materials (1,8,6) which are in-turn made of other materials.
    material at level 1 is made of materials at level 2
      and in-turn materials at level2 are made up of materials at level3 .
    Now same material can exist at different levels ...
    What would be the efficient way to compare two such internal tables and comparisons are done wrt quantity but level  and hierarchy at which material exits matters and
    comparison shuld be done at each level .
    if both materials  are in same hierarchy in both tables but diff in quantity then they are unequal .
    if both materials are in same hierarchy  in both tables and equal  in quantity then they are equal .
    if that material exist in one but doesnot exist in other table in similar hierarchy then its rendered as
    not found.
    many thanks in advance.

    Hi Anurag,
    Thanks for the reply but the number of levels is not always 3(it completely depends on data) .I came up with one solution --what I have done is , created one more column <b>HPATH</b> in the internal table and kept hierarchy relationship ..i.e
    level| material| qty | HPATH(hierarchy path)
    1 | mat-1 | 10 | mat-1
    2 | mat-5 | 1 | mat-1 2 mat-5
    3 | mat-2 | 1 | mat-1 2 mat-5 3 mat-2
    3 | mat-4 | 12 | mat-1 2 mat-5 3 mat-4
    2 | mat-12 | 11 | mat-1 2 mat-12
    3 | mat-15 | 12 | mat-1 2 mat-12 3 mat-15
    1 | mat-8 | 1 | mat-8
    2 | mat-6 | 3 | mat-8 2 mat-6
    2 | mat-100 | 5 | mat-8 2 mat-100
    2 and 3 are the path seperates..which indicate the level..
    Thus I get key as unique for each material depending on its position in heirarchy ..
    Then I looped wrt one  table and read data form other table with HPATH as key  and compared it .
    This solved it...
    The number of levels doesnot matter in this solution...
    Thanks once again for replying to my post. I would be to  happy  to put up the code if u want..

  • Name of  the Table  which contains Debit Credit Fields

    Hii all,
    I have to calculate the net amt of sales performed by all sales offices of my company. i have to take Debit n credit field. Which table should  I refer to get these  fields ?
    Regards
    Shubhra Tiwari
    Edited by: shubhra tiwari on Feb 18, 2008 7:14 AM

    Hi,
    In table LIPS, you have the field CMPRE_FLT for item credit price.
    Reward if Helpful.

Maybe you are looking for

  • No Video on Adobe TV

    Trying to watch instruction vieos for Dreamweaver CS6.  Screen comes up but no video.  Am using Creative Cloud and I'm signed in.

  • Logistics execution

    hi, sap gurus, Transportation Mangement: (1). Frieght Charges Happens Frequently Basing On The Seasons/distance/cargo weight/volume etc... How Do You Handle That? (2). Can You Block A Particular driverVendor In Transportation Module? (3). How Can We

  • Could not use the tool because the target channel is hidden

    Hello All; OK, I have never experienced this issue, until the most recent update to Photoshop CC. So I am assuming this is caused by a bug in the update that was released. View the video, of which I demonstrate, that this is not just a human mistake,

  • Where to download the JAVA component for BS2005 and SAP XI ?

    Dear all,    When I install the ECC6 in Linux, system reminder me that the JAVA package is not correct. I wonder where to get the right JAVA component for BS2005? Btw, where to download the SAP XI Component for installation? Tks. Regards Jialin

  • Inspecttion lot batch

    Hi Guys, As you aware when we post the goods receipt Inspection lot will be generated and then when we are going to perform the usage decision where you can see the batch at Inspection lot. We did the same set up for Inbound delivery, when we create