Displaying the contents of internal table- in email Step of workflows

Hello Folks,
I wanted to display the contents of an internal table ( would contain a list of opportunites ), in an email sent throught the workflow:
My idea was to LOOP AT <ITAB> into <WA> from an external program and then call the workflow for each content of the <WA>. This will be a problem as, if there are like 1000 records in the internal table, then workflows will be called 1000 times...sending 1000 emails..
My requirement is that we need to send a single email to the single person, displaying the content of the internal table in the email body......
My question
1) Is this scenario possible through worflows ?
2) If not, please provide an alternative ..
Thanks
Anand

Do you mean to say that just by inserting the multiline element
within the body of the 'Send email' step type, the contents
of the multiline element is displayed automatically without
we having to loop at it somehow ?
Follow the below apporach,
1. First create a multiline container element in the workflow conatiner.
2. Populate the internla table , by using the bor methods and pass back the populated ITAB to the WF by using the binding concept.
3. Now create a mail step in the workflow, you have the option of inserting the workflow container elements into the mail conten, so insert the multiline container element , then it prompts to select the option like a) Do you liek to display only first line b) Display the ITAB line by line c) Display ITAB lines continuously with out line break.
4. based upon the requirement select any one of the options.
Note: Make sure the line length of the ITAB won't excced 132 charecters, because the send mail step will consider only 132 characters.

Similar Messages

  • Exporting to excel erases the contents of internal tables

    Hi All,
    I am creating a BSP application wherein i am exporting the data from my
    BSP pages to the excel sheet using oninputprocessing event.
    The issue is when i open the excel, it opens it in a separate url but after opening the
    excel when i try to navigate to the other page, the contents of the other page gets erased.
    and once i refresh the page from which i am opening the excel, the contents of this page also disappears.
    so basically its clearing the contents of all my internal tables.
    I tried creating different set of internal tables for excel use, but the issue still exists.
    Could anybody please help me with this issue.
    With Regards,
    Mahima.

    In my opinion, after you are opening the window with export to excel you are creating new session, then all of your application data is initialized and you have an application like it would be newly started. The reason is improper link or so...

  • To display the contents of the table in sf

    HI,
    I have a requirement to display the contents of the table on the smart form main window.
    Like there is a dic table containing 8 rows . i would like to to display all the 8 rows on a smartform main window.
    Help me how to solve this,

    Hi,
    Kindly follow the below steps,
      Go with a transaction code : smartforms
       Enter the form name like : ysma_forms1 and create with proper description
       From the left side window there will be a form interface to provide table .....
       Go for tables option
       table_name like table_name(ref.type)
       Pages and window-> page1-> main window
       Go to the form painter adjust the main window.
      Select main window and right click --> go for create loop
      Name: loop1, desc: display loop.
    Internal table ktab into ktab.
    select loop right click -> create a text
    name  : text1,  desc: display text.
    Go to change editor.
    Write the mater what ever you want and if you want to display data from the table write the table fields as follows:
    &ktab-<field1>&    &ktab-<field2>&
    save  & activate then execute ,, scripts will generate a function module  like : '/ibcdw/sf0000031' copy this function module and call in executable program...
    For that
    1.  go with abap editor se38.
    2.  table: tablename.
    3.  parameters: test like tablename-<field1>.
    4.  data itab like tablename occurs 0 with header line.
    5.  select * from tablename into table itab where field1 = test1.
    6.  call function '/ibcdw/sf0000031'
    7.  tables
         ktab = itab.
    Save and activate the program ( ^f 3).
    Now run the program ( f 8)
    Hope this will help you
    Regards,
    Vijay Duvvada

  • How to display the contents of a 2D array which is bound to a data table

    Hi ,
    I have a backing bean which returns me a 2D array of Strings . Now I have bound this to a data table .
    Something like this
    <h:dataTable styleClass="dataTable" id="dstable" var="dbArray" value="#{pc_MyApp.dbProperties}">
    Now when I say dbArray[i] it will give me the ith column of the current row. I want to display these dbArray[i] contents in a proper table format.
    What I am doing at present is something like this
    <h:dataTable styleClass="dataTable" id="dstable" var="dbArray" value="#{pc_MyApp.dbProperties}">
    <h:column id=id1>
    <h:facet name="header">
    <h:outputText value="Heading"/>
    </h:facet>
    <h:outputText id="text1" value="#{dbArray[0]}" ></h:outputText>
    <h:outputText id="text1" value="#{dbArray[1]}" ></h:outputText>
    <h:outputText id="text1" value="#{dbArray[2]}" ></h:outputText>
    </h:column>
    </h:dataTable>
    This is able to display the contents of 2D array on the screen, but everything for the current row comes in just a single column...I want each column value to be in diff column and it should look like a table.
    Can anyone please guide me in this respect..
    Thanks
    Mahajan

    Does doArray always have at most three elements?
    If so, you can specify three <h:column>s each displays doArray.

  • Multiline table container element does not display the contents

    Hi Guys,
    I am sending an email from the workflow. The workflow has few steps and in one of the steps the the workflow brings in few lines of text. This text is then stored in a multiline container element in the workflow.
    later in the workflow i am sending an email and this sendmail step is using the multiline containter. So in the body of the email i have used the container as shown below
    Your expense for the trip &TRIPEXP.TRIPNUMBER& has been rejected.
    The Reason for rejection(s) mentioned below:
    &CATSXT_LONGTEXT_ITAB##&
    Please change and submit again.
    However when i recieve the email i dont see any text. But when i look at the workflow log and check the contents of this table under the workflow container elements it has the data in it.
    Not sure where i am going wrong. I have checked the bindings and they are fine.

    Thanks Arghadip,
    Yes that was the missing link.
    One question:
    When i use sendmail step and use the variable drop down box i can see the workflow container elements. So why do i need the same container element in the sendmail setp? I just now created same element in the sendmail task. When i am able to access the workflow container elements in the send mail step then why there is a need to create a same container element in the send mail step and then do the binding for it to work?

  • How to display the contents of java.util.list in a frame???

    i should use awt only not applet...
    i need to display the contents of java.util.list in a frame...
    the contents contains rows queried from a oracle database.....
    the contents should be displayed similar to how a lable is displayed..
    please help me out..
    thanks
    dinesh

    Of course there is something in AWT:
    http://java.sun.com/j2se/1.5.0/docs/api/java/awt/List.
    htmlagain, if you carefully read the question, he needs a
    table to display a JDBC result set. There is no
    pre-made table component in AWT.Well, I read that he filled the data into a java.util.List and now wants to display this list. So a List-component should be sufficient. But I might be wrong...
    -Puce

  • How to display the contents of a document set on a page?

    I want to display the contents of a document set (that contains both folders and files) on a page (with the same structure as they are in the document set like folders and files). How to achieve this?
    I tried content search webpart but it is of no use as it displays the flat list instead I need folders and files as they are present in the document set
    I tried document set contents webpart but as it doesn't accept any connection, it is not of much use.
    I will be glad if you have any pointers for me in this regard.
    Regards
    Kesava

    Hi Kesava,
    According to your description, you might want to display the content in a document set with its hierarchy.
    How about using
    Page Viewer Web Part to display the page of the corresponding document set? This would be a non-code solution I would recommend.
    More information about Page Viewer Web Part:
    https://support.office.com/en-nz/article/Page-Viewer-Web-Part-e364436c-0ec4-4819-acac-1982b3525531
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • How to display the content of a BLOB column in a ADF/BC pages ?

    How to display the content of a BLOB column in a ADF/BC pages ?
    There is some image in database table blog column. And we want to display image on the screeen.
    There is some example about upload and dowload blog columns.
    (steve not yet document example page etc...)
    But We want to display blog picture in a image component...
    is there any basic way to do it ?
    Thanks a lot...

    Ali,
    You could just download the sample app... but... here is the servlet code from the demo (look at it just for technique - you'll obviously have to change it for your needs)...
    John
    package oracle.fodemo.storefront.servlet;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.Key;
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    import oracle.jbo.client.Configuration;
    import oracle.jbo.domain.BlobDomain;
    import oracle.jbo.domain.DBSequence;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.ViewObjectImpl;
    public class ImageServlet
      extends HttpServlet
      private static final String CONTENT_TYPE =
        "image/jpg; charset=windows-1252";
      public void init(ServletConfig config)
        throws ServletException
        super.init(config);
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
        throws ServletException, IOException
        response.setContentType(CONTENT_TYPE);
        response.setContentType(CONTENT_TYPE);
        String detailProductId = request.getParameter("detail");
        String thumbnailProductId = request.getParameter("thumbnail");
        boolean thumbnail = true;
        String productId = null;
        OutputStream os = response.getOutputStream();
        String amDef = "oracle.fodemo.storefront.store.service.StoreServiceAM";
        String config = "StoreServiceAMLocal";
        ApplicationModule am =
          Configuration.createRootApplicationModule(amDef, config);
        ViewObjectImpl vo =
          (ViewObjectImpl) am.findViewObject("ProductImages"); // get view object (the same as used in the table)
        if (detailProductId != null)
          productId = detailProductId;
          thumbnail = false;
        else
          productId = thumbnailProductId;
        vo.defineNamedWhereClauseParam("paramThumbnail", null, null);
        vo.defineNamedWhereClauseParam("paramProductId", null, null);
        vo.setWhereClause("DEFAULT_VIEW_FLAG = :paramThumbnail AND PRODUCT_ID = :paramProductId");
        vo.setNamedWhereClauseParam("paramThumbnail", (thumbnail? "Y": "N"));
        vo.setNamedWhereClauseParam("paramProductId", productId);
        vo.executeQuery();
        Row product = vo.first();
        BlobDomain image = (BlobDomain) product.getAttribute("Image");
        InputStream is = image.getInputStream();
        // copy blob to output
        byte[] buffer = new byte[10 * 1024];
        int nread;
        while ((nread = is.read(buffer)) != -1)
          os.write(buffer, 0, nread);
        os.close();
        vo.setWhereClause(null);
        vo.removeNamedWhereClauseParam("paramProductId");
        vo.removeNamedWhereClauseParam("paramThumbnail");
        Configuration.releaseRootApplicationModule(am, false);
    }

  • OO  ALV  displaying  without  Values  despite Internal  table contains

    My   below  OO  ALV  displaying  without  Values  despite Internal  table contains  the values ...
    Help  please ...
    REPORT zsd_concession1  NO STANDARD PAGE HEADING
                            LINE-SIZE 285
                            LINE-COUNT 64
                            MESSAGE-ID zz.
    Program Description ******************************
    This report is to Calculate consession against Quotations
    complying  standards for enhanced Performance, Readability &
    Maintenance.
    Change Log *********************************
    Remedy # /       Who       When        Why / What
    Transport #
    CLASS lcl_event_handler DEFINITION DEFERRED.
    *&      Data Definitions .
    DATA: BEGIN OF vbap_wa,
                vbeln               TYPE  vbak-vbeln,           "Quotation#
                erdat               TYPE  vbak-erdat,           "Quot date
                knumv               TYPE  vbak-knumv,           "Cond Rec#
                posnr               TYPE  vbap-posnr,           "Line Item
                matnr               TYPE  vbap-matnr,           "Mat#
                zansicat            TYPE  zmarall-zansicat,     "AnsiCat#
                zansigrd            TYPE  zmarall-zansigrd,     "Grade
                zcurrvaltnarea      TYPE  zco002-zcurrvaltnarea,"Val Area
                zcurrcstusd         TYPE  zco002-zcurrcstusd,   "Cost$
                zzbrndnm            TYPE  mara-zzbrndnm,        "Brand
                zqedscgrp           TYPE  zglbprc-zqedscgrp, "QE Disc Grp
                mstav               TYPE  mara-mstav,        "Status
                kwmeng              TYPE  vbap-kwmeng,       "Qty
                lprc                TYPE  konv-kbetr,  "List Price ZBP1
                sprc                TYPE  konv-kbetr,  "Std Pric ZNAA,ZNAX
                netpr               TYPE  vbap-netpr,  "Quot price
                mrgn                TYPE  konv-kbetr,  "margin%
           END   OF vbap_wa,
           BEGIN OF konv_wa,
                knumv               TYPE  konv-knumv,  "Cond#
                kposn               TYPE  konv-kposn,  "Cond Item#
                kappl               TYPE  konv-kappl,  "Applic
                kschl               TYPE  konv-kschl,  "Cond Typ
                kbetr               TYPE  konv-kbetr,  "Price ZBP1,ZNAA,ZNAX
           END   OF  konv_wa,
           BEGIN OF vbpa_wa,
                vbeln               TYPE  vbpa-vbeln,  "Quot#
                posnr               TYPE  vbpa-posnr,  "Item#
                parvw               TYPE  vbpa-parvw,  "Prt Fn
                kunnr               TYPE  vbpa-kunnr,  "Cust#
           END   OF  vbpa_wa,
           BEGIN OF result_wa,
                posnr               TYPE  vbap-posnr,           "Line Item
                matnr               TYPE  vbap-matnr,           "Mat#
                zansicat            TYPE  zmarall-zansicat,     "AnsiCat#
                zansigrd            TYPE  zmarall-zansigrd,     "Grade
                zcurrvaltnarea      TYPE  zco002-zcurrvaltnarea,"Val Area
                zcurrcstusd         TYPE  zco002-zcurrcstusd,   "Cost$
                zzbrndnm            TYPE  mara-zzbrndnm,        "Brand
                zqedscgrp           TYPE  zglbprc-zqedscgrp, "QE Disc Grp
                mstav               TYPE  mara-mstav,        "Status
                kwmeng              TYPE  vbap-kwmeng,       "Qty
                lprc                TYPE  konv-kbetr,  "List Price ZBP1
                sprc                TYPE  konv-kbetr,  "Std Pric ZNAA,ZNAX
                netpr               TYPE  vbap-netpr,  "Quot price
                mrgn                TYPE  konv-kbetr,  "margin%
           END   OF result_wa.
    DATA: ikonv      LIKE  STANDARD TABLE OF konv_wa,
          ivbap      LIKE  STANDARD TABLE OF vbap_wa,
          ivbpa      LIKE  STANDARD TABLE OF vbpa_wa,
          iresult    LIKE  STANDARD TABLE OF result_wa.
    *Work storage
    DATA: BEGIN OF ws,
             vbeln       TYPE vbak-vbeln,
             ok_code     TYPE sy-ucomm,
             alv_save    TYPE c,   "ALV save
             alv_variant TYPE disvariant, "ALV Variant
             alv_sort    TYPE lvc_t_sort, "Sort table
          END  OF ws.
    *Data declarations for ALV Main list
    DATA : ty_lay1        TYPE        lvc_s_layo,
           it_fieldcat    TYPE        lvc_t_fcat ,
           ty_fieldcat    TYPE        lvc_s_fcat ,
           l_smenu        TYPE REF TO cl_ctmenu,
           c_alv1         TYPE REF TO cl_gui_alv_grid,
           c_cont1        TYPE REF TO cl_gui_custom_container,
           e_dclick       TYPE REF TO lcl_event_handler.
    *Data declarations for ALV Interactive list
    DATA : ty_lay2        TYPE        lvc_s_layo,
           it_fcat        TYPE        lvc_t_fcat ,
           ty_fcat        TYPE        lvc_s_fcat ,
           c_alv2         TYPE REF TO cl_gui_alv_grid,
           c_cont2        TYPE REF TO cl_gui_custom_container.
    *Field-Symbols
    FIELD-SYMBOLS:
          <konv>  LIKE   konv_wa,
          <vbap> LIKE   vbap_wa.
    *Constants
    CONSTANTS:
          c_end_row    TYPE  i  VALUE  65000.
    *CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
         handle_double_click
         FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
    ENDCLASS. "lcl_event_handler DEFINITION
    *CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_double_click.
        DATA: sec_wa LIKE LINE OF iresult.
    *Reading the selected data into a variable
        READ TABLE iresult INDEX e_row-index INTO sec_wa.
    *Select the field details of the selected table
    SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
    WHERE tabname EQ ls_dd02l-tabname.
    *Calling the ALV containing the field values
        CALL SCREEN 101.
      ENDMETHOD. "handle_double_click
    ENDCLASS. "lcl_event_handler IMPLEMENTATION
    *&      SELECTION-SCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE  text-001.
    SELECT-OPTIONS:
        s_vbeln  FOR  ws-vbeln DEFAULT '2002354788' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK a.
    INITIALIZATION.
      PERFORM setup_screen_defaults.
    START-OF-SELECTION.
      PERFORM gather_report_data.
    END-OF-SELECTION.
      PERFORM create_output.
    *&      Form  initialization
    FORM setup_screen_defaults.
      CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
      REFRESH: ivbpa, ikonv, ivbap, iresult.
    ENDFORM.                    " setup_screen_defaults
    *&      Form  gather_report_data
    FORM  gather_report_data.
      SELECT  vbeln posnr parvw kunnr
               INTO TABLE ivbpa
               FROM vbpa
               WHERE vbeln IN s_vbeln
               AND ( parvw = 'SP' OR "SoldTO
                     parvw = 'WE' OR "ShipTo
                     parvw = 'ZT' ). "Top Parent
      SELECT  vkvbeln vkerdat vkknumv vpposnr vp~matnr
              z1zansicat z1zansigrd z2~zcurrvaltnarea
              z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
              m1mstav  vpkwmeng  vp~netpr
        INTO CORRESPONDING FIELDS OF TABLE ivbap
        FROM  vbak  AS vk
        INNER JOIN vbap AS vp
           ON vpvbeln = vkvbeln
        INNER JOIN zmarall AS z1
           ON z1matnr = vpmatnr
        INNER JOIN zco002 AS z2
           ON z2matnr = vpmatnr
        INNER JOIN zglbprc AS zg
           ON zgmatnr = vpmatnr
        INNER JOIN mara AS m1
           ON m1matnr = vpmatnr
        WHERE  vk~vbeln IN s_vbeln
        AND    vk~auart = 'AG'."AG = Quot
      SORT ivbap BY posnr matnr.
      SELECT  kvknumv kvkposn kvkappl kvkschl kv~kbetr
              INTO TABLE ikonv
              FROM  konv AS kv
              FOR ALL ENTRIES IN ivbap
              WHERE  kv~knumv = ivbap-knumv
              AND    kv~kposn = ivbap-posnr
              AND    kv~kappl EQ 'V'
              AND    ( kv~kschl EQ 'ZBP1'
                   OR kv~kschl EQ 'ZNAX'
                   OR kv~kschl EQ 'ZNAA' ).
      SORT ikonv BY knumv kposn.
      LOOP AT  ivbap  ASSIGNING  <vbap>.
        CLEAR konv_wa.
        READ TABLE ikonv INTO  konv_wa WITH KEY
                                   knumv = <vbap>-knumv
                                   kposn = <vbap>-posnr
                                   kschl = 'ZBP1'
                                   BINARY  SEARCH.
        IF sy-subrc EQ 0.
          <vbap>-lprc = konv_wa-kbetr.
        ENDIF.
        READ TABLE ikonv INTO  konv_wa WITH KEY
                                   knumv = <vbap>-knumv
                                   kposn = <vbap>-posnr
                                   kschl = 'ZNAX'
                                   BINARY  SEARCH.
        IF sy-subrc EQ 0.
          <vbap>-sprc = konv_wa-kbetr.
        ENDIF.
        READ TABLE ikonv INTO  konv_wa WITH KEY
                                   knumv = <vbap>-knumv
                                   kposn = <vbap>-posnr
                                   kschl = 'ZNAA'
                                   BINARY  SEARCH.
        IF sy-subrc EQ 0.
          <vbap>-sprc = konv_wa-kbetr.
        ENDIF.
      ENDLOOP.
      SORT ivbap BY posnr matnr.
      LOOP AT ivbap INTO vbap_wa.
        MOVE-CORRESPONDING  vbap_wa TO result_wa.
        APPEND  result_wa TO iresult.
        CLEAR:  vbap_wa, result_wa.
      ENDLOOP.
    ENDFORM.                    " gather_report_data
    *&      Form  create_output
    FORM create_output.
      CALL SCREEN 100.
    FREE: iresult.
    ENDFORM.                    " create_output
    *&      Module  PBO_0100  OUTPUT
          text
    MODULE pbo_0100 OUTPUT.
      SET PF-STATUS '0100'.
      SET TITLEBAR '0100'.
      IF c_cont1 IS INITIAL.
    *Creating object of container
        CREATE OBJECT c_cont1
         EXPORTING
           container_name = 'CCONT1'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Creating object of alv
        CREATE OBJECT c_alv1
           EXPORTING
            i_parent = c_cont1.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Alv layout
        PERFORM alv_100_layout.
        PERFORM save_alv_layout.
    *Alv field catalogue
        PERFORM alv_100_fieldcat.
    *Displaying the ALV grid
        CALL METHOD c_alv1->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay1
            i_save          = ws-alv_save
            is_variant      = ws-alv_variant
          CHANGING
            it_outtab       = iresult[]
            it_sort         = ws-alv_sort
            it_fieldcatalog = it_fieldcat[].
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Create object of the event class
    *and setting handler for double click
        CREATE OBJECT e_dclick.
        SET HANDLER e_dclick->handle_double_click FOR c_alv1.
      ENDIF.
    ENDMODULE.                 " PBO_0100  OUTPUT
    *&      Module  PAI_0100  INPUT
          text
    MODULE pai_0100 INPUT.
      ws-ok_code = sy-ucomm.
      CASE ws-ok_code.
        WHEN 'BACK'.
          CALL  SELECTION-SCREEN  1000.
          CLEAR ws-ok_code.
        WHEN 'EXIT'.
          LEAVE TO  SCREEN  0.
          CLEAR ws-ok_code.
          EXIT.
        WHEN 'CANCEL'.
          LEAVE TO  SCREEN  0.
          CLEAR ws-ok_code.
          EXIT.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " PAI_0100  INPUT
    *&      Form  alv_100_layout
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_layout.
      ty_lay1-numc_total = 'X'. " Numc total line
    ty_lay1-cwidth_opt = 'X'. " Optimal column width
      ty_lay1-detailinit = 'X'. " Show values that are initial in
      ty_lay1-sel_mode = 'A'. " Column selection mode
      ty_lay1-no_merging = 'X'. " No merging while sorting columns
      ty_lay1-keyhot     = 'X'.
      ty_lay1-grid_title = 'SD Concessions'.
      ty_lay1-zebra      = 'X'.
      ty_lay1-no_toolbar = ' '.
    ENDFORM.                    " alv_100_layout
    *&      Form  alv_100_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'posnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Item#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'matnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Mat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'zansicat'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'AnsiCat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'zansigrd'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Grade'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'zcurrvaltnarea'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Val Area'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 6.
      ty_fieldcat-fieldname = 'zcurrcstusd'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Cost $'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 7.
      ty_fieldcat-fieldname = 'zzbrndnm'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Brand'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 8.
      ty_fieldcat-fieldname = 'zqedscgrp'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'QE'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 9.
      ty_fieldcat-fieldname = 'mstav'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Status'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 9.
      ty_fieldcat-fieldname = 'kwmeng'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Qty'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 10.
      ty_fieldcat-fieldname = 'lprc'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'List Price'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 11.
      ty_fieldcat-fieldname = 'sprc'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Discount'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 12.
      ty_fieldcat-fieldname = 'netpr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Quot Price'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 13.
      ty_fieldcat-fieldname = 'mrgn'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Margin%'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
    ENDFORM.                    " alv_100_fieldcat
    *&      Module  PBO_0101  OUTPUT
          text
    MODULE pbo_0101 OUTPUT.
    *Check if the Custom container exists.
      IF c_cont2 IS INITIAL.
    *Creating container object
        CREATE OBJECT c_cont2
          EXPORTING
            container_name = 'CCONT2'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *creating ALV grid for interactive list
        CREATE OBJECT c_alv2
          EXPORTING
           i_parent = c_cont2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *ALV layout
        PERFORM alv_101_layout.
    *ALV fieldcatalogue
        PERFORM alv_101_fieldcat.
    *Sorting the output by field position
        SORT iresult BY posnr.
    *ALV for display field details
        CALL METHOD c_alv2->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay2
          CHANGING
            it_outtab       = iresult[]
            it_fieldcatalog = it_fieldcat.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " PBO_0101  OUTPUT
    *&      Module  PAI_0101  INPUT
          text
    MODULE pai_0101 INPUT.
    ENDMODULE.                 " PAI_0101  INPUT
    *&      Form  alv_101_layout
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_layout.
      ty_lay2-grid_title = 'Line Details'.
      ty_lay2-zebra = 'X'.
      ty_lay2-no_toolbar = 'X'.
    ENDFORM.                    " alv_101_layout
    *&      Form  alv_101_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_fieldcat.
      REFRESH it_fieldcat.
    REFRESH it_fcat.
    CLEAR ty_fcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'posnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Item#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'matnr'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Mat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'zansicat'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'AnsiCat#'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'zansigrd'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Grade'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'zcurrvaltnarea'.
      ty_fieldcat-tabname = 'iresult'.
      ty_fieldcat-coltext = 'Val Area'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
    ENDFORM.                    " alv_101_fieldcat
    *&      Form  save_alv_layout
          text
    -->  p1        text
    <--  p2        text
    form save_alv_layout.
    ws-alv_save = 'A'.
    ws-alv_variant-report = sy-repid.
    endform.                    " save_alv_layout

    Hello
    Creating fieldcatalogs manually is one of the major error sources in ALV programming.
    There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
    If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
    Regards
      Uwe

  • How to increase the length of internal table dynamically

    How to increase the length of internal table dynamically depending on the number of fields fetched into the internal table ?
    The requirement code :
    types: begin of t_data,
             form          like zscr_data_hdr-form,
             werks         like zscr_data_hdr-werks,
             matnr         like zscr_data_hdr-matnr,
             verid         like zscr_data_hdr-verid,
             lot           like zscr_data_hdr-lot,
             lot_qty       like zscr_data_hdr-lot_qty,
             udate         like zscr_data_hdr-udate,
             utime         like zscr_data_hdr-utime,
             zuser         like zscr_data_hdr-zuser,
             processed     like zscr_data_hdr-processed,
             defect        like zscr_defect_data-defect,
             vornr         like zscr_route_data-vornr,
             fld1          like zscr_defect_data-defect_val,
             fld2          like zscr_defect_data-defect_val,
             fld3          like zscr_defect_data-defect_val,
             fld4          like zscr_defect_data-defect_val,
             fld5          like zscr_defect_data-defect_val,
             fld6          like zscr_defect_data-defect_val,
             fld7          like zscr_defect_data-defect_val,
             fld8          like zscr_defect_data-defect_val,
             fld9          like zscr_defect_data-defect_val,
             fld10         like zscr_defect_data-defect_val,
             fld11         like zscr_defect_data-defect_val,
             fld12         like zscr_defect_data-defect_val,
             fld13         like zscr_defect_data-defect_val,
             fld14         like zscr_defect_data-defect_val,
             fld15         like zscr_defect_data-defect_val,
             fld16         like zscr_defect_data-defect_val,
             fld17         like zscr_defect_data-defect_val,
             fld18         like zscr_defect_data-defect_val,
             fld19         like zscr_defect_data-defect_val,
             fld20         like zscr_defect_data-defect_val,
             fld21         like zscr_defect_data-defect_val,
             fld22         like zscr_defect_data-defect_val,
             fld23         like zscr_defect_data-defect_val,
             fld24         like zscr_defect_data-defect_val,
             fld25         like zscr_defect_data-defect_val,
             fld26         like zscr_defect_data-defect_val,
             fld27         like zscr_defect_data-defect_val,
             fld28         like zscr_defect_data-defect_val,
             fld29         like zscr_defect_data-defect_val,
             fld30         like zscr_defect_data-defect_val,
             fld31         like zscr_defect_data-defect_val,
             fld32         like zscr_defect_data-defect_val,
             fld33         like zscr_defect_data-defect_val,
             fld34         like zscr_defect_data-defect_val,
             fld35         like zscr_defect_data-defect_val,
             fld36         like zscr_defect_data-defect_val,
             fld37         like zscr_defect_data-defect_val,
             fld38         like zscr_defect_data-defect_val,
             fld39         like zscr_defect_data-defect_val,
             fld40         like zscr_defect_data-defect_val,
             fld41         like zscr_defect_data-defect_val,
             fld42         like zscr_defect_data-defect_val,
             fld43         like zscr_defect_data-defect_val,
             fld44         like zscr_defect_data-defect_val,
             fld45         like zscr_defect_data-defect_val,
             fld46         like zscr_defect_data-defect_val,
             fld47         like zscr_defect_data-defect_val,
             fld48         like zscr_defect_data-defect_val,
             fld49         like zscr_defect_data-defect_val,
             fld50         like zscr_defect_data-defect_val,
             fld51         like zscr_defect_data-defect_val,
             fld52         like zscr_defect_data-defect_val,
             fld53         like zscr_defect_data-defect_val,
             fld54         like zscr_defect_data-defect_val,
             fld55         like zscr_defect_data-defect_val,
             fld56         like zscr_defect_data-defect_val,
             fld57         like zscr_defect_data-defect_val,
             fld58         like zscr_defect_data-defect_val,
             fld59         like zscr_defect_data-defect_val,
             fld60         like zscr_defect_data-defect_val,
             fld61         like zscr_defect_data-defect_val,
             fld62         like zscr_defect_data-defect_val,
             fld63         like zscr_defect_data-defect_val,
             fld64         like zscr_defect_data-defect_val,
             fld65         like zscr_defect_data-defect_val,
             fld66         like zscr_defect_data-defect_val,
             fld67         like zscr_defect_data-defect_val,
             fld68         like zscr_defect_data-defect_val,
             fld69         like zscr_defect_data-defect_val,
             fld70         like zscr_defect_data-defect_val,
             fld71         like zscr_defect_data-defect_val,
             fld72         like zscr_defect_data-defect_val,
             fld73         like zscr_defect_data-defect_val,
             fld74         like zscr_defect_data-defect_val,
             fld75         like zscr_defect_data-defect_val,
             fld76         like zscr_defect_data-defect_val,
             fld77         like zscr_defect_data-defect_val,
             fld78         like zscr_defect_data-defect_val,
             fld79         like zscr_defect_data-defect_val,
             fld80         like zscr_defect_data-defect_val,
             fld81         like zscr_defect_data-defect_val,
             fld82         like zscr_defect_data-defect_val,
             fld83         like zscr_defect_data-defect_val,
             fld84         like zscr_defect_data-defect_val,
             fld85         like zscr_defect_data-defect_val,
             fld86         like zscr_defect_data-defect_val,
             fld87         like zscr_defect_data-defect_val,
             fld88         like zscr_defect_data-defect_val,
             fld89         like zscr_defect_data-defect_val,
             fld90         like zscr_defect_data-defect_val,
             fld91         like zscr_defect_data-defect_val,
             fld92         like zscr_defect_data-defect_val,
             fld93         like zscr_defect_data-defect_val,
             fld94         like zscr_defect_data-defect_val,
             fld95         like zscr_defect_data-defect_val,
             fld96         like zscr_defect_data-defect_val,
             fld97         like zscr_defect_data-defect_val,
             fld98         like zscr_defect_data-defect_val,
             fld99         like zscr_defect_data-defect_val,
             fld100         like zscr_defect_data-defect_val,
             fld101         like zscr_defect_data-defect_val,
             fld102         like zscr_defect_data-defect_val,
             fld103         like zscr_defect_data-defect_val,
             fld104         like zscr_defect_data-defect_val,
             fld105         like zscr_defect_data-defect_val,
             fld106         like zscr_defect_data-defect_val,
             fld107         like zscr_defect_data-defect_val,
             fld108         like zscr_defect_data-defect_val,
             fld109         like zscr_defect_data-defect_val,
             fld110         like zscr_defect_data-defect_val,
             fld111         like zscr_defect_data-defect_val,
             fld112         like zscr_defect_data-defect_val,
             fld113         like zscr_defect_data-defect_val,
             fld114         like zscr_defect_data-defect_val,
             fld115         like zscr_defect_data-defect_val,
             fld116         like zscr_defect_data-defect_val,
             fld117         like zscr_defect_data-defect_val,
             fld118         like zscr_defect_data-defect_val,
             fld119         like zscr_defect_data-defect_val,
             fld120         like zscr_defect_data-defect_val,
             fld121         like zscr_defect_data-defect_val,
             fld122         like zscr_defect_data-defect_val,
             fld123         like zscr_defect_data-defect_val,
             fld124         like zscr_defect_data-defect_val,
             fld125         like zscr_defect_data-defect_val,
             fld126         like zscr_defect_data-defect_val,
             fld127         like zscr_defect_data-defect_val,
             fld128         like zscr_defect_data-defect_val,
             fld129         like zscr_defect_data-defect_val,
             fld130         like zscr_defect_data-defect_val,
             fld131         like zscr_defect_data-defect_val,
             fld132         like zscr_defect_data-defect_val,
             fld133         like zscr_defect_data-defect_val,
             fld134         like zscr_defect_data-defect_val,
             fld135         like zscr_defect_data-defect_val,
             dayst         like zscr_data_hdr-dayst,
           end of t_data.
    In this fld1 to fld135 are defined in internal table.
    But if the number of fields are more than 135 then the program is going to short dump.
    Some times fld1 to fid170 or more fields will be there in my internal table.
    Please suggest me how to make my requirement dynamic and display this data fetched into this internal table onto a .XLS file in the presentation server ?

    Hi
    You can try to use the type string:
    form like zscr_data_hdr-form,
    werks like zscr_data_hdr-werks,
    matnr like zscr_data_hdr-matnr,
    verid like zscr_data_hdr-verid,
    lot like zscr_data_hdr-lot,
    lot_qty like zscr_data_hdr-lot_qty,
    udate like zscr_data_hdr-udate,
    utime like zscr_data_hdr-utime,
    zuser like zscr_data_hdr-zuser,
    processed like zscr_data_hdr-processed,
    defect like zscr_defect_data-defect,
    vornr like zscr_route_data-vornr,
    fieldxx type string,
    dayst like zscr_data_hdr-dayst,
    end of t_data.
    So you can save you informations of every fld<n> concatenating their values into fieldxx.
    Max

  • To display the content selected in multiselect control in a report..

    Hi,
    I have one requirement to display the content selected in multiselect.I explained my requirement below.
    I have 5 multiselect boxes.they are locality,designation,connection1,connection2,connection3.
    The corresponding designations will be displayed for the locality and the corresponding connection1 will be displayed for the designation and the corresponding connection2 will be displayed for the connection1 and the corresponding connection3 will be displayed for the connection2.everything is displayed correctly in the multiselect.
    My requirement here is till connection1 i'll select mandatorily. and if i select connection1 and click GO button without selecting connection2 and connection3 then the connection1 only should be displayed in the report not the connection2 and connection3.likewise if i stop till connection2 and click go then connection2 only has to be displayed in the report not the connection1 and connection3..How can i do this?
    i tried using dropdown and presentation variables but not all the values are displayed in dropdown and there is a limit in dropdown.so i'm going for multiselect..
    Can anyone help me..

    HI,
    Sai Kumar Potluri
    I tried in IDES it working.
    Here is the code.
    REPORT  ZPRA_TC_D.
    TABLES : SCARR.
    CONTROLS TC TYPE TABLEVIEW USING SCREEN 1.
    DATA : SELLINE TYPE I,
           SELINDEX TYPE I.
    DATA : ACT LIKE SCARR-CARRID,
           ANT LIKE SCARR-CARRNAME.
    DATA : ITAB LIKE SCARR OCCURS 0 WITH HEADER LINE.
    CALL SCREEN 1.
    *&      Module  STATUS_0001  OUTPUT
    *       text
    MODULE STATUS_0001 OUTPUT.
      SET PF-STATUS 'ME'.
    *  SET TITLEBAR 'xxx'.
    SELECT * FROM SCARR INTO TABLE ITAB.
    ENDMODULE.                 " STATUS_0001  OUTPUT
    *&      Module  MOV  OUTPUT
    *       text
    MODULE MOV OUTPUT.
      MOVE-CORRESPONDING ITAB TO SCARR.
    ENDMODULE.                 " MOV  OUTPUT
    *&      Module  USER_COMMAND_0001  INPUT
    *       text
    MODULE USER_COMMAND_0001 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK' OR 'UP' OR 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'SEL'.
      GET CURSOR FIELD SCARR-CARRID LINE SELLINE.
      SELINDEX = TC-TOP_LINE + SELLINE - 1.
      READ TABLE ITAB INDEX SELINDEX.
      ACT = ITAB-CARRID.
      ANT = ITAB-CARRNAME.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0001  INPUT
    In Flow Logic.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0001.
    LOOP AT ITAB WITH CONTROL TC.
      MODULE MOV.
    ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP AT ITAB.
    ENDLOOP.
    MODULE USER_COMMAND_0001.

  • Pagelet is not displaying the content

    Hi All, I am facing an issue where in the pagelets content is not loading into the page.
    We have upgraded from the tools 8.49.23 to 8.52.09. After that when I am checking the pagelets its not displaying the content. But it displayes all my pagelets as a boxes. All pagelets are not in minimized mode.
    I have checked the code which load the page. Its component based pagelet. we are passing the URL to HTML which is using iFrame as given below.
    <iframe src="%Bind(:1)" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" width=%Bind(:2) height=%Bind(:3) style="overflow:hidden; width:100%;"> </iframe>
    %bind(:1) is the component url. I have test this URL independently and is showing the content. Not sure why is this not rendered inside the iframe pagelet?
    I am able to see the pagelet content using personlize preview pagelet option as well. Can anyone help me to understand Why it is not loading inside the pagelet?
    Edited by: 923121 on 17-Sep-2012 06:45
    Edited by: 923121 on 17-Sep-2012 22:23

    There seems to be a new configuration page that might be controlling the display of the Toolbar.
    Navigation: Main Menu > Enterprise Components > Component Configurations > Toolbar > Toolbar Definition
    See: HCSC_NOTIFICATION
    Not sure, if any of the data in these tables were accidentally deleted in your upgraded environment?

  • Download database table content into internal table using Function Module?

    HI,
    Experts,
    I need a function module which can download ddic table content into internal table.
    Thank u ,
    Shabeer Ahmed.

    >
    shabeer ahmed wrote:
    > HI,
    > Experts,
    >
    > I need a function module which can download ddic table content into internal table.
    >
    > Thank u ,
    > Shabeer Ahmed.
    Hi Shabeer,
      We don't require a function module to download ddic table content to an internal table. We can use the SELECT statement for the same. Example would be:-
    DATA: <INTERNAL TABLE> type table of <DATABASE>.
    SELECT * FROM <DATABASE> into corresponding fields of <INTERNAL TABLE>.
    Also, function module might be required when you need the data from a remote system, but then it is the developer's task create this function module and the function module should be remote enabled function module.
    This remote enable function module should have the above SELECT query as its code.
    Many Regards,
    Ravi.

  • Displaying the contents of an array of objects

    Hello All,
    My Java teacher gave us a challenge and I'm stumped. The teacher wants us to display the contents of the array in the main menthod. The original code is as follows:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    }I understand that the elements of the array are objects, and each one has a value assigned to it. The following code was my first attempt at a solution:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
                                    for ( int i = 0; i < thingArray.length; i++)
                                       System.out.println( thingArray );                         
    }To which I'm given what amounts to garbage output. I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array. There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. Thanks very much in advance!

    robrom78 wrote:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    for ( int i = 0; i < thingArray.length; i++)
    System.out.println( thingArray );                         
    Note that you're trying to print the entire array at every loop iteration. That's probably not what you meant to do.
    You probably meant to do something more like
                                 System.out.println( thingArray[i] );Also, note that the java.util.Arrays class has a toString method that might be useful.
    To which I'm given what amounts to garbage output. It's not garbage. It's the default output to toString() for arrays, which is in fact the toString() defined for java.lang.Object (and inherited by arrays).
    I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array.It displays a default result that is vaguely related to the memory, but probably shouldn't be thought of us such. Think of it as identifying the type of object, and a value that differentiates it from other objects of the same type.
    By the way I assume you mean "+not+ the contents of the array" above. If so, that is correct.
    There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? No, you don't override a method in println; actually methods don't contain other methods directly. You probably do need to override toString in Thing.
    I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. You can get to the individual objects in the array just by dereferencing it, as I showed you above.
    But I suspect that won't be sufficient. Most likely, Thing doesn't have a toString method defined. This means that you'll end up with very similar output, but it will say "Thing" instead of "[Thing" and the numbers to the right of the "@" will be different.
    You'll need to override the toString() method in Thing to get the output you want.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Displaying the content of one JPanel in an other as a scaled image

    Hi,
    I'd like to display the content of one JPanel scaled in a second JPanel.
    The first JPanel holds a graph that could be edited in this JPanel. But unfortunately the graph is usually to big to have a full overview over the whole graph and is embeded in a JScrollPanel. So the second JPanel should be some kind of an overview window that shows the whole graph scaled to fit to this window and some kind of outline around the current section displayed by the JScrollPanel. How could I do this?
    Many thanks in advance.
    Best,
    Marc.

    Hi,
    I'd like to display the content of one JPanel scaled
    in a second JPanel.
    The first JPanel holds a graph that could be edited
    in this JPanel. But unfortunately the graph is
    usually to big to have a full overview over the whole
    graph and is embeded in a JScrollPanel. So the second
    JPanel should be some kind of an overview window that
    shows the whole graph scaled to fit to this window
    and some kind of outline around the current section
    displayed by the JScrollPanel. How could I do this?
    Many thanks in advance.
    Best,
    Marc.if panel1 is the graph and panel2 is the overview, override the paintComponent method in panel2 with this
    public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.scale(...,...);
    panel1.paint(g2);
    }

Maybe you are looking for

  • How do you share one Itunes library between accounts in the same computer?

    I have a new I-mac and I set up my Itunes library on the main account in the I-tunes folder, as a default. I set up a second account for my wife - how can I share the music in the main library without having to transfer it to a separate folder under

  • Win 8.1 Miix 3-830 windows update problem

    I received the notice to restart the tablet to finish the windows update, so I did but the tablet took several hours to restart. Then It restarted but now I see that update is stuck at 7% and not increasing at all The message I got is 'Updating your

  • G4 and USB2 INSTALLATION

    Hi, I bought this G4 in 2003 and at that time it was the best. Now I want to install USB2 and I have no clue what to do . I called an apple recommended dealer and he says that I can not update and just sell it and by new one. Is there any way to up g

  • Load balancing in Azure PaaS

    Hi all, I'm new to Azure and while our long term goal is to move our entire system into Azure, we have a small feature we'd like to try implementing first so that our infrastructure will be a sort of hybrid model for now. Basically I want to have a W

  • EPM 11.1.2.1 CLUSTERING COMPLETE

    Dear Gurus, I need to install second instance on wintel boxes (distribuited: 1-weblogic/ohs application box, 2-services, 3-essbase, 4- IIS- FDM) same as first instance. Products: HPCM, Planning, FDM, FR, WA I will need help on the following: 1) Does