SAP table field names

in program i want to pass sap table name and get all the fields of this table name.  how i can achieve this through abap program. table will be standard sap table and not internal table.

hi ,
enter the table name and get the fields..
REPORT  Z_DYNALV                                     .
*Type pools declaration for ALV
TYPE-POOLS: SLIS.   " ALV Global Types*data declaration for dynamic internal table and alv
DATA:     L_STRUCTURE   TYPE REF TO DATA,
          L_TABLE    TYPE REF TO DATA,
          STRUC_DESC   TYPE REF TO CL_ABAP_STRUCTDESCR,
          LT_LAYOUT   TYPE SLIS_LAYOUT_ALV,
          LS_LVC_FIELDCATALOGUE  TYPE LVC_S_FCAT,
          LT_LVC_FIELDCATALOGUE  TYPE LVC_T_FCAT,
          LS_FIELDCATALOGUE TYPE SLIS_FIELDCAT_ALV,
          LT_FIELDCATALOGUE TYPE SLIS_T_FIELDCAT_ALV.
*field symbols declaration
FIELD-SYMBOLS :
  <IT_TABLE>    TYPE STANDARD TABLE,
  <DYN_STR>         TYPE ANY,
  <STR_COMP> TYPE ABAP_COMPDESCR.
*declarations for grid title
DATA : T1(30),
       T2(10),
       T3(50).
*selection screen declaration for table input
PARAMETERS : P_TABLE LIKE DD02L-TABNAME.
*initialization event
INITIALIZATION.
*start of selection event
START-OF-SELECTION.
*texts for grid title
  T1 = 'Dynamic ALV display for table'.
  T2 = P_TABLE.  CONCATENATE T1 T2 INTO T3 SEPARATED BY SPACE.
Dynamic creation of a structure
  CREATE DATA L_STRUCTURE TYPE (P_TABLE).
  ASSIGN L_STRUCTURE->* TO <DYN_STR>.
Fields Structure
  STRUC_DESC ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <DYN_STR> ).
  LOOP AT STRUC_DESC->COMPONENTS ASSIGNING <STR_COMP>.
  Build Fieldcatalog
    LS_LVC_FIELDCATALOGUE-FIELDNAME = <STR_COMP>-NAME.
    LS_LVC_FIELDCATALOGUE-REF_TABLE = P_TABLE.
    APPEND LS_LVC_FIELDCATALOGUE TO LT_LVC_FIELDCATALOGUE.
  Build Fieldcatalog
    LS_FIELDCATALOGUE-FIELDNAME = <STR_COMP>-NAME.
    LS_FIELDCATALOGUE-REF_TABNAME = P_TABLE.
    APPEND LS_FIELDCATALOGUE TO LT_FIELDCATALOGUE.
  ENDLOOP.
Create internal table dynamic
  CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    EXPORTING
      IT_FIELDCATALOG = LT_LVC_FIELDCATALOGUE
    IMPORTING
      EP_TABLE        = L_TABLE.
      ASSIGN L_TABLE->* TO <IT_TABLE>.
Read data from the table selected.
  SELECT * FROM (P_TABLE)
    INTO CORRESPONDING FIELDS OF TABLE <IT_TABLE>.
ALV Layout
  LT_LAYOUT-ZEBRA = 'X'.
  LT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  LT_LAYOUT-WINDOW_TITLEBAR = T3.
*ALV  output
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      IS_LAYOUT     = LT_LAYOUT
      IT_FIELDCAT   = LT_FIELDCATALOGUE
    TABLES
      T_OUTTAB      = <IT_TABLE>
    EXCEPTIONS
      PROGRAM_ERROR = 1
      OTHERS        = 2.
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
regards,
venkat.

Similar Messages

  • Get Table fields name for an SAP table

    hi,
    i need to pass SAP table name as a parameter to the selection screen of a Report program.
    This prog shud give me the table Fields name along with type and length.
    Is there any standard SAP report program for the same or i have to write my own logic?
    Please advise.
    regards,
    ags.

    Hi,
    For your requirement you have to write own program in dynamic manner by using field symbol concept.
    Use this FM DDIF_FIELDINFO_GET and get the field information of database table.
      call function 'DDIF_FIELDINFO_GET'
        exporting
          tabname        = <master>    u201C Table name
        Tables   
          DFIES_TAB      = <table_field> u201C here you will get field information of table
        exceptions
          not_found      = 1
          internal_error = 2
          others         = 3.
      if sy-subrc <> 0.
        message  text-005 type 'E' .
      endif.
    Loop <table_field> assignigng <field>
    *---here you have to collect the relevant information that you are going to display in your output.
    Endloop.
    Use any one of ALV or OOALV and display your records.
    Regards,
    Peranandam

  • IDoc field and SAP Table field

    I want to find out which SAP table field is populating the given IDoc segment without getting into ABAP code? Do we have something like "Where-used" list? On the reverse side, If I want to know which SAP Table field the incoming IDoc segement is posting to, how do I do that? Thanks in advance.

    Hi,
    This is very difficult without going into the ABAP code. Some time it is easy like if you see IDOC MATMAS05
    Segment  E1MARAM = MARA
    Segment  E1MAKTM = MAKT
    Segment  E1MARCM = MARC
    etc.... also you can judge from the name of a segment.
    Thanks,
    Mandar

  • How to get the database table field names from program

    Hi,
    Can any one tell me,whether any function module is there which can get the table field name and its details ,when we pass database table name to it.
    Thanks in Advance
    <REMOVED BY MODERATOR>
    Regards
    Shibin
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:41 PM

    Hi,
    DD02L Table contains the SAP Tables.
    DD02T Table contains the SAP Table Texts.
    DD01L Table contains the Domains
    DD01T Table contains the Domain Texts.
    DD03L Table contains the Table Fields.
    DD03T Table contains the Table Field Texts. (Language Dependent)
    DD04L Table contains the Data Elements.
    DD04T Table contains the Data Element Texts.
    DD05s Table contains the Foreign Key Fields
    last words with L and T only. L->Database Fetch T-> Text
    For ur question use table DD03L or DD03T.
    Regards,
    Chandru

  • Creating a new Search Help on a standard SAP table field?

    Good day, everyone!
    As part of a report I am writing, the customer would like to have Search Help added to the AUFEX field in table AUFK.  They would like this functionality so that when they are changing an order via t-code ko02, they can get a list of valid values to put in field AUFEX.  I would like to tie it to a zTable I've created; in my zTable, I have just 2 fields:  a key value (that will go into AUFEX) and a text description of the key value.  This zTable is used in my report.
    While I've created a Search Help on this table already for table maintenance, I've never added a custom Search Help to an existing standard SAP table field before.  I've done some Googling and other searching to see what I need to know, but I've only been able to find information on Collective Search Helps.  AUFEX doesn't yet have a Search Help field, so I don't think Collective Search Helps is my answer.
    Is this possible?  Can I add a custom Search Help to a standard SAP table field that doesn't have any Search Help linked to it yet?  Is there an existing thread or guide somewhere that can tell me how to do this?
    Thank you!

    Hi
    Yes u can: u can assign the search help to (A) data element livel or (B) field table livel.
    After creating your search help:
    A) Run SE11, insert your data element (AUFEX), press edit and insert the search help in "Search Help" area on DEFINATION tab;
    B) Run SE11, insert your table (AUFK), press edit, place the cursor on your field (AUFEX) and go to GoTo->Search help->for field
    But u should consider it'll mean to change a standard object for both cases: so u need to get the access key from your OSS.
    Max

  • Authorization object to display table field names in english text in SE17

    Hi,
    One of users have issues with the filed name getting displayed in technical format instead of english text while browsing table information in SE17. Normally we can set this in through Settings->User Parameters. But here for this user, user parameter option is greyed out and he doesn't have access to SE16.
    Is there any other way to change user specific parameters, instead of granting him accesss to SE16 or enabling user parameters in SE17?
    Thanks,
    Mano

    Hi,
    I made him run SU53 on SE17 transaction the log is showing that authorization check failed for S_ALV_LAYO with value 23.
    Actually i have access SE16 and for me also, user parameter option is greyed out in SE17. I ran SU53 on SE17 in my session i also got same log.
    One more observation is, the user's colleague also doesn't have access to SE16 and user parameter option is greyed out in SE17 but he can view the table field names in english. So we are wondering if some authorization object is missing here.
    We do not want user to make any changes through GUI.
    Thanks,
    Mano.

  • Table & Field Name for Plan Data in CO

    Hi All,
    Can anyone tell me the table & field name where we can get the planned data in Cost Center Accounting and Profit Center Accounting.
    I checked out the COSP(which is Totals) and COEP tables for CCA but i could find the fields only for actual data and not planned data.
    Same for PCA...i checked out the GLPCT & GLPCA tables but in vain.
    Regards & Thanks
    Piyush Kothari.

    Hi,
    Thanks for the reply but COKL is only for Activity Type which contains Allocation Cost Elements.
    I would like to have the Table & Field name for Plan data of Primary Cost Element.
    Piyush

  • Table field name

    Hi
    Good afternoon to all ,
    can any one tell me the table fields name for
    1. bill amount : ?
    2. tds : ?
    3>passed amount : ?
    transaction use is mir7 .
    Regards
    Rakesh kumar singh

    Use transaction ST05 and run an SQL trace when running this transaction.
    It is what I would do if I needed to know this information, instead of coming on here and getting someone else to tell me.

  • What  balance value  in sales order  and iwant to know table field name in

    where the balance value come in sales order i want make sales order report in which i want to add this filed how we add it  and tell me table field name of balance vlue and how we give it in FS please help me in this my report are left without it please give me solution

    Hello
    where the balance value come in sales order
    Please note that when you raise your question at SDN forum, your question needs to be clear...
    What do you mean by BALANCE VALUE ????
    Regards,
    Sarthak

  • Table & field name related to credit

    Hi experts,
    Are the tables/field names below are correct?
    If yes, what reasons would be for the field of sales value shows zero in SE16 while the field shows correct amount in FD33?
    If not, pls provide the correct table & field name for credit exposure & sales value. Thx.
    Table KNKK - SKFOR = credit exposure
    Table KNKK - SAUFT = Sales value.

    Hi
    You are looking the right table
    However field KNKK - SAUFT = Sales value, displays the Total of all order values which have not been transferred to FI, but which are taken into consideration when checking the credit limit.
    You can check following fields
    Table KNKK - KLIMK = Credit LIMIT
    Table KNKK - SKFOR = Credit Exposure (i.e Total Receivables)
    Check for the values appearing against  Receivables field (skfor) on the customer credit management : status page (FD33).
    Regards
    Tejpal

  • TABLE-FIELD NAME FOR AGENT (SALES ORDER)

    HI
    I am making despatch report agent wise .
    Can any one tell me the table-field name for agent it is used in saleorder
    t.code va01 .
    Regards
    Rakesh Kumar Singh

    Whereever you can see that Input Field for Agent..Click F1, click Technical Information..You can see the Table and Data Element and Field Name..
    Incase it is a structure, click on the data element..click Where Used List..You will get a list of tables.

  • Using table field name as a variable

    Hi ,
    Is it possible to map some values to a field in a Ztable , if I have the field name of the Ztable in a variable.
    For ex:
    I have a ZTABLE -- which has some fields - ZF1 and ZF2.
    In my code, I determine the field in which I want to put data at runtime. For ex, in my code i determine at runtime I want to update field ZF2 , but I have this field name in a variable <V_FIELDNAME>
    So, Is it possible to do something as:
    <V_FIELDNAME> = ZF2.
    ZTABLE-<V_FIELDNAME>    =    <VARIABLE -SOME VALUE>.
    and this value should actually maps to ZTABLE-ZF2.
    If it is possible , how to do it ?
    Thanks-

    Hi Tamas,
    Thanks a lot for ur post ! it did certainly help. However, I need some more help.
    Here is what I need -
    I will have a string coming up from an interface which would be something like : Val1;Val2;Val3
    And in SAP R/3 I have a variable maintained as : Field1;Field2;Field3
    Field1 Field2 and Field3 are fields of a ZTABLE.
    So , at runtime, using the variable I have to determine which Value goes to which field and then insert this field in ZTABLE.
    So, ultimately , code should perform the following actions:
    ZTABLE-FIELD1 = Val1
    ZTABLE-FIELD2 = Val2
    ZTABLE-FIELD3 = Val3
    Insert ZTABLE.
    Going by code you provided, I can assign individual values, But then ultimately I need to map it to a structure which can be used to insert in a DB table. How can I do this?
    Thanks-

  • Wanted Table & Field Names.

    hi All,
              i am preparing a ageing report, my requirement is to get the
    amount as
    total outstanding as on date  and
    toal outstanding as on due date.
    please tell me the table and field names and also based on what field i need to get the amout to these fields.
    thanks,
    srikanth.

    Hi Srikanth,
    This info is available on standard SAP reports.  If you are the developer (as your name suggests), then I would go back to your business / functional analyst and ask them to prepare a proper spec for you if they don't feel that the standard reports fit their needs.
    Regards,
    Tony

  • Tables & field names used in PS?

    Hi ALL
    I need all the Tables and fields names that are used in PS.If anyone provide it then it will be of great help.
    Thanks in advance

    Hi,
    refer below link
    https://forums.sdn.sap.com/click.jspa?searchID=26790042&messageID=7548930
    Regards,
    Sandeep

  • Copying Batch Characteristics Value from Standard SAP Table Field

    Dear Experts,
    1. While creating a user-defined Batch Characteristics 'CREATED_BY' using ct04,  on the Additional Data tab, I filled  the following fields as follows:  Table Name = MCHA,  Field Name =ERNAM.
    'CREATED_BY' was then assigned to a batch Class TRIMMED (of class type 022).
    TRIMMED  was assigned to a batch managed material ADE245DD.     
    After posting co15 (confirmation of production order) for material ADE245DD, the value in table MCHA & field ERNAM is automatically copied into the Batch Characteristics value field of u2018CREATED_BYu2019  for the generated batch.
    2. But I am unable to achieve the same result when I create another Batch Characteristic with similar settings in the Additional Data tab as follows: Table Name = MARC, Field Name = DISPO.
    After doing co15, the value stored in table MARC and field DISPO does not get copied into the Batch Characteristics value.
    Please what do I need to do in Scenario 2 above to achieve the same result as in Scenario1?
    Regards

    Hi,
    Table and field used in additional data table should be related to the object than only it will work, for e.g. MCHA and ERDAT will work if you create a characteristcis and assign it to class type Batch (022/023) because MCHA table has Batch no. as primary key,
    this implies for using material specific table e.g. MARA , you should use characteristics with class type 001 (Material class) , try using with table MARC also
    Cheers
    Dheeraj

Maybe you are looking for

  • InfoSet in SAP BI 7.10 and Key figure aggregation

    HI SAP Gurus, I am new in SAP BI area. I have my first problem. I want to create a report for the profit of goods.  The cost of goods(cogs) are constant for each material for one month. The formula to calculate the profit of goods = sales turn over u

  • After HUGE document, Pages will not launch

    I've been helping someone build up a big "photo-book" in Pages. We've scanned 700+ hi-resolution (300 dpi) images and filled a Pages document to the tune of 106 pages. The document itself is now 3.17 GB. Ouch! (This is all happening on an iMac with 4

  • How do I get the Harry Potter books to upload across all my devices?

    Hi everyone, I recently purchased and downloaded the Harry Potter ebooks from the Pottermore shop and put them on my iBooks on my iMac.  I noticed right away that they didn't appear on either my iPad or iPhone when I openned up the iBooks app on ther

  • Converting forms from  9.0.4 to 10.1.2.0.2.

    converting forms from 9.0.4 to 10.1.2.0.2. when opening the forms in 10.1.2.0.2 libraries are also loaded along with forms and i'm able to compile. But when running the form FRM-40735 ON-ERROR trigger raised unhandled exception ORA-06508. (In 9.0.4 i

  • Stock transfer between two plants within same company code at price

    Hello, Hello I have a scenarios. One plant is selling a part to other plant at a margin. Both plants belongs to the same legal entity. How can I map this scenario in SAP? What will be the cost of my part in these two plants? What mechanism I would us