FM Table TYPE ANY

Hi,
is it possible to give an FM a table with the type ANY? The table type is dynamic.
Regards,
Sinan

TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as internal standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to such a formal parameter, an empty header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. In the case of formal parameters defined with TABLES, no value transmission is possible.
Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created in the function module  for the internal table using the addition LIKE LINE OF itab of the DATA statement in the function module.
So you cant use the Tables type any option.....
Message was edited by:
        Muthurajan Ramkumar

Similar Messages

  • Working with table type any with mapping according to keys

    Hi All ,
    I have table type any with data and I need to fill structure type any according to respective  key and verify that the field is have mapping .
    i.e. I have a table <lt_itab> and I need to find the specific entry on it according to the key and the mapping .
    I guess that the best way is to give example.
    <lt_itab> -  Is type any and can have lot of entries
    lt_key  -  Is specified table with field_name and value
    lt_map  -  Table with field_name which have mapping (have unique field name in every entry of the table )from f1..fn -
    I need to fill fields in <ls_output> just if they appear in lt_map
    <ls_output> - Is structure type any that in the end should have all the data from <ls_itab> according to the mapping and the keys of the table
    <lt_itab> - table
    f1  f2  f3  f4  f5 f6
    1   2    3  4   5  6 
    5   5    4  3   8  4 
    6   9    2  5   3  5
    1   3    3  4   2  1
    lt_key  - table
    field_name   value
    f1            1
    f2            3
    lt_map  - table
    field_name
    f1
    f2
    f5
    f6
    <ls_output> - structure
    field  value
    f1  -   1
    f2  -   2
    f3  "Not in mapping so it's empty
    f4  "Not in mapping so it's empty
    f5  -   2
    f6  -   1
    <ls_output> have the field values of the last entry of <lt_itab> according to the key of f1 and f2 and according to the mapping f3 and f4 are empty
    since they are not appaer in lt_map
    Regards
    Joy

    Hi
    You have to loop fully your main table in order to get the records in according to they keys:
    LOOP AT <LT_ITAB> ASSIGNING <WT_ITAB>.
       L_KO = SPACE.
       LOOP AT LT_KEY.
            ASSIGN COMPONENT LT_KEY-FIELDNAME OF STRUCTURE <WT_ITAB> TO <FS_KEY>.
            IF <FS_KEY> NE LT_KEY-VALUE.
               L_KO = 'X'.
               EXIT.
            ENDIF.
        ENDLOOP.
        CHECK L_KO IS INITIAL.
        LOOP AT LT_MAP.
            ASSIGN COMPONENT LT_MAP-FIELDNAME OF STRUCTURE <WT_ITAB>      TO <FS_FROM>.
            ASSIGN COMPONENT LT_MAP-FIELDNAME OF STRUCTURE <WT_OUTPUT> TO <FS_TO>.
            <FS_TO> = <FS_FROM>.
        ENDLOOP.
        APPEND <WT_OUTPUT> TO <LT_OUTPUT>.
    ENDLOOP.
    Max

  • Using RTTI in table type any

    Hello,
    i have table type any and i want to know in the loop for every field which type he have ,for instance for field type Date8.
    what i the best way to do so , i guess that I need to use for instance cl_abap_elemdescr=>get_data_type_kind( <lv_field> ) but i dont know
    how to use it and check every field in the loop ...
    E.g.
    loop at <lt_fields> assigning <ls_fields>
    * check for every field in <ls_fields> which type he have and if the field is type date8
    * handle it diffrently
    endloop.
    Regards
    Joy

    You can use Absolute Name to get the absolute type from the type descriptor.
    DATA: lt_vbak TYPE STANDARD TABLE OF vbak.
    DATA: lo_struct   TYPE REF TO cl_abap_structdescr,
          lt_comp     TYPE cl_abap_structdescr=>component_table,
          la_comp     LIKE LINE OF lt_comp.
    lo_struct ?= cl_abap_typedescr=>describe_by_name( 'VBAK' ).
    lt_comp  = lo_struct->get_components( ).
    WRITE: /(30) 'Field' , (40) 'Absolute Type'.
    DATA: lv_abs_name TYPE string.
    LOOP AT lt_comp INTO la_comp.
      WRITE: /(30) la_comp-name, (40) la_comp-type->absolute_name.
    ENDLOOP.
    Regards,
    Naimesh Patel

  • Dynamic table type

    Hi folks,
    Is there any generic data type for table declaration, beside :
    data: lt_generic type table of data 
    I know that field-symbols can have the generic table type any
    field-symbols: <lft_generic> type any table. 
    I basically want to be able to read from generic tables.
    READ TABLE lt_generic .... 
    Thanks
    Andreas

    Hi Neil,
    actually i want to execute a read on the dynamic created tabel.
    Maybe this repot explains my purpose.
    REPORT  ztc_dqm_dynamic.
    * Step 1: << local definitions >>
    " << variables >>
    " << error string >>
    DATA: lv_error TYPE string.
    " << struc >>
    " << holds one component >>
    DATA: ls_component TYPE
          cl_abap_structdescr=>component.
    " << table >>
    DATA: lt_component TYPE cl_abap_structdescr=>component_table.
    DATA: lt_db_indexfields TYPE TABLE OF ztcc_dqm_indices.
    " << dynamic >>
    " << generated struc >>
    DATA: ls_dystruc TYPE REF TO data.
    " << generated table >>
    DATA: lt_dytable TYPE REF TO data.
    " << field symbols >>
    FIELD-SYMBOLS: <lfs_indexfields> TYPE ANY TABLE.
    FIELD-SYMBOLS: <lfs_indexfield> TYPE ANY.
    FIELD-SYMBOLS: <lfs_db_indexfields> TYPE ztcc_dqm_indices.
    " << objects >>
    DATA: lr_struc_type TYPE REF TO cl_abap_structdescr.
    DATA: lr_table_type TYPE REF TO cl_abap_tabledescr.
    " << exception >>
    DATA: lr_ex TYPE REF TO cx_sy_type_creation.
    * Step 2: << dynamic struc >>
    " << set struc fields >>
    SELECT *
      FROM ztcc_dqm_indices
        INTO TABLE lt_db_indexfields
          WHERE addr_type EQ 1
            ORDER BY index_order.
    " << get types >>
    LOOP AT lt_db_indexfields ASSIGNING <lfs_db_indexfields>.
      ls_component-name =
        <lfs_db_indexfields>-fieldname.
      ls_component-type ?=
         cl_abap_datadescr=>describe_by_name( <lfs_db_indexfields>-fieldtype ).
      APPEND ls_component TO lt_component.
    ENDLOOP.
    " << create struc >>
    TRY.
        CALL METHOD cl_abap_structdescr=>create
          EXPORTING
            p_components = lt_component
            p_strict     = abap_true
          RECEIVING
            p_result     = lr_struc_type.
      CATCH cx_sy_struct_creation INTO lr_ex.
        CALL METHOD lr_ex->if_message~get_text
          RECEIVING
            result = lv_error.
        WRITE: / lv_error.
    ENDTRY.
    " << create table >>
    TRY.
        CALL METHOD cl_abap_tabledescr=>create
          EXPORTING
            p_line_type        = lr_struc_type
    *        p_table_kind       = tablekind_std
    *        p_unique           = abap_false
    *        p_key              = p_key_kind
    *        keydefkind_default =
          RECEIVING
            p_result           = lr_table_type.
      CATCH cx_sy_table_creation INTO lr_ex.
        CALL METHOD lr_ex->if_message~get_text
          RECEIVING
            result = lv_error.
        WRITE: / lv_error.
    ENDTRY.
    " << create attributs >>
    CREATE DATA: ls_dystruc TYPE HANDLE lr_struc_type.
    CREATE DATA: lt_dytable TYPE HANDLE lr_table_type.
    * Step 3: << dynamic assignment >>
    ASSIGN lt_dytable->* TO <lfs_indexfields>.
    ASSIGN ls_dystruc->* TO <lfs_indexfield>.
    " << this works >>
    LOOP AT <lfs_indexfields> ASSIGNING <lfs_indexfield>.
    ENDLOOP.
    " << i want >>
    READ TABLE lt_dytable
      INTO ls_dystruc
        WITH KEY .....

  • Table types?

    Hi,
       What is the use of table types?In which situation we are using the standard table ,sorted table and hashed table?Any body explain with example.
    Regards,
    Srihitha

    Hi
    There are 3 types of internal tables.
    internal tables can be classified like below.
    INDEX NON-INDEX
    STANDARD and SORTED HASHED
    Standard and sorted use indeces while hashed will not use index.
    http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm
    declaration:
    TYPES: BEGIN OF TY_STUDENT,
    SNO TYPE I,
    SNAME(5),
    END OF TY_STUDENT.
    DATA: IT_STUDENT TYPE TABLE OF TY_STUDENT (STANDARD TABLE DECL)
    DATA: IT_STUDENT TYPE SORTED TABEL OF TY_STUDENT (SORTED)
    DATA: IT_STUDENT TYPE HASHED TABLE OF TY_STUDENT WITH KEY... (HASHED)
    TYPES - tabkind
    Syntax
    ... { {STANDARD TABLE}
    | {SORTED TABLE}
    | {HASHED TABLE}
    | {ANY TABLE}
    | {INDEX TABLE} } ... .
    Effect
    Definition of the table type in an internal table.
    You can specify the non-generic table types standard table ( STANDARD TABLE), sorted table ( SORTED TABLE), and hashed table (HASHED TABLE), as well as the generic table types ANY TABLE and INDEX TABLE. The addition STANDARD is optional for standard tables.
    The non-generic table types determine the internal administration and access type in the ABAP program for an internal table:
    Standard tables are managed system-internally by a logical index. New rows are either attached to the table or added at certain positions. The table key or the index identify individual rows.
    Sorted tables are managed by a logical index (like standard tables). The entries are listed in ascending order according to table key.
    Hashed tables are managed by a hash algorithm. There is no logical index. The entries are not ordered in the memory. The position of a row is calculated by specifying a key using a hash function.
    The generic table types define a generic table type that can only be used for typing formal parameters and field symbols:
    ANY TABLE includes all table types.
    INDEX TABLE includes all standard tables and sorted tables.
    Regards
    Lalit

  • Problem in passing select-options to class meathods , type any table

    <h1>how to pass type any table to class meathod</h1>
    <h3>hi all
           i'm trying to build class to validate the selection screen , like select-options and parameters
           while writing meathod to validate the select-options
           its throwing parameter mismath error</h3>
    <h4>i tried like made import parameter in class meathod as 'TYPE ANY TABLE' and tried to pass select-options from my program it is saying type mismatch , how to overcome this problem </h4>
    <h4>and i want to pass any select option , either of type lfa1-lifnr or mara-matnr or any other</h4>
    Moderator message : Don't shout, use proper font size for explaining the question. This has been discussed in ABAP forums before. Search for available information. Thread locked.
    Edited by: Vinod Kumar on Sep 14, 2011 11:20 AM

    hI
    Triggering and Handling events
    At the moment of implementation, a class defines its:
             Instance events (using the EVENTS statement)
            Static events (using the CLASS-EVENTS statement)
    Classes or their instances that receive a message when an event is triggered at runtime and want to react to this event define event handler methods. Statement: METHODS
    CLASS IC1_VEICHLE DEFINATION.
    PUBLIC SECTION.
    METHOD CONSTRUCTOR IMPORTING
    EVENTS VEICHEL_CREATION.
    ENDCLASS
    CLASS LC1_VEICHLE IMPLIMENTATION.
    METHOD CONSTRUCTOR
    RAISE EVENT VEICHLE_CREATION.
    REWARD IF USEFULL

  • Syntax Error with Table Parameter (type: ANY) when Creating Function Module

    Hello experts,
    I want to create a function module with a table parameter and table type is ANY. But when I check (Ctrl+F7) this function module, syntax error occurs - "In this statement, the internal table "MSG_TABLE_ITEM" must have the type "STANDARD TABLE"."
    Could anyone tell me what the wrong is? And how can I fix it?
    Thanks,
    Shelwin

    Hi,
    For table parameters, you can only pass
    MSG_TABLE_ITM   TYPE STANDARD TABLE
    or
    MSG_TABLE_ITM  ( don't fill other columns TYPING ASSOCIATED TYPE  ).
    For reference check FM 'GUI_UPLOAD' - Table parameters
    Regards,
    DPM

  • Modify Syntax on Internal table of type ANY TABLE

    Hi,
    I have declared one internal table which is of type ANY TABLE.
    In the Loop statement, I am trying to Modify that Internal table from WA.
    Then I am getting one Error message
    "You cannot use explicit or implicit index operations on tables with types "HASHED TABLE" or "ANY TABLE". "C_T_DATA" has the type "ANY TABLE".
    Above code I have placed in method of a corresponding Class.
    Can u please advise me on this..How to modify the Intenal table .
    Thanks and Regards,
    K.Krishna Chaitanya.

    Hi Krishna,
    the modify statement is obsolete.
    You can always LOOP AT [itab] ASSIGNING <field-symbol>.
    This makes the loop never slower, depending on the table structure faster or much faster.
    If you know the table structure at run time, you can use a field-symbol of that type. If not, you can use a field-symbol TYPE any. Then you have to assign the components to field-symbol to modify them, i.e.
    field-symbols:
      <table_line> type any,
      <matnr>        type mara-matnr.
    loop at itab assigning  <table_line>.
      assign component 'MATNR' of structure <table_line> to <matnr>.
      clear <matnr>.
    endloop.
    This technique (available more than ten years) works incredibly fast. My estimate is that if SAP would change all the old standard programs that way and use it consequently in the new ones, the whole system would be 20 % faster because myriads of unnecessary copy operations of LOOP INTO would not happen.
    Regards,
    Clemens.

  • Table with type ANY in function module

    Hi all
    I want to use a function module in different programs. I want to pass always a table and in a string the name of the structure, so that I can access the data with ASSIGN and the passed structure name.
    For a structure I can use the type ANY, but if I want to use a table in a function module, I need to define a table type.
    Is there a way to define a tabletype with the type ANY? A Workaround would be fine too.
    Thanks and best regards!
    Christian

    Hi Christian,
    ANY TABLE is used to type a parameter, or field symbol, that can be a table of any type or structure.
    ANY is used to type a parameter, or field symbol, that can be any type. You can't, however, use any table operations on a parameter/field-symbol typed as ANY. For that, you have to use ANY TABLE.
    The same applies to ANY. You can pass to the method a data object, without specifying its type (i.e, in dynamic programs).
    Suppose that I need to split a line into a table, but I don't know the structure of this line:
    I have a method:
    codeMETHOD split_line_in_table IMPORTING im_line TYPE ANY
    EXPORTING ex_table TYPE ANY TABLE.
    [/code]
    codeMETHOD split_line_in_table.
    SPLIT im_line AT separator INTO TABLE ex_table.
    ENDMETHOD.[/code]
    Now, i can pass this method a line of ANY structure and get a table without specifying its structure.
    cheers,
    Hema.

  • How to get type any table in function module... or something

    Moderator message: Please use a more informative subject in future, and NOT IN ALL CAPITALS.
    Hi experts,
    how to get type any table option.
    in source code.
    *"  CHANGING
    *"     REFERENCE(S_EKORG) TYPE  ANY TABLE OPTIONAL
    Thank you.
    Edited by: Matt on Feb 17, 2009 2:27 PM - subject edited

    In Function module...... Under changing tab, give the parameter name and type enter associated type any.... You would get that same in the source code and also choose Optional check box.....
    You will see exact code in the FM source code

  • What is the maximal line length of type any internal table

    Dear all,
    who can tell me what is the maximal line length of type any internal table.
    Thanks!

    There is no limit to the record length of an internal table.
    There is overall memory limit for every program (as setup by your basis). So, depending on the width of the ITAB, the number of records in ITAB is limited by the assigned memory.

  • SORT table of type ANY

    Hi,
        I've a internal table defined:
    DATA: <lt_result>  TYPE ANY TABLE.
    A table name is passed and its structure is assigned to it:
      CALL FUNCTION 'TREX_BUILD_COMP_DESCR'
        EXPORTING
          i_tabname    = lv_tabname
        IMPORTING
          e_comp_descr = lt_comp_descr[].
      lt_meta = cl_trex_table_meta=>create_by_comp_descr( lt_comp_descr ).
      lt_ref  = lt_meta->create_itab( ) .
      ls_ref = lt_meta->create_structure( ).
      ASSIGN lt_ref->* TO <lt_result>.
      ASSIGN ls_ref->* TO <ls_result>.
    After calling some function, i've the result table <lt_result> populated.
    Now, I want to sort it on a field of table.
    for example, i assiged to <lt_result>  structure of table ZCUST.
    ZCUST has a field guid_abc.
    I want to sort <lt_result> by guid_abc.
    How can i do it?
    Thanks,
    Rohit.

    Hi,
    SORT <lt_result> BY (COLUMN). " Use your column in brackets

  • Delete by index on type any table

    What is the alternative for the forbidden index operations on a fieldsymbol of type any table?
    I have a table under a fieldsymbol.. can be any table and I want to delete line 2.. how do I do it?
    e.g.
    ps_tabname is a parameter pointing to an internal table (unknown at design time)
    field-symbols: <fs_tab> type any table.
    assign (ps_tabname) to <fs_tab>.
    delete <fs_tab> index 2. -> not possible because of any table.. alternative?

    >
    Koenraad Janssens wrote:
    > field symbol as standard table does the trick... stupid me
    Hello,
    This explains why TYPE STANDARD TABLE solves your problem
    TYPE ANY TABLE --> Can contain any internal table (INDEX tables which can be either STANDARD or SORTED TABLE & HASH table). As already suggested index cannot be used on hash tables so it was giving you an error.
    TYPE INDEX TABLE --> A generic table will be created which allows index access unlike ANY TABLE. Refer: [http://help.sap.com/abapdocu_70/en/ABENINDEX_TABLE_GLOSRY.htm|http://help.sap.com/abapdocu_70/en/ABENINDEX_TABLE_GLOSRY.htm]
    BR,
    Suhas

  • Sporadically getting error "string or binary data would be truncated" in SQL server 2008 while inserting in a Table Type object

    I am facing a strange SQL exception:-
    The code flow is like this:
    .Net 4.0 --> Entity Framework --> SQL 2008 ( StoredProc --> Function {Exception})
    In the SQL Table-Valued Function, I am selecting a column (nvarchar(50)) from an existing table and (after some filtration using inner joins and where clauses) inserting the values in a Table Type Object having a column (nvarchar(50))
    This flow was working fine in SQL 2008 but now all of sudden the Insert into @TableType is throwing  "string or binary data would be truncated"  exception. 
    Insert Into @ObjTableType
    Select * From dbo.Table
    The max length of data in the source column is 24 but even then the insert statement into nvarchar temp column is failing.
    Moreover, the same issue started coming up few weeks back and I was unable to find the root cause, but back then it started working properly after few hours
    (issue reported at 10 AM EST and was automatically resolved post 8 PM EST). No refresh activity was performed on the database.
    This time however the issue is still coming up (even after 2 days) but is not coming up in every scenario. The data set, for which the error is thrown, is valid and every value in the function is fetched from existing tables. 
    Due to its sporadic nature, I am unable to recreate it now :( , but still unable to determine why it started coming up or how can i prevent such things to happen again.
    It is difficult to even explain the weirdness of this bug but any help or guidance in finding the root cause will be very helpful.
    I also Tried by using nvarchar(max) in the table type object but it didn't work.
    Here is a code similar to the function which I am using:
    BEGIN
    TRAN
    DECLARE @PID
    int = 483
    DECLARE @retExcludables
    TABLE
        PID
    int NOT
    NULL,
        ENumber
    nvarchar(50)
    NOT NULL,
        CNumber
    nvarchar(50)
    NOT NULL,
        AId
    uniqueidentifier NOT
    NULL
    declare @PSCount int;
    select @PSCount =
    count('x')
    from tblProjSur ps
    where ps.PID
    = @PID;
    if (@PSCount = 0)
    begin
    return;
    end;
    declare @ExcludableTempValue table (
            PID
    int,
            ENumber
    nvarchar(max),
            CNumber
    nvarchar(max),
            AId
    uniqueidentifier,
            SIds
    int,
            SCSymb
    nvarchar(10),
            SurCSymb
    nvarchar(10)
    with SurCSymbs as (
    select ps.PID,
                   ps.SIds,              
                   csl.CSymb
    from tblProjSur ps
                right
    outer join tblProjSurCSymb pscs
    on pscs.tblProjSurId
    = ps.tblProjSurId
    inner join CSymbLookup csl
    on csl.CSymbId
    = pscs.CSymbId 
    where ps.PID
    = @PID
        AssignedValues
    as (
    select psr.PID,
                   psr.ENumber,
                   psr.CNumber,
                   psmd.MetaDataValue
    as ClaimSymbol,
                   psau.UserId
    as AId,
                   psus.SIds
    from PSRow psr
    inner join PSMetadata psmd
    on psmd.PSRowId
    = psr.SampleRowId
    inner join MetaDataLookup mdl
    on mdl.MetaDataId
    = psmd.MetaDataId
    inner join PSAUser psau
    on psau.PSRowId
    = psr.SampleRowId
                inner
    join PSUserSur psus
    on psus.SampleAssignedUserId
    = psau.ProjectSampleUserId
    where psr.PID
    = @PID
    and mdl.MetaDataCommonName
    = 'CorrectValue'
    and psus.SIds
    in (select
    distinct SIds from SurCSymbs)         
        FullDetails
    as (
    select asurv.PID,
    Convert(NVarchar(50),asurv.ENumber)
    as ENumber,
    Convert(NVarchar(50),asurv.CNumber)
    as CNumber,
                   asurv.AId,
                   asurv.SIds,
                   asurv.CSymb
    as SCSymb,
                   scs.CSymb
    as SurCSymb
    from AssignedValues asurv
    left outer
    join SurCSymbs scs
    on    scs.PID
    = asurv.PID
    and scs.SIds
    = asurv.SIds
    and scs.CSymb
    = asurv.CSymb
    --Error is thrown at this statement
    insert into @ExcludableTempValue
    select *
    from FullDetails;
    with SurHavingSym as (   
    select distinct est.PID,
                            est.ENumber,
                            est.CNumber,
                            est.AId
    from @ExcludableTempValue est
    where est.SurCSymb
    is not
    null
    delete @ExcludableTempValue
    from @ExcludableTempValue est
    inner join SurHavingSym shs
    on    shs.PID
    = est.PID
    and shs.ENumber
    = est.ENumber
    and shs.CNumber
    = est.CNumber
    and shs.AId
    = est.AId;
    insert @retExcludables(PID, ENumber, CNumber, AId)
    select distinct est.PID,
    Convert(nvarchar(50),est.ENumber)
    ENumber,
    Convert(nvarchar(50),est.CNumber)
    CNumber,
                            est.AId      
    from @ExcludableTempValue est 
    RETURN
    ROLLBACK
    TRAN
    I have tried by converting the columns and also validated the input data set for any white spaces or special characters.
    For the same input data, it was working fine till yesterday but suddenly it started throwing the exception.

    Remember, the CTE isn't executing the SQL exactly in the order you read it as a human (don't get too picky about that statement, it's at least partly true enough to say it's partly true), nor are the line numbers or error messages easy to read: a mismatch
    in any of the joins along the way leading up to your insert could be the cause too.  I would suggest posting the table definition/DDL for:
    - PSMetadata, in particular PSRowID, but just post it all
    - tblProjectSur, in particularcolumns CSymbID and TblProjSurSurID
    - cSymbLookup, in particular column CSymbID
    - PSRow, in particular columns SampleRowID, PID,
    - PSAuser and PSUserSur, in particualr all the USERID and RowID columns
    - SurCSymbs, in particular colum SIDs
    Also, a diagnostic query along these lines, repeat for each of your tables, each of the columns used in joins leading up to your insert:
    Select count(asurv.sid) as count all
    , count(case when asurv.sid between 0 and 9999999999 then 1 else null end) as ctIsaNumber
    from SurvCsymb
    The sporadic nature would imply that the optimizer usually chooses one path to the data, but sometimes others, and the fact that it occurs during the insert could be irrelevant, any of the preceding joins could be the cause, not the data targeted to be inserted.

  • Dont work 'REUSE_ALV_FIELDCATALOG_MERGE' with table type

    Hi Experts ;
    My problem about   'REUSE_ALV_FIELDCATALOG_MERGE' .
    I use intarnal table with Table Type ( with header line ). And 'REUSE_ALV_FIELDCATALOG_MERGE'  is not working . Field catalog is employ. I dont use 'REUSE_ALV_FIELDCATALOG_MERGE' have any problem.

    'REUSE_ALV_FIELDCATALOG_MERGE' expects a flat structure.
    Give the reference of the line type of the table type if you wish to have fieldcatalog as per that..
    Even if you dont use 'REUSE_ALV_FIELDCATALOG_MERGE' you can create your own Fieldcatalog..

Maybe you are looking for