How to create a generic TYPES?

hello!
what i try to do is following
eg:
when i call my function the user has the possibility to check the flag "show_button = 'X', and exports a table
when this flag is checked i want to display an icon in the first row of this table, so i need to extend the table structure which i import and add another attribute.
what i actually tried to achieve is this (but this is not working of course)
function
import:
      i_outtab type standard table.
field-symbols:
      <itab> type standard table.
assign i_outtab to <itab>.
TYPES: begin of mytyp.
   types: i_bt type iconname.
  INCLUDE STRUCTURE <itab>
TYPES: end of mytyp.
and then i create a table with the type mytyp (which is not working, but i shows what i try to do)
so is there a way to do this genericly?

You can do that using the ABAP Run Time Type Services.
Example:
I have a function module Y_TEST with one Importing Parameter:
*"  IMPORTING
*"     REFERENCE(IP_IT_DATA) TYPE  ANY TABLE
I have no idea about the table-structure and I want to add a field X_SELECTED of type XFELD to the end of the table to display it using CL_SALV_TABLE or something - this is how I do it:
FUNCTION y_test.
*"  IMPORTING
*"     REFERENCE(IP_IT_DATA) TYPE  ANY TABLE
  DATA:
    gr_tabtype TYPE REF TO cl_abap_tabledescr,
    gr_struc   TYPE REF TO cl_abap_structdescr,
    lr_itab    TYPE REF TO data,
    it_component TYPE cl_abap_structdescr=>component_table,
    wa_component LIKE LINE OF it_component.
  FIELD-SYMBOLS:
    <wa> TYPE ANY.
* Reading 1st line of itab and getting structure ->
  LOOP AT ip_it_data ASSIGNING <wa>.
    gr_struc ?= cl_abap_typedescr=>describe_by_data( <wa> ).
    EXIT.
  ENDLOOP. "ip_it_data
* Getting all components ->
  CHECK gr_struc IS BOUND.
  it_component = gr_struc->get_components( ).
* Adding new field (X_SELECTED) to Component-Table ->
  wa_component-name = 'X_SELECTED'.
  wa_component-type ?= cl_abap_typedescr=>describe_by_name( 'XFELD ').
  INSERT wa_component INTO TABLE it_component.
* Creating new structure-ref ->
  CLEAR gr_struc.
      CALL METHOD cl_abap_structdescr=>create
        EXPORTING
          p_components = it_component
        RECEIVING
          p_result     = gr_struc.
* Creating new table-ref ->
      CALL METHOD cl_abap_tabledescr=>create
        EXPORTING
          p_line_type  = gr_struc
        RECEIVING
          p_result     = gr_tabtype.
* Creating itab with our table-ref ->
  CREATE DATA lr_itab TYPE HANDLE gr_tabtype.
ENDFUNCTION.
Hope that helped ...

Similar Messages

  • How to create the generic extractors in sap R/3?,pabitra

    Hi,
         How to create the generic extractors in sap R/3?
    Though it comes under cross application and the types of generic extractors are functional module ,db view,infoset query etc.Do u think the g.e can be built of one of the is types.plz tell correctly
    Advance thanks
    regards
    pabitra

    Hi,
    this is for DB view ,
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
    this is for infoset query,
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/cb43b2455611d189710000e8322d00/frameset.htm
    Good day,
    regards
    Arun

  • How to create a line type in data dictionary

    How to create a line type in data dictionary?Please explain step by step?
    Thanks & Regads,
    Sairam

    Hi,
    the details abbout the line type.
    The line type of a table type can be defined by:
    o Specification of a type that already exists (data element,
    structure, table type, table, view) whose properties are then copie
    as properties of the defined table line.
    o Direct type input, where data type, number of positions, and, if
    required, decimal places, are entered directly.
    o Specification of a reference type.
    and SE11 and click on datatype and click on table type and enter the line type.
    Thanks
    Shiva

  • How to create the sub type field in hr abap infotype

    hi ,
        how to create the sub type field in hr abap infotype.
    regards,
    venkat.

    Try like this also
    creating of infotype please follow these steps ...
    Step 1: Create Infotypes
    i. Goto Transaction PM01 – To create Infotypes:
    ii. Enter the Infotype Number and say create all.
    iii. The following message would display:
    i. PSnnnn Does not exist. How do you want to proceed?
    iv. Click
    v. A maintain Structure screen appears.
    Fill in the short text description and the PS structure of the Infotype.
    Since the fields Personnel No, Employee Begin Date, End Date, Sequential Number,Date of Last Change, Name of user who changed the object are available in the PAKEY and PSHD1 structure, define the PSnnnn structure with only the fields you required.
    vi. Once the PS Structure is created, save and activate the structure.
    vii. In the initial screen of PM01, now click on .
    Create a new entry for the infotype.
    Fill in the values as mentioned below and save.
    Infotype Characteristics:
    Infotype Name of the infotype_ Short Text: __Short Description________
    *General Attributes :
    Time constraint = 1
    Check Subtype Obligatory
    Display and Selection:
    Select w/ start = 3 “Valid record for entered data
    Select w/ end = 5 “Records with valid dates within the period entered
    Select w/o date = 6 “Read all records
    Screen header = 02 “Header ID
    Create w/o end = 1 “Default value is 31.12.9999
    Technical Data:
    Single screen = 2000
    List screen = 3000; List Entry Checked.
    viii. In the initial screen of PM01, now click on .
    Choose the infotype entry in the list.
    Fill in the values as mentioned below and save.
    Technical Attributes:
    In tab section,
    The following attribute values are given:
    Applicant DB Tab = PAnnnn “Infotype Name
    Subtype field = SUBTY
    Subtype table = T591A
    Subty.text tab. = T591S
    Time cnstr.tab. = T591A
    Prim. /Sec. = I Infotype
    Period/key date = I Interval
    and .
    ix. Infotype Screen Modification:
    Edit Screen 2000 from PM01 for the Infotype.
    ABAP Editor for the Infotype Program MPnnnn00 will be displayed.
    Click . Flow Logic will be displayed. There string coding of your own logic.
    Regards
    Pavan

  • How to create multiple Tree Type Region In Tabular Form ?

    Dear Friends,
    i have to design tabular form to Distribute User Rioght to emp to access application
    eg if i have Three module in application
    1.Administration
    2.Attendance
    3.Accounts
    Module
    1 Administration have 5 Pages A,B,C,D,E.
    Module
    2 Attendance HAVE 4 Pages F,G,H,I
    Module
    3 Accounts HAVE 7 Pages J,K,L,M,N,O,P
    I need these three module divided into three section in tabular form as a tree Type like
    Module 1 Tree Open in Tabular Form like
    - (Tree Mark Open )
    =======================================================
    PAGE_ID-------------SUBPAGE_ID-------VIEW-------------------MODIFY-------------------CREATE----------------------------TABLE COLUMN NAME
    ========================================================          
    Administration-----------A------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Administration-----------B------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Administration-----------C------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Administration-----------D------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Administration-----------E------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    - (Tree Mark Open )
    Module 2 Tree Open in Tabular Form like
    Attendance-----------F------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Attendance-----------G------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Attendance-----------H------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Attendance-----------I------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    - (Tree Mark Open )
    Module 3 Tree Open in Tabular Form like
    Accounts-------------J------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Accounts-------------K------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Accounts-------------L------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Accounts-------------M------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Accounts-------------N------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Accounts-------------O------------------CHECK bOX------------CHECK BOX-------------CHECK BOX
    Accounts-------------P------------------CHECK bOX------------CHECK BOX-------------CHECK BOXi need divided these three Module in Tabular form in three region as tree.
    Table APPLICATION_PAGE_DETAILS
    ID                   NUMBER
    PAGE_ID             NUMBER
    SUB_PAGE_ID          NUMBER
    ========================
    TABLE USER_RIGHT
    ======================
    ID                  NUMBER
    EMP_ID            NUMBER
    PAGE_ID            NUMBER
    SUB_PAGE_ID        NUMBER
    VIEW                    VARCHAR2(1)
    MODIFY                VARCHAR2(1)
    CREATE                VARCHAR2(1)How to create multiple Tree Type Region In Tabular Form ?
    How can i do this ?
    Thanks
    Edited by: Vedant on Oct 4, 2011 3:21 AM
    Edited by: Vedant on Oct 4, 2011 9:09 PM
    Edited by: Vedant on Oct 13, 2011 8:57 PM

    Well think of it I believe the scenario is too bird viewed hence the solution can't be exact.
    But thinking of a possible solution every time a child operation fails have a catch block where you you go back to system if the parent needs to be deleted if yes, call Delete Method on the parent.
    Note: Make sure that the decision on whether or not the parent record needs to be deleted will depends on the question "Does Parent Record already has several other children associated to it or not"
    Hope this clarifies.
    Regards,
    Messer

  • How to create a day type in Infotype 0041 (Want to maintain EE Retirement date)

    Dear Consultants,
    Can any buddy tell how to create a day type (Retirement date) in Infotype 41,
    My client want to maintain employees retirement date in Infotype 0041, please share your Ideas.
    Thanks & Regards,
    Navesh

    Hi Sridevi,
    Thanks for quick reply.
    Regards,
    Navesh

  • How to create external content type in sharepoint for salesforce account

    Can anybody help me on How to create external content type in sharepoint for salesforce account.
    I wanto upload documents to a document library which should sync with accounts in saleforce.
    thanks in advance

    Hi,
    The following materials would be helpful:
    Tutorial: Access Salesforce Leads in SharePoint through an External List
    http://geekswithblogs.net/dataintegration/archive/2014/02/03/tutorial-access-salesforce-leads-in-sharepoint-through-an-external-list.aspx
    Salesforce SharePoint Integration – Best Practices
    http://rainforce.walkme.com/salesforce-sharepoint-integration-best-practices/#.VFxra3mKAeE
    If you want to upload documents to SharePoint document library from the Saleforce, we can also customize your own web service using SharePont .Net Client Object Model or REST to achieve it.
    Best Regards 
    Dennis Guo
    TechNet Community Support

  • How to create Technical Wage types

    Hi to All,
    How to Create Technical Wage types, what are the pre-requisite information required for creating and how it works
    Bhaskar

    Hai..
    Pls come up with ur requirement......In order to copy tech wage types... u need to know the func of each series of tech wage types..
    •     0** – valuation
    •     /1** – cumulation
    •     /2** – averages
    •     /3** – country-specific, usually for social insurance
    •     /4** – country-specific, usually for tax
    •     /5** – legal net
    •     /700 – wage/salary plus ER shares
    •     /8** – period factoring
    •     /84* – cost accounting
    •     /A** – outgoing wage types in retroactive accounting period
    •     /Z** – incoming wage types from the previous period
    Now based on ur requirement u need to select a std tec wage type, and copy it in the customer range series

  • How to create Reference Condition Types

    Hi ,
                 Please tell me how to create Ref.Condition Types?
    I have a requirement.."I should create a Zdiscount(13%) which should be copied to the sales order automatically based on PR00"
    How to do that?
    Points for sure
    RamChandra

    Hi,
    You can use condition supplement functionality.
    Check the link [Condition Supplements|http://help.sap.com/saphelp_47x200/helpdata/en/93/7432de546011d1a7020000e829fd11/frameset.htm]
    You can also check the field RefConType for the discount condition type in SPRO -> Sales and distribution -> Basic functions ->Pricing -> Pricing control ->Define condition type.
    Regards,

  • How to create a curved-type cylinder

    We can create the basic geometries easily with J3DAPI , but how to create a curved-type geometry such as cylinder ?
    Searching for help ....
    Thanks a lot for giving any tips or information about it !

    With the idea of "Divide & Conquer" , I has a rough solution.
    Edited by: DragonWarrior_CHN on Mar 19, 2010 2:22 AM

  • How to create a generic method?

    Hi,
      I am using a std task TS01200205 to create instance for a BOR object. There are 2 key fields. I want to pass these 2 to the ObjectKey field.
    As for as I know, we have to concatenate these two Keyfields and assign it to 'Object Key' parameter.
      How can I concatenate the 2 strings in my Workflow? Is there any std way of doing it?
    Also what is a generic method? How to create it? Can I make use of generic method to achieve this?
    Thanks,
    Sivagami

    If you want to use it in different workflows the best solution is probably to define an interface and define and implement the method there (a nice thing about BOR interfaces is that you can provide an implementation and not just the definition).
    All you then need to do is let your object type(s) implement that interface, which only requires adding the interface since the implementation has been done already.
    However, I am not saying this is a good way of approaching things, I'm just telling you how you can implement what you suggest.

  • How to create a generic with iMovie for iPad?

    How do i create A generic with iMovie for iPad?

    luckyuis wrote:
    Hi All,
    > I have generated a report showing data for past 12 months and after that i need to include a chart showing Month on X axis with data for past 12 months ..for example if i run the report for June 2011 then on the chart it should take as june 11..>may 11..>april 11........so on june 10 with respect to other values
    >
    > fyi .. i am using type: Numeric Axis..> Date Axis line chart and created seperate formule on top of date field to get past 12 months data
    >
    > Please advise how can i do that on the chart
    >
    > Thanks much,
    > Lucky
    Once you pull the data, goup on the date monthly, most recent first ,and then graph the summaries in the group.

  • How to create a Generic Object Services for a standard tcode.

    Hi,
    We have a requirement where we are depreciating the assets (standard transaction ABAA) using a custom BDC program. We need to maintain a history (called audit trail) for the particular asset that has been depreciated using this program. For this audit train we have been asked to use "Generic Object Services" in transaction code ABAA.
    Unfortunately, Generic object services are not available in this transaction code. Can you please suggest me how to create "Generic Object Services" for a particular standard transaction code. Also, we have show the details of custom workflow that follows the approval process in order to depreciate the asset. how to show this workflow details using Generic Services. This is a very critical issue, any help will be very help ful.
    Please let me know should you require more information on this topic.
    Thanks,
    Ashish

    Instead of copyg the std fm to z, do the following,
    1. Go to se37 open FM VIEW_KURGV in display mode.
    2. Click on the spiral icon on the top.
    3. Then in menu go edit->enhancment options -> show implicit enhancement
    4. """""""""""""""""""""" kind of lines will appear in the cde, just rt click on the line at the place u want to insert the code and select
         enhancement implementation create.
    5. Give apropriate name for thi , it will inset a n place to write your code.
    This is an std sap methodology and is supported in upgradde also.

  • How to create a generic datasource from function module?

    Dear experts,
    I have created a generic datasource from function module. For this extrator, I created a function module and a structure.
    I have now some difficulties to continue:
    In this function module, i get data from different transparent tables. Then i put these data into an internal table.
    I just don't know what is the relatioin between the structure i defined and this internal table.
    I should make "iTab structure AA" in the source code?
    Thanks

    Hi..
    check this
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    1. Create s structure with the fields that you need from the 4 tables . Activate.
    2. Goto SE 80 Select The Function Group , Copy , Select the Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. SE37 ->Your Function module name -> Change , In table tab give your structure
    name by deleting the associated type given in " XXXX " .
    4. Now select source code and Do the coding . Give Data source name in Coding .
    In your case you have to take data from more that 1 table .
    5. Activate the Function Group .
    6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
    7. RSA3 -> Give data source name and Check for the Records .
    Creation of custom datasource. (Using function module)
    .Create a function group .
    . Structure ZTXXXX
    Create function module (i.e. ZTESTXXX) .
    . Create the data source using transaction (RSO2).
    . If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘        ’.
    Test the datasource in R/3 using transaction RSA3.
    Transfer the data source to BW –System and replicate it in the BW-System.
    Message was edited by:
            shiv

  • How to create new agent types  in transaction CBIH92.

    Hi guru's,
    Can anybody tell me how i can create new agent types .
    thanks and regards,
    Pronoy.

    Hi Pronoy
    Agent types are not created in CBIH92, those have to be created in IMG setting as per following path
    SPRO --> Environment, Health and Safety --> Industrial Hygiene and Safety --> Risk Assessment --> Specify Agent types
    Hope it will help you.
    Regards
    Vikram

Maybe you are looking for

  • Multiple Apple IDs and Family Sharing

    i am using the multiple Apple ID setup with an old pre-iCloud Apple ID for purchases (to keep my preexisting music) and a new Apple ID for my iCloud data and new email, etc. I am set up per the Apple support article on multiple Apple IDs. now the Fam

  • There are no shape tools showing up when I apply the fast blur effect.

    How do I fix this or work around?

  • Why can't Quicktime playback Muxed MPEG-2?

    When I get quicktime to playback a muxed MPEG-2 file there is no sound. Why does this happen? The description on version tracker says: The QuickTime 6 MPEG-2 Playback Component provides QuickTime 6 users with the ability to import and play back MPEG-

  • FTP Error - Mac, DW_CS6

    Due to upgrading my MAC from S.Leopard to M.Lion I've lost the use of DWmx04, a programme I have used for a long time, so thought instead of going through the stress of reinstalling S.Leopard I would embrace the change. So have downloaded the trial v

  • BEx Broadcaster BI7.0 - No Response

    Hello friends, I clicked in menu bar: QUERY --> Public --> BEx Broadscaster, but No response. System: BI DEV. Version: 7.0 Thanks for your help, Best Regards. PS.