How to caputre report output into an internal table?

Hi,
Is there a way to capture report output into one internal table?
Regards,
Amruth

Hi Amruth,
Use SUBMIT.. EXPORTING LIST TO MEMORY.
It saves  the output of a report into memory. Use the function modules LIST_FROM_MEMORY. WRITE_LIST & DISPLAY_LIST to retrieve the data.
All these function modules belongs to function group 'SLST'.
However the submit does not display hte output list of the called report, but saves it in ABAP memory & leaves the called report immediately. Since the calling program can read the list from memory & process it furthe, you need to use the addition ..AND RETURN.
Regards,
Chandru

Similar Messages

  • How to export report output into excel.

    Hi all
    how to export report output into excel sheet can any on give me answer step by step please as soon as possible
    kk

    Hi Prashanth,
    If you are executing Query from WAD  ---> Right click on Table (only on Characteristics Data)  --> Enhanced Menu ---> Export as --> CSV file or MS Excel
    assign points if this helps,
    Thanks,
    Sudhakar

  • How to add new field into dynamic internal table

    Hello Expert.
    how to add new field into dynamic internal table.
    PARAMETERS: P_TABLE(30).    "table name
    DATA: I_TAB TYPE REF TO DATA.
    FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
    *Create dynamic FS
    create DATA I_TAB TYPE TABLE OF (p_table).
      ASSIGN I_TAB->* TO <TAB>.
    SELECT * FROM (p_table) INTO TABLE <TAB>.
       here i want to add one more field into <TAB> at LAST position and my 
       Field name  =  field_stype     and
       Field type    =  'LVC_T_STYL'
    could you please helpme out .

    Hi,
    Please find the code below.You can add the field acc to your requirement.
    Creating Dynamic internal table
    TYPE-POOLS: slis.
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  u201C Dynamic internal table name
                   <fs_dyntable>,                     u201C Field symbol to create work area
                   <fs_fldval> type any.              u201C Field symbol to assign values 
    PARAMETERS: p_cols(5) TYPE c.                     u201C Input number of columns
    DATA:   t_newtable TYPE REF TO data,
            t_newline  TYPE REF TO data,
            t_fldcat   TYPE slis_t_fldcat_alv,
            t_fldcat   TYPE lvc_t_fcat,
            wa_it_fldcat TYPE lvc_s_fcat,
            wa_colno(2) TYPE n,
            wa_flname(5) TYPE c. 
    Create fields .
      DO p_cols TIMES.
        CLEAR wa_it_fldcat.
        move sy-index to wa_colno.
        concatenate 'COL'
                    wa_colno
               into wa_flname.
        wa_it_fldcat-fieldname = wa_flname.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 10.
        APPEND wa_it_fldcat TO t_fldcat.
      ENDDO. 
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fldcat
        IMPORTING
          ep_table        = t_newtable. 
      ASSIGN t_newtable->* TO <t_dyntable>. 
    Create dynamic work area and assign to FS
      CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
      ASSIGN t_newline->* TO <fs_dyntable>.
    Populating Dynamic internal table 
      DATA: fieldname(20) TYPE c.
      DATA: fieldvalue(10) TYPE c.
      DATA: index(3) TYPE c. 
      DO p_cols TIMES. 
        index = sy-index.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
    Set up fieldvalue
        CONCATENATE 'VALUE' index INTO
                    fieldvalue.
        CONDENSE    fieldvalue NO-GAPS. 
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue. 
      ENDDO. 
    Append to the dynamic internal table
      APPEND <fs_dyntable> TO <t_dyntable>.
    Displaying dynamic internal table using Grid. 
    DATA: wa_cat LIKE LINE OF fs_fldcat. 
      DO p_cols TIMES.
        CLEAR wa_cat.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
        wa_cat-fieldname = wa_flname.
        wa_cat-seltext_s = wa_flname.
        wa_cat-outputlen = '10'.
        APPEND wa_cat TO fs_fldcat.
      ENDDO. 
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = fs_fldcat
        TABLES
          t_outtab    = <t_dyntable>.

  • How to break report output into files

    Hi,
    I need to submit my report output into different files based on the Sales person name.
    When I submit my request from SRS window it asks the sales person name 'FROM' and 'To'parameters, if I choose the different sales person names then report output has to divide into files for each sales person. How can I do this? Do I nedd to add any code
    in my report.
    Could you help me in this?
    Thanks in advance

    This maybe helpful:
    Report Distribution

  • How to export report output into excel file

    hi friends,
    i would like to get the solution from you for how to export the report output into a .xls file. i know how to convert it into .rtf and .txt files but i think it's difficult to do this .xls way, could you help me to comeover this problem?
    thankyou very much.

    The official answer is "delimited", which
    generates adequate comma or other delimited
    text. No formatting, and without extra
    effort no support for non-ASCII characters.
    Might be sufficient for you.
    Note that Excel can read html files - we
    built programs to generate html files with
    name of "blah.xls" and some Excel-ish
    extensions, so Excel is automatically opened
    and the document is all nice and pretty.
    (Oracle html output has some odd logic about
    choosing number of columns, we didn't use
    it.)
    -- Allan Plum

  • Report output list to internal table using submit report

    Hello,
    I have a report that generates the output in the form of an abap list. I want this data in an internal table for further processing. the report internally does not do a export data to memory so i cannot use import later on to get the data.
    i did the following
    SUBMIT <report name> exportING LIST TO MEMORY and return.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = itab_list
      EXCEPTIONS
        not_found  = 4
        OTHERS     = 8.
    CALL FUNCTION 'LIST_TO_ASCI'
      EXPORTING
        list_index         = -1
      TABLES
        listasci           = ascitab
        listobject         = itab_list
      EXCEPTIONS
        empty_list         = 1
        list_index_invalid = 2
        OTHERS             = 3.
    This returns the data in the ascitab, but the data contains additional unwanted info like lines and hyphens etc. Also the data is in a table with a single column, so pulling out individuals fields is again an issue. Is there a way to get this data into an internal table directly?
    best regards,
    Suraj

    hi suraj
    export the internal table  of report
    DATA: BEGIN OF SR_VBAK ,
          VBELN LIKE VBAK-VBELN,
          END OF SR_VBAK.
    DATA: IR_VBAK LIKE STANDARD TABLE OF SR_VBAK WITH HEADER LINE.
    EXPORT IR_VBAK TO MEMORY ID 'SALES'.
           SUBMIT <program name in which u want internal table records > AND RETURN.
    now import that data in submit program  .
    here u have to creat a internal table with same structure as the internal table from which u r trying to export the data
    DATA: BEGIN OF SR_VBAK,
          VBELN LIKE VBAK-VBELN,
          END OF SR_VBAK.
    DATA : IR_VBAK LIKE STANDARD TABLE OF SR_VBAK WITH HEADER LINE.
    IMPORT IR_VBAK FROM MEMORY ID 'SALES'.
    regards
    ANIL CHAUDHaRY

  • How to write report output into table

    Hi,
    I want to get data out from report "RSPARAM" which list all system profile parameters my requirement is that i need to write output of this report to table so can anyone please tell me how should achieve this?
    is there any FM which read report as parameters and write into table?
    thanks in advance.
    john.

    Looks like the program you are calling(rsparam) is just calling another report, RSPFPAR.  Let's just call that one directly.  Here is an updated version of the program.
    This will also put the first 3 columns in a internal table.  This should show you what you need to do.
    report zrich_0003 .
    data: begin of listout occurs 0,
          line(1024) type c,
          end of listout.
    data: begin of itab occurs 0,
          column1(100) type c,
          column2(100) type c,
          column3(100) type c,
          therest(100) type c,
          end of itab.
    * Submit the report and export list to memory
    submit  rspfpar exporting list to memory
                and return.
    * Get list from memory and convert to ascii
    perform retrieve_list_from_memory tables listout.
    loop at listout.
      if sy-tabix => 7.
        clear itab.
    split listout+1(500) at '|' into itab-column1 itab-column2
                                     itab-column3 itab-therest.
        append itab.
      endif.
    endloop.
    loop at itab.
      write:/ itab-column1, itab-column2, itab-column3.
    endloop.
    * RETRIEVE_LIST_FROM_MEMORY
    form retrieve_list_from_memory tables reportlines.
      data: list like abaplist occurs 0 with header line.
      data: txtlines(1024) type c occurs 0 with header line.
      clear list.  refresh list.
      clear reportlines. refresh reportlines.
      call function 'LIST_FROM_MEMORY'
           tables
                listobject = list
           exceptions
                not_found  = 1
                others     = 2.
      check sy-subrc = 0.
      call function 'LIST_TO_ASCI'
           tables
                listobject         = list
                listasci           = txtlines
           exceptions
                empty_list         = 1
                list_index_invalid = 2
                others             = 3.
      check sy-subrc = 0.
      reportlines[] = txtlines[].
      call function 'LIST_FREE_MEMORY'.
    endform.
    Regards,
    Rich Heilman

  • How to upload XML file into the internal table in Webdynpro  ABAP ?

    Hi Friends,
    I am not able to upload the XML file into ABAP,can you please help me in solving this issue with the help of source code.
    Regards
    Dinesh

    Hi Dinesh,
    Try go through this program which I had developed earlier. It takes as input an XML file and then breaks it down into name-value pairs of an intrnal table. You need to pass an XML file as input to this program. (I had hard coded the path for my XML file in it. You need to replace it with 1 of your own or you can just delete it and use the browse button to selet the file on your PC)
    Regards,
    Uday
    REPORT  ZUDAY_XML no standard page heading.
    " Internal table to store the XML file in binary mode
    data: begin of it_xml occurs 1,
            c(255) type x,
          end of it_xml,
    " Name-value pairs table rturned by FM SMUM_XML_PARSE
          it_SMUM_XMLTB type SMUM_XMLTB occurs 0 with header line,
    " Table returned by FM SMUM_XML_PARSE for error handling
          it_bapiret2 type bapiret2 occurs 0 with header line.
    " XSTRING variable to be used by FM SCMS_BINARY_TO_XSTRING to hold the XML file in XSTRING format
    data: I_xstring type xstring, 
    " String variable to hold XML file path to pass to GUI_UPLOAD
          I_file_path type string,
    " Variable to store the size of the uploaded binary XML file
          I_LENGTH TYPE I VALUE 0.
    parameters: P_path type IBIPPARMS-PATH default 'C:\Documents and Settings\c5104398\Desktop\flights.xml'.
    " Get the XML file path from the user
    at selection-screen on value-request for P_path.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          FILE_NAME = P_PATH.

  • Report output into internal table and going ahead

    Hi Folks,
    We have a report MB51.It is showing some details.Now along with these details I wanna fetch some more detail and show it in the same report.
    One way is I can copy this into Z and then go ahead with the changes.But I would like to know can we SUBMIT MB51  program in my ZPROGRAM and then get the output into an internal table and then again populate this internal table with the rest of the data and again display it as final output.
    To be precise,is it possible to get the final output of MB51 into an internal table by using submit.
    K.Kiran.

    dear kian
    pls check the below code for example:
    DATA LIST_TAB TYPE TABLE OF ABAPLIST.
    DATA: BEGIN OF olist OCCURS 0,
            filler1(1500)   TYPE c,
          END OF olist.
    SUBMIT YTEST04 WITH MATNR EQ 't000001'
                     EXPORTING LIST TO MEMORY
                     AND RETURN.
    BREAK-POINT.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        LISTOBJECT = LIST_TAB
      EXCEPTIONS
        NOT_FOUND  = 1
        OTHERS     = 2.
    IF SY-SUBRC = 0.
      CALL FUNCTION 'LIST_TO_ASCI'
        EXPORTING
          LIST_INDEX         = -1
        TABLES
          LISTASCI           = oLIST
          LISTOBJECT         = LIST_TAB
        EXCEPTIONS
          EMPTY_LIST         = 1
          LIST_INDEX_INVALID = 2
          OTHERS             = 3.
      BREAK-POINT.
    ENDIF.

  • SUBMIT and RETUTN with ALV output into a interanl table.

    Hello Friends,
    I have one z program which returns ALV output.
    I have to create a one new Z program and in that I want to call this program and want the final output into an internal table into my Zreport.
    I used SUBMIT statement with RETURN but not working.
    can anybody tell me what I missed?
    or
    How can we do this.
    Thanks in advance.
    Suhas

    Hi Suhas,
    In Zreport1.
    Just open the first report program and assign internal table to some memory id like...
    EXPORT it_tab1 to MEMORY ID 'ZNITS'.
    In Zreport2.
    Now create an internal table with the same structure of it_tab1 and write the following in your program...
    SUBMIT Zreport1 WITH SELECTION-TABLE it_input
                                    AND RETURN.
    Note: it_input is of type rsparams and contains all selection parameters for *Zreport1*
    *   Import internal table content from memory id
        IMPORT it_tab1 TO it_tab2 FROM MEMORY ID 'ZNITS'.
        FREE MEMORY ID  'ZNITS'.
    Thanks
    Nitesh

  • Very urjent how to send report output in mail

    hi experts,
    how to send report output in mail which function module should i use wht parameters should i pass.
    thanks in addavnce,
    points to be awarded.

      CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
                destination    = '026c'
                copies         = count
                list_name      = 'VATS_ASBUILT'
                list_text      = v_list
                immediately    = 'X'
                release        = 'X'
                new_list_id    = 'X'
                expiration     = days
                line_size      = 132
                line_count     = 65
                layout         = 'X_65_132'
    *            sap_cover_page = 'X'
    *            cover_page     = 'X'
                receiver       = 'SAP*'
                department     = 'VATS'
                no_dialog      = 'X'
           IMPORTING
                out_parameters = params
                valid          = valid.
      SUBMIT zppr_vats_asbuilt  WITH p_aufnr EQ v_aufnr
                   TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                      SPOOL PARAMETERS params
                         AND RETURN.
      SELECT SINGLE rqident FROM tsp01 INTO l_spoolno
                         WHERE rqtitle = v_list .
    * convert report to PDF format
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = l_spoolno
                no_dialog                = 'X'
           TABLES
                pdf                      = l_ipdf
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        EXIT .
      ENDIF.
    Now comes the part to send the mail
      try.
    * -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
          clear document.
    * -------- create and set document with attachment ---------------
    * create document from internal table with text
          document = cl_document_bcs=>create_document(
          i_type = 'RAW'
          i_text = text
          i_length = '12'
          i_subject = '' ).
    *changing the content of the attachment
          binary_content[] = l_iobjbin[].
    *change the name of the PDF attachment
          concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
                              into i_att_sub separated by space.
    * add attachment to document
          call method document->add_attachment
            exporting
              i_attachment_type    = 'PDF'
              i_attachment_subject = i_att_sub
              i_att_content_hex    = binary_content.
    *setting the option to send an e-mail more than 50 characters
          call method send_request->set_message_subject
            exporting
              ip_subject = t_sub.
    * add document to send request
          call method send_request->set_document
            exporting
              i_document = document.
    * --------- set sender -------------------------------------------
    * note: this is necessary only if you want to set the sender
    * different from actual user (SY-UNAME). Otherwise sender is
    * set automatically with actual user.
          sender = cl_sapuser_bcs=>create( 'VATSUPPORT' ).
          call method send_request->set_sender
            exporting
              i_sender = sender.
    *Send the list based on receivers list obtained
          loop at l_ireclist.
            AD_SMTPADR = l_ireclist-receiver.
    * --------- add recipient (e-mail address) -----------------------
    * create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
          AD_SMTPADR ).
    * add recipient with its respective attributes to send request
          call method send_request->add_recipient
            exporting
              i_recipient = recipient
              i_express   = 'X'.
          ENDLOOP.
          call method send_request->set_status_attributes
            exporting
              i_requested_status = 'E'
              i_status_mail      = 'E'.
    * To send the mail immediately
          call method send_request->set_send_immediately( 'X' ).
    * ---------- send document ---------------------------------------
          call method send_request->send( ).
          commit work.

  • How to convert ALV output into XML format.

    Hi all,
    I just want to know how to convert an ALV output into a XML format, this is really urgent.
    regards,
    Ruchika saini

    This program exports an internal table to an XML file. *----
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    REPORT ZPRUEBA_MML_13.
    PANTALLA SELECCION *
         PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
    PANTALLA SELECCION *
    TYPE TURNOS *
    TYPES: BEGIN OF TURNOS,
         LU LIKE T552A-TPR01,
         MA LIKE T552A-TPR01,
         MI LIKE T552A-TPR01,
         JU LIKE T552A-TPR01,
         VI LIKE T552A-TPR01,
         SA LIKE T552A-TPR01,
         DO LIKE T552A-TPR01,
    END OF TURNOS.
    TYPE TURNOS *
    TYPE SOCIO *
    TYPES: BEGIN OF SOCIO,
         NUMERO LIKE PERNR-PERNR,
         REPOSICION LIKE PA0050-ZAUVE,
         NOMBRE LIKE PA0002-VORNA,
         TURNOS TYPE TURNOS,
    END OF SOCIO.
    TYPE SOCIO *
    ESTRUCTURA ACCESOS *
    DATA: BEGIN OF ACCESOS OCCURS 0,
         SOCIO TYPE SOCIO,
    END OF ACCESOS.
    ESTRUCTURA ACCESOS *
    START OF SELECTION *
    START-OF-SELECTION.
         PERFORM LLENA_ACCESOS.
         PERFORM DESCARGA_XML.
    END-OF-SELECTION.
    END OF SELECTION *
    FORM LLENA_ACCESOS *
    FORM LLENA_ACCESOS.
    REFRESH ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
                   'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
                   '0' TO ACCESOS-SOCIO-REPOSICION,
                   'T1' TO ACCESOS-SOCIO-TURNOS-LU,
                   'T2' TO ACCESOS-SOCIO-TURNOS-MA,
                   'T3' TO ACCESOS-SOCIO-TURNOS-MI,
                   'T4' TO ACCESOS-SOCIO-TURNOS-JU,
                   'T5' TO ACCESOS-SOCIO-TURNOS-VI,
                   'T6' TO ACCESOS-SOCIO-TURNOS-SA,
                   'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
                   'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
                   '0' TO ACCESOS-SOCIO-REPOSICION,
                   'T1' TO ACCESOS-SOCIO-TURNOS-LU,
                   'T2' TO ACCESOS-SOCIO-TURNOS-MA,
                   'T3' TO ACCESOS-SOCIO-TURNOS-MI,
                   'T4' TO ACCESOS-SOCIO-TURNOS-JU,
                   'T5' TO ACCESOS-SOCIO-TURNOS-VI,
                   'T6' TO ACCESOS-SOCIO-TURNOS-SA,
                   'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    ENDFORM.
    FORM LLENA_ACCESOS *
    FORM DESCARGA_XML *
    FORM DESCARGA_XML.
    DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
                   M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
                   G_IXML TYPE REF TO IF_IXML,
                   W_STRING TYPE XSTRING,
                   W_SIZE TYPE I,
                   W_RESULT TYPE I,
                   W_LINE TYPE STRING,
                   IT_XML TYPE DCXMLLINES,
                   S_XML LIKE LINE OF IT_XML,
                   W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
    BEGIN OF XML_TAB OCCURS 0,
                   D LIKE LINE OF XML,
    END OF XML_TAB.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    WRITE: / 'Converting DATA TO DOM 1:'.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
                   NAME = 'ACCESOS'
                   DATAOBJECT = ACCESOS[]
    IMPORTING
                   DATA_AS_DOM = L_DOM
    CHANGING
                   DOCUMENT = M_DOCUMENT
    EXCEPTIONS
                   ILLEGAL_NAME = 1
                   OTHERS = 2.
    IF SY-SUBRC = 0.
                   WRITE 'Ok'.
    ELSE.
                   WRITE: 'Err =',
                   SY-SUBRC.
    ENDIF.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    IF W_RC IS INITIAL.
                   WRITE 'Ok'.
    ELSE.
                   WRITE: 'Err =',
                   W_RC.
    ENDIF.
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
                   DOCUMENT = M_DOCUMENT
    IMPORTING
                   XML_AS_STRING = W_STRING
                   SIZE = W_SIZE
    TABLES
                   XML_AS_TABLE = IT_XML
    EXCEPTIONS
                   NO_DOCUMENT = 1
                   OTHERS = 2.
    IF SY-SUBRC = 0.
                   WRITE 'Ok'.
    ELSE.
                   WRITE: 'Err =',
                   SY-SUBRC.
    ENDIF.
    LOOP AT IT_XML INTO XML_TAB-D.
                   APPEND XML_TAB.
    ENDLOOP.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
                   BIN_FILESIZE = W_SIZE
                   FILENAME = GK_RUTA
                   FILETYPE = 'BIN'
    TABLES
                   DATA_TAB = XML_TAB
    EXCEPTIONS
                   OTHERS = 10.
    IF SY-SUBRC <> 0.
                   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    Message was edited by:
            Hymavathi Oruganti

  • How to do a SELECT from different tables into an internal table?

    How to do a SELECT from different tables into an internal table?
    I want to select data from MARA, MARC and ZPERSON and populate my ITAB_FINAL
    REPORT  zinternal_table.
    TABLES:
      mara,
      marc,
      zperson.
    TYPES:
    BEGIN OF str_table1,
      v_name LIKE zperson-zname,
      v_matnr LIKE marc-matnr,
      v_emarc LIKE marc-emarc,
      v_werks_d LIKE marc-werks_d,
      v_dstat LIKE marc-dstat,
      END OF str_table,
      i_table1 TYPE STANDARD TABLE OF str_table1.
    DATA:
    BEGIN OF str_table2,
    v_mandt LIKE mara-mandt,
    v_ernam LIKE mara-ernam,
      v_laeda LIKE mara-laeda,
    END OF str_table2,
    itab_final LIKE STANDARD TABLE OF str_table2.

    first find the link between mara , marc and zperson , if u have link to 3 tables then u can jus write a join and populate the table u want ( thats final table with all the fields).
    u defenitely have alink between mara and marc so join them and retrieve all data into one internal table.
    then for all the entries in that internal table retrieve data from zperson into another internal table.
    then loop at one internal table
    read another internal table where key equals in both the tables.
    finally assign fileds if sy-subrc = 0.
    gs_finaltable-matnr = gs_table-matnr
    etc...
    and finally append gs_finaltable to gt_finaltable.
    there u go ur final table has all the data u want.
    regards
    Edited by: BrightSide on Apr 2, 2009 3:49 PM

  • How to join two internal table rows in alternative manner into one internal table?

    How to join two internal table rows in alternative manner into one internal table?
    two internal tables are suppose itab1 &  itab2 & its data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    d
    e
    f
    g
    h
    i
    Header 1
    Header 2
    Header 3
    1
    2
    3
    4
    5
    6
    7
    8
    9
    INTO itab3 data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    1
    2
    3
    d
    e
    f
    4
    5
    6
    g
    h
    i
    7
    8
    9

    Hi Soubhik,
    I have added two additional columns for each internal table.
    Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
    Row_Count  - It represents the Row Count Number, increase the row count value 1 by one..
    ITAB1:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    a
    b
    c
    1
    1
    d
    e
    f
    1
    2
    g
    h
    i
    1
    3
    ITAB2:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    1
    2
    3
    2
    1
    4
    5
    6
    2
    2
    7
    8
    9
    2
    3
    Create the Final Internal table as same as the ITAB1/ITAB2 structure.
    "Data Declarations
    DATA: IT_FINAL LIKE TABLE OF ITAB1.          "Final Internal Table
    FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1,     "TAB1
                                   <FS_TAB2> TYPE TY_TAB2.     "TAB2
    "Assign the values for the additional two column for ITAB1
    LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
         <FS_TAB1>-TABLE_COUNT = 1.             "Table value same for all row
         <FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
    ENDLOOP.
    "Assign the values for the additional two column for ITAB2
    LOOP AT ITAB2 ASSIGNING <FS_TAB2>.    
         <FS_TAB2>-TABLE_COUNT = 2.                  "Table value same for all row
         <FS_TAB2>-ROW_COUNT = SY-TABIX.      "Index value
    ENDLOOP.
    "Copy the First Internal Table 'ITAB1' to Final Table
    IT_FINAL[] = ITAB1[].
    "Copy the Second Internal Table 'ITAB2' to Final Table
    APPEND IT
    LOOP AT ITAB2 INTO WA_TAB2.
    APPEND WA_TAB2 TO IT_FINAL.
    ENDLOOP.
    "Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
    SORT IT_FINAL BY  ROW_COUNT TABLE_COUNT.
    After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
    Regards
    Rajkumar Narasimman

  • How to select the data from a Maintainance View into an internal table

    Hi All,
    Can anybody tell me how to select the data from a Maintainance View into an internal table.
    Thanks,
    srinivas.

    HI,
    You can not retrieve data from A mentenance view.
    For detail check this link,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    Regards,
    Anirban

Maybe you are looking for