Calling a tcode in simple report

hi,
I am trying to call a tcode (ME23n) in a simple report(not ALV) but problem is i am unable to SET Parameter ID (i.e. P.O. no ).  I displaying a list from an internal table even thou i am using the HIDE statement i am unable to capture the ebeln(P.O. no). please provide some sample code.
regards
prabhu

I have ALV Report which calls mm02 and see the report
REPORT Z_GET_REFRESH no standard page heading.
type-pools : slis.
tables : makt,
         mara.
data : i_fieldcat type slis_t_fieldcat_alv.
data : begin of i_makt occurs 0,
       matnr like makt-matnr,
       maktx like makt-maktx,
       end of i_makt.
data : v_repid like sy-repid,
       g_user_command type slis_formname value 'USER_COMMAND',
       g_status_set   type slis_formname value 'SET_PF_STATUS'.
DATA:LC_GLAY TYPE LVC_S_GLAY.
select-options s_matnr for mara-matnr .
start-of-selection.
  select matnr maktx from makt into table i_makt
                              where matnr in s_matnr.
end-of-selection.
Fill the fieldcatlog
  perform fill_field.
Call the FM
  perform call_fm.
*&      Form  fill_field
      text
-->  p1        text
<--  p2        text
FORM fill_field.
  data wa_fieldcat type slis_fieldcat_alv.
  clear : wa_fieldcat.
  wa_fieldcat-tabname = 'I_MAKT'.
  wa_fieldcat-fieldname = 'MATNR'.
  wa_fieldcat-outputlen = '18'.
  wa_fieldcat-seltext_l = 'Material #'.
  wa_fieldcat-col_pos = '1'.
  append wa_fieldcat to i_fieldcat.
  clear : wa_fieldcat.
  wa_fieldcat-tabname = 'I_MAKT'.
  wa_fieldcat-fieldname = 'MAKTX'.
  wa_fieldcat-outputlen = '40'.
  wa_fieldcat-seltext_l = 'Material Desc'.
  wa_fieldcat-col_pos = '2'.
  append wa_fieldcat to i_fieldcat.
ENDFORM.                    " fill_field
*&      Form  call_fm
      text
-->  p1        text
<--  p2        text
FORM call_fm.
  v_repid = sy-repid.
  LC_GLAY-EDT_CLL_CB = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                =
  I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = v_repid
      I_CALLBACK_PF_STATUS_SET          = g_status_set
      I_CALLBACK_USER_COMMAND           = g_user_command
  I_CALLBACK_TOP_OF_PAGE            = ' '
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
  I_GRID_TITLE                      =
    I_GRID_SETTINGS                   = LC_GLAY
  IS_LAYOUT                         =
      IT_FIELDCAT                       = i_fieldcat
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
  I_DEFAULT                         = 'X'
  I_SAVE                            = ' '
  IS_VARIANT                        =
  IT_EVENTS                         =
  IT_EVENT_EXIT                     =
  IS_PRINT                          =
  IS_REPREP_ID                      =
  I_SCREEN_START_COLUMN             = 0
  I_SCREEN_START_LINE               = 0
  I_SCREEN_END_COLUMN               = 0
  I_SCREEN_END_LINE                 = 0
  IT_ALV_GRAPHICS                   =
  IT_ADD_FIELDCAT                   =
  IT_HYPERLINK                      =
  I_HTML_HEIGHT_TOP                 =
  I_HTML_HEIGHT_END                 =
  IT_EXCEPT_QINFO                   =
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           =
  ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = i_makt
   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.
ENDFORM.                    " call_fm
      FORM USER_COMMAND                                             *
FORM user_command USING r_ucomm LIKE sy-ucomm
            rs_selfield TYPE slis_selfield.                 "#EC CALLED
  data i_RSPARAMS like RSPARAMS occurs 0.
  CASE R_UCOMM.
    WHEN '&IC1'.
      read table i_makt index rs_selfield-tabindex.
      SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
      if not i_makt-matnr is initial.
        call transaction 'MM02' and skip first screen.
      endif.
    when 'REFRESH'.
      CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
        EXPORTING
          CURR_REPORT           = v_repid
IMPORTING
  SP                    =
        TABLES
         SELECTION_TABLE       = i_RSPARAMS
       EXCEPTIONS
         NOT_FOUND             = 1
         NO_REPORT             = 2
         OTHERS                = 3
      IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      submit z_get_refresh with selection-table i_RSPARAMS.
      rs_selfield-refresh = 'X'.
  ENDCASE.
  MOVE 'REFRESH' TO r_ucomm.
ENDFORM.
      FORM set_pf_status                                            *
FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
  SET TITLEBAR  sy-tcode.
ENDFORM.
For PO
use like
set parameter id 'BES' field ur field.
call transaction 'ME22N'.

Similar Messages

  • CALL A TRANSACTION  IN SIMPLE REPORT AND RETURN BACK TO REPORT

    I 'VE A REQUIREMENT IN WHICH I HAVE TO MAKE A REPORT PROGRAM. IN THIS REPORT PROGRAM I HAVE TO CALL A TRANSACTION cs11 IN BACKGROUND AND THEN PICK ITS OUTPUT VALUE (DISPLAYED IN alv GRID OF cs11) AND THEN RETURN BACK TO MAIN PROGRAM. DO SOME CALCULATION WITH THE BROUGHT DATA AND THEN DISPLAY THEM ON THE REPORT alv OUTPUT.
    iS THIS POSSIBLe? IF YES? HOW.
    PLEASE HELP.

    try creating two reports.....ztest_a and ztest_b
    do your call transaction in ztest_b
    in ztest_a you can write submit ztest_a and return....
    see if this works...
    Message was edited by:
            Priyank Jain

  • Call tcode from alv report and passing  group of values

    hi all .
    i want to call tcode from alv report and passing an internal table or group of values to a selection option of that t code ? how
    ex. passing group of GL to fbl3n and display the detials of all .
    thank you

    Dear,
    You have done a small mistake
    --> rspar_line-option = 'EQ'.
         rspar_line-HIGH = PDATE-HIGH.
    u r passing "high" value and in "option u r passing "EQ" so how it will work!!!
    So if u r passing only 1 date or more dates like 01.01.2010 , 15.02.2010 , 10.03.2010 then pass
    rspar_line-selname = 'SO_BUDAT'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'EQ'.
    rspar_line-LOW = PDATE-HIGH.
    APPEND rspar_line TO rspar_tab.
    or if u r passing low & high date means in range like 01.01.2010 to 30.01.2010, then pass
    rspar_line-selname = 'SO_BUDAT'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'BT''.
    rspar_line-LOW = PDATE-LOW.
    rspar_line-HIGH = PDATE-HIGH.
    APPEND rspar_line TO rspar_tab.
    try above code , hope it helps...
    i think u cannot use "call transaction using bdcdata" in ur case bcoz as u said in ur 1st post u want to display the details of all but still if u want to use then u should pass all parameters in  loop.
    PROGRAM
    DYNPRO
    DYNBEGIN
    FNAM
    FVAL
    ex:-
    LOOP AT GT_TEMP INTO GS_TEMP.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = 'SAPXXXX'.
    bdcdata_DYNPRO = '1000'.
    bdcdata_DYNBEGIN = 'X'.
    bdcdata_wa-fnam = '''.
    bdcdata_wa-fval = ''.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = ''.
    bdcdata_DYNPRO = ''.
    bdcdata_DYNBEGIN = ''.
    bdcdata_wa-fnam = 'SD_SAKNR'.
    bdcdata_wa-fval = GS_TEMP-GLACCOUNT.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = ''.
    bdcdata_DYNPRO = ''.
    bdcdata_DYNBEGIN = ''.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = 'XXX'.
    APPEND bdcdata_wa TO bdcdata_tab.
    ENDLOOP.
    try above code if u r using call transaction...
    Edited by: mihir6666 on Jul 9, 2011 3:10 PM
    Edited by: mihir6666 on Jul 9, 2011 3:11 PM
    Edited by: mihir6666 on Jul 9, 2011 3:13 PM

  • Smartforms:Can i call a Tcod from Driver Prg 4 its o/p 2 be appended

    Hello Smartform Gurus
    I need 2 call 1 tcode from my Driver prog ,which has report o/p that is 2 be appended in my Smartform o/p as a
    appended page .
    Is it possible at all ?
    plz throw some light on this .
    thnx
    Moni

    Hi Moni,
    of course there are several ways to reach your goal.
    I have assumed:
    - your smartform is based on a SAP-document
    - document output is based on standard output determination with output messages
    This is defined in customizing (SPRO) at several places or combined in NACE.
    Anyway, create additional output just after smartform output, take care of same printer, spool name and so on ->  you will end with one (combined) spool request.
    Have a look for output messages, if you are unsure how to get a 'simple' smartform output.
    Regards,
    Christian

  • Plz tell me BDC  CALL TRANSACTION steps with simple example

    hi,
    plz tell me the steps
    BDC  CALL TRANSACTION steps with simple example

    Hi,
    BATCH DATA COMMUNICATION
    About Data Transfer In R/3 System
    When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.
    In the process of replacing current applications and transferring application data, two situations might occur:
    ? The first is when application data to be replaced is transferred at once, and only once.
    ? The second situation is to transfer data periodically from external systems to SAP and vice versa.
    ? There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.
    The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called ?batch input? or ?batch data communication?.
    1. SESSION METHOD
    2. CALL TRANSACTION
    3. DIRECT INPUT
    Advantages offered by BATCH INPUT method:
    1. Can process large data volumes in batch.
    2. Can be planned and submitted in the background.
    3. No manual interaction is required when data is transferred.
    4. Data integrity is maintained as whatever data is transferred to the table is through transaction. Hence batch input data is submitted to all the checks and validations.
    To implement one of the supported data transfers, you must often write the program that exports the data from your non-SAP system. This program, known as a ?data transfer? program must map the data from the external system into the data structure required by the SAP batch input program.
    The batch input program must build all of the input to execute the SAP transaction.
    Two main steps are required:
    ? To build an internal table containing every screen and every field to be filled in during the execution of an SAP transaction.
    ? To pass the table to SAP for processing.
    Prerequisite for Data Transfer Program
    Writing a Data Transfer Program involves following prerequisites:
    Analyzing data from local file
    Analyzing transaction
    Analyzing transaction involves following steps:
    ? The transaction code, if you do not already know it.
    ? Which fields require input i.e., mandatory.
    ? Which fields can you allow to default to standard values.
    ? The names, types, and lengths of the fields that are used by a transaction.
    ? Screen number and Name of module pool program behind a particular transaction.
    To analyze a transaction::
    ? Start the transaction by menu or by entering the transaction code in the command box.
    (You can determine the transaction name by choosing System ? Status.)
    ? Step through the transaction, entering the data will be required for processing your batch input data.
    ? On each screen, note the program name and screen (dynpro) number.
    (dynpro = dyn + pro. Dyn = screen, pro = number)
    ? Display these by choosing System ? Status. The relevant fields are Program (dynpro) and Dynpro number. If pop-up windows occur during execution, you can get the program name and screen number by pressing F1 on any field or button on the screen.
    The technical info pop-up shows not only the field information but also the program and screen.
    ? For each field, check box, and radio button on each screen, press F1 (help) and then choose Technical Info.
    Note the following information:
    - The field name for batch input, which you?ll find in its own box.
    - The length and data type of the field. You can display this information by double clicking on the Data Element field.
    ? Find out the identification code for each function (button or menu) that you must execute to process the batch-input data (or to go to new screen).
    Place the cursor on the button or menu entry while holding down the left mouse button. Then press F1.
    In the pop-up window that follows, choose Technical info and note the code that is shown in the Function field.
    You can also run any function that is assigned to a function key by way of the function key number. To display the list of available function keys, click on the right mouse button. Note the key number that is assigned to the functions you want to run.
    Once you have program name, screen number, field name (screen field name), you can start writing.
    DATA TRANSFER program.
    Declaring internal table
    First Integral Table similar to structure like local file.
    Declaring internal table like BDCDATA
    The data from internal table is not transferred directly to database table, it has to go through transaction. You need to pass data to particular screen and to particular screen-field. Data is passed to transaction in particular format, hence there is a need for batch input structure.
    The batch input structure stores the data that is to be entered into SAP system and the actions that are necessary to process the data. The batch input structure is used by all of the batch input methods. You can use the same structure for all types of batch input, regardless of whether you are creating a session in the batch input queue or using CALL TRANSACTION.
    This structure is BDCDATA, which can contain the batch input data for only a single run of a transaction. The typical processing loop in a program is as follows:
    ? Create a BDCDATA structure
    ? Write the structure out to a session or process it with CALL TRANSACTION USING; and then
    ? Create a BDCDATA structure for the next transaction that is to be processed.
    Within a BDCDATA structure, organize the data of screens in a transaction. Each screen that is processed in the course of a transaction must be identified with a BDCDATA record. This record uses the Program, Dynpro, and Dynbegin fields of the structure.
    The screen identifier record is followed by a separate BDCDATA record for each value, to be entered into a field. These records use the FNAM and FVAL fields of the BDCDATA structure. Values to be entered in a field can be any of the following:
    ? Data that is entered into screen fields.
    ? Function codes that are entered into the command field. Such function codes execute functions in a transaction, such as Save or Enter.
    The BDCDATA structure contains the following fields:
    ? PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.
    ? DYNPRO: Screen Number. Set this field only in the first record for the screen.
    ? DYNBEGIN: Indicates the first record for the screen. Set this field to X, only for the first record for the screen. (Reset to ? ? (blank) for all other records.)
    ? FNAM: Field Name. The FNAM field is not case-sensitive.
    ? FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.
    Transferring data from local file to internal table
    Data is uploaded to internal table by UPLOAD of WS_UPLOAD function.
    Population of BDCDATA
    For each record of internal table, you need to populate Internal table, which is similar to BDCDATA structure.
    All these five initial steps are necessary for any type of BDC interface.
    DATA TRANSFER program can call SESSION METHOD or CALL TRANSACTION. The initial steps for both the methods are same.
    First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.
    SESSION METHOD
    About Session method
    In this method you transfer data from internal table to database table through sessions.
    In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.
    Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
    When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.
    Unless session is processed, the data is not transferred to database table.
    BDC_OPEN_GROUP
    You create the session through program by BDC_OPEN_GROUP function.
    Parameters to this function are:
    ? User Name: User name
    ? Group: Name of the session
    ? Lock Date: The date on which you want to process the session.
    ? Keep: This parameter is passed as ?X? when you want to retain session after
    processing it or ? ? to delete it after processing.
    BDC_INSERT
    This function creates the session & data is transferred to Session.
    Parameters to this function are:
    ? Tcode: Transaction Name
    ? Dynprotab: BDC Data
    BDC_CLOSE_GROUP
    This function closes the BDC Group. No Parameters.
    Some additional information for session processing
    When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.
    However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.
    If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.
    CALL TRANSACTION
    About CALL TRANSACTION
    A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program by
    Call transaction <tcode> using <BDCTAB>
    Mode <A/N/E>
    Update <S/A>
    Messages into <MSGTAB>.
    Parameter ? 1 is transaction code.
    Parameter ? 2 is name of BDCTAB table.
    Parameter ? 3 here you are specifying mode in which you execute transaction
    A is all screen mode. All the screen of transaction are displayed.
    N is no screen mode. No screen is displayed when you execute the transaction.
    E is error screen. Only those screens are displayed wherein you have error record.
    Parameter ? 4 here you are specifying update type by which database table is updated.
    S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.
    A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).
    Parameter ? 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:
    1. Tcode: Transaction code
    2. Dyname: Batch point module name
    3. Dynumb: Batch input Dyn number
    4. Msgtyp: Batch input message type (A/E/W/I/S)
    5. Msgspra: Batch input Lang, id of message
    6. Msgid: Message id
    7. MsgvN: Message variables (N = 1 - 4)
    For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).
    Steps for CALL TRANSACTION method
    1. Internal table for the data (structure similar to your local file)
    2. BDCTAB like BDCDATA
    3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)
    4. Loop at itab.
    Populate BDCTAB table.
    Call transaction <tcode> using <BDCTAB>
    Mode <A/N/E>
    Update <S/A>.
    Refresh BDCTAB.
    Endloop.
    (To populate BDCTAB, You need to transfer each and every field)
    The major differences between Session method and Call transaction are as follows:
    SESSION METHOD CALL TRANSACTION
    1. Data is not updated in database table unless Session is processed. Immediate updation in database table.
    2. No sy-subrc is returned. Sy-subrc is returned.
    3. Error log is created for error records. Errors need to be handled explicitly
    4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.
    Error Handling in CALL TRANSACTION
    When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:
    Steps for the error handling in CALL TRANSACTION
    1. Internal table for the data (structure similar to your local file)
    2. BDCTAB like BDCDATA
    3. Internal table BDCMSG like BDCMSGCOLL
    4. Internal table similar to Ist internal table
    (Third and fourth steps are for error handling)
    5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)
    6. Loop at itab.
    Populate BDCTAB table.
    Call transaction <tr.code> using <Bdctab>
    Mode <A/N/E>
    Update <S/A>
    Messages <BDCMSG>.
    Perform check.
    Refresh BDCTAB.
    Endloop.
    7 Form check.
    IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).
    Call function Format_message.
    (This function is called to store the message given by system and to display it along with record)
    Append itab2.
    Display the record and message.
    DIRECT INPUT
    Thanks &regards,
    Sravani

  • BOE XI 3.1: Problem with Simple Report Filter.

    Hi everyone!.
    One requirement that i have in one customer is about the use of simple reports filters, the customer doesn't want to use the input controls.
    If i add one simple report filter and save the report, the final user can add other simple report filters, but the problem is that the name "Others" appears with all the variables than i have created to be used in the report.
    Is it possible to hide the group "Others"?
    Thanks!
    Edited by: Jaime Pestaña on Mar 12, 2010 10:26 AM

    If I understood you clearly, I think you have few variables created and one set of variable is called Others and you dont want users to see it.
    There are couple of things you can do.
    First one is to Use Othere filters as constant and it will not appear.
    Second you can use others filter at Report level and it will not prompt to users.
    Bashir Awan

  • Problem when down loading a simple report to Excel sheet

    HI Frenz,
    When I download a Simple report to excel , The Excel shows a blank column in between two column, which should not be the case.
    Kindly let me know ASAP
    Regards
    Irfan

    Hi,
    Check out the below samle code
    Download a report to excel with format (border, color cell, etc) 
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    * this report demonstrates how to send some ABAP data to an
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    * table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    * read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    * display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    * display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    *  PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    * get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    * add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    * copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    * changes by Kishore  - start
    *  CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    * add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    * tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    * copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    * changes by Kishore  - end
    * disconnect from Excel
    *      CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
    *       FORM FILL_CELL                                                *
    *       sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
    *       outputs OLE error if any                                       *
    *  -->  p1        text
    *  <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Cheers,
    Chandru

  • Call program screen in ABAP Report

    I have a execute program which match to a transaction, in the program, which will generate a selection screen and do selection. After that, the program will call another program screen to do somethings, i want to know can i call program's screen in my execute report, thanks

    Hi
    To Call the Transaction :
      CALL TRANSACTION '<TCODE>' AND SKIP FIRST SCREEN.
    To call a Report :
      SUBMIT <REPORT> USING SELECTION-SCREEN <NO>.
    <b>Reward if Helpful</b>

  • How deploying a simple report as .jsp

    Hi,
    i have read the last days many document, and messages on this board.
    But I could not find answers.
    My problem is:
    I create a simple report with reportbuilder and save this to mysample.jsp.
    I copy this file to Oracle Application Server j2ee\OC4J_BI_Forms\applications\reports\web\.
    When i call the report from web http://myservername/reports/mysample.jsp?userid=.
    The server return follow error:
    Anforderungs-URI:/reports/JSP_Demo.jsp
    Exception:
    java.io.FileNotFoundException
    Oracle Application Server Forms and Reports Services 10g (9.0.4.0.1) for Microsoft Windows with Patch Set 2 (9.0.4.2.0)

    Are you sure you're copting the Reports to the right place. There's a difference running Developer Suite and Application Server. Check documentation and/or Metalink. Also, I would place this question next time in the Reports forum, not in the Application Server (General) forum:
    Reports
    Martin

  • Simple report on ABAP OBJECTS

    Hi Experts,
         Can any body send one simple report using abap object....
    Thanks
    kris

    Hi,
    Check this example..
    CLASS MY_CLASS DEFINITION.
    PUBLIC SECTION.
    METHODS: ADDITION IMPORTING IP_1 TYPE INT4
    IP_2 TYPE INT4
    EXPORTING OP_1 TYPE INT4,
    SUBTRACTION IMPORTING IP_1 TYPE INT4
    IP_2 TYPE INT4
    EXPORTING OP_1 TYPE INT4.
    ENDCLASS.
    CLASS MY_CLASS IMPLEMENTATION.
    METHOD ADDITION.
    OP_1 = IP_1 + IP_2.
    ENDMETHOD.
    METHOD SUBTRACTION.
    OP_1 = IP_1 - IP_2.
    ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
    DATA: OBJ TYPE REF TO MY_CLASS.
    CREATE OBJECT OBJ.
    DATA: V_OUTPUT TYPE INT4.
    CALL METHOD OBJ->ADDITION EXPORTING IP_1 = 1
    IP_2 = 3
    IMPORTING OP_1 = V_OUTPUT.
    WRITE: / V_OUTPUT.
    Thanks,
    Naren

  • How to insert LOGO in a simple report output

    Hi all,
    I need to insert a logo in a simple report output. can anybody help me

    Hi Anil,
    First upload logo to SAP by T-Code -SE78 or check the name of the logo that you want in your programm..
    then
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = G_HEADER.
       I_LOGO                   =                                                "Logo name
       I_END_OF_LIST_GRID       =
    ENDFORM.
    Thanks.

  • How to call a process in a report?

    Hi Friends,
    Is there any standard Function Module or something like callprocess   to call a process in the tcode     hrasr_test _process ?
    With Regaeds,
    SHARMILA BRINDHA.M

    HI Friend,
    Thank You for your reply.But my requirement is completely different.No need to call Function module.
    I was in need to call a process in my report from the  tcode hrasr_test_porocess.
    With Regards,
    SHARMILA BRINDHA.M

  • Call a Tcode from different program

    Hi frieds,
    How to call a Tcode using a push button in another report.
    Eg:   Tcode =  Ztest.  (for invoice list report, using 
                            the program zinvlist).
          This Ztest should be called in another report
          Zrep1 (program name Zsale) using the push button.
    Regards,
    A S VINCENT

    Hai Vincent
    *&      Form  DISPLAY_SEC1
         TO CALL TRANSACTION ME23
    form DISPLAY_SEC1.
    <b> SET PARAMETER ID 'BES' FIELD IT_EKKO-EBELN.
    CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.</b>endform.                    " DISPLAY_SEC1
    also I will send you Some Sample Code
    *& Report  ZSSSS1                                                      *
    REPORT  ZSSSS1  LINE-SIZE 120
                    LINE-COUNT 25(3)
                    MESSAGE-ID ZSAN.
    *Program Desc: INTERACTIVE REPORT FOR PURCHASE ORDER DETAILS
                   BASIC LIST CONTAINS HEADER DETAILS
                   SECONDARY LIST CONTAINS ITEM DETAILS
                      AND CONDETION RECORD DETAILS
       T A B L E S         U S E D                                   *
    TABLES: EKKO,EKPO,KONV,LFA1,T001.
       S E L E C T I O N     S C R E E N                             *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
    SELECT-OPTIONS:
          S_LIFNR FOR EKKO-LIFNR,
          S_BUKRS FOR EKKO-BUKRS.
    SELECTION-SCREEN END OF BLOCK B1.
       D A T A   D E C L A R A T I O N S                             *
    DATA: BEGIN OF IT_EKKO OCCURS 0,
              BUKRS LIKE EKKO-BUKRS,
              LIFNR LIKE EKKO-LIFNR,
              EBELN LIKE EKKO-EBELN,
              KNUMV LIKE EKKO-KNUMV,
          END OF IT_EKKO.
    DATA: BEGIN OF IT_EKPO OCCURS 0,
              EBELN LIKE EKPO-EBELN,
              EBELP LIKE EKPO-EBELP,
              MATNR LIKE EKPO-MATNR,
              INFNR LIKE EKPO-INFNR,
              MENGE LIKE EKPO-MENGE,
              MEINS LIKE EKPO-MEINS,
              NETPR LIKE EKPO-NETPR,
          END OF IT_EKPO.
    DATA: BEGIN OF IT_KONV OCCURS 0,
              KNUMV LIKE KONV-KNUMV,
              KSCHL LIKE KONV-KSCHL,
              KAWRT LIKE KONV-KAWRT,
              KBETR LIKE KONV-KBETR,
              KPOSN LIKE KONV-KPOSN,
          END OF IT_KONV.
    DATA: BEGIN OF IT_LFA1 OCCURS 0,
              LIFNR LIKE LFA1-LIFNR,
              NAME1 LIKE LFA1-NAME1,
              STRAS LIKE LFA1-STRAS,
              ORT01 LIKE LFA1-ORT01,
              PSTLZ LIKE LFA1-PSTLZ,
              LAND1 LIKE LFA1-LAND1,
          END OF IT_LFA1.
    DATA: V_BUTXT LIKE T001-BUTXT,
          FNAM(20) TYPE C,
          FVAL(20) TYPE C.
      A T    S E L E C T I O N - S C R E E N    O N    <FIELD>       *
    AT SELECTION-SCREEN ON S_BUKRS.
      PERFORM VALIDATE.
      S T A R T - O F - S E L E C T I O N                            *
    START-OF-SELECTION.
      PERFORM SELECT_DATA.   " SELECTION OF ALL DATA
      PERFORM DISPLAY_DATA.  " DISPLAY OF BASIC LIST
      A T   L I N E   S E L E C T I O N                              *
    AT LINE-SELECTION.
      GET CURSOR FIELD FNAM VALUE FVAL.
      CASE FNAM.
      WHEN 'IT_EKKO-EBELN'.
            PERFORM DISPLAY_SEC1.
      WHEN 'IT_EKKO-LIFNR'.
            PERFORM DISPLAY_SEC2.
      WHEN OTHERS.
            PERFORM DISPLAY_SEC3.
      ENDCASE.
      T O P - O F - P A G E                                          *
    TOP-OF-PAGE.
      PERFORM WRITE_HEADER.
      T O P - O F - P A G E   D U R I N G   L I N E  S E L           *
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM WRITE_HEADER2.
      E N D - O F - P A G E                                          *
    END-OF-PAGE.
      PERFORM WRITE_FOOTER.
    *&      Form  SELECT_DATA
          THIS FORM CONTAINS ALL SELECTION OF DATA STATEMENTS
    form SELECT_DATA.
    SELECT  BUKRS LIFNR EBELN KNUMV
            FROM EKKO
            INTO TABLE IT_EKKO
            WHERE LIFNR IN S_LIFNR
            AND BUKRS IN S_BUKRS.
    IF NOT IT_EKKO[] IS INITIAL.
    SELECT   EBELN EBELP MATNR INFNR MENGE MEINS NETPR
          FROM EKPO
          INTO TABLE IT_EKPO
          FOR ALL ENTRIES IN IT_EKKO
          WHERE EBELN = IT_EKKO-EBELN.
    IF SY-SUBRC = 0.
      LOOP AT IT_EKKO.
       LOOP AT IT_EKPO.
        SELECT  KNUMV KSCHL KAWRT KBETR KPOSN
                FROM KONV
                INTO IT_KONV
                WHERE KNUMV = IT_EKKO-KNUMV
                AND KPOSN = IT_EKPO-EBELP.
          APPEND IT_KONV.
        ENDSELECT.
      ENDLOOP.
    ENDLOOP.
    ENDIF." END OF IF FOR CHECK OF SY-SUBRC
       SELECT  LIFNR NAME1 STRAS ORT01 PSTLZ LAND1
               INTO TABLE IT_LFA1
               FROM LFA1
               FOR ALL ENTRIES IN IT_EKKO
               WHERE LIFNR = IT_EKKO-LIFNR.
    ENDIF." END OF IF FOR IT_EKKO IS NOT INITIAL
    endform.                    " SELECT_DATA
    *&      Form  DISPLAY_DATA
          DISPLAY THE BASIC DATA
    form DISPLAY_DATA.
      DATA: LINNO TYPE I.
      SORT IT_EKKO BY BUKRS LIFNR EBELN.
      LOOP AT IT_EKKO.
        READ TABLE IT_LFA1 WITH KEY LIFNR = IT_EKKO-LIFNR.
        SELECT SINGLE BUTXT
                      FROM T001
                      INTO (V_BUTXT)
                      WHERE BUKRS = IT_EKKO-BUKRS.
        WRITE:/1 SY-VLINE,
                (10) IT_EKKO-EBELN HOTSPOT ON,
                  SY-VLINE,
                (10) IT_EKKO-LIFNR HOTSPOT ON,
                  SY-VLINE,
                (15) IT_LFA1-NAME1 HOTSPOT ON,
                   SY-VLINE,
                (10) IT_EKKO-BUKRS HOTSPOT ON,
                  SY-VLINE,
                (15) V_BUTXT,
                 75 SY-VLINE.
                 HIDE: IT_EKKO-EBELN,
                       IT_EKKO-LIFNR.
         WRITE:/1(75) SY-ULINE.
        AT END OF LIFNR.
          LINNO = SY-LINCT - SY-LINNO - 1.
          SKIP LINNO.
        ENDAT.
      ENDLOOP.
    endform.                    " DISPLAY_DATA
    *&      Form  DISPLAY_SEC3
    form DISPLAY_SEC3.
      LOOP AT IT_EKPO.
         CLEAR: IT_EKPO, IT_KONV.
       READ TABLE IT_EKPO WITH KEY EBELN = IT_EKKO-EBELN.
        IF SY-SUBRC = 0.
              FORMAT COLOR 3.
              WRITE:/1 SY-VLINE,
                    (10) IT_EKPO-EBELN,
                    SY-VLINE,
                    (10) IT_EKPO-EBELP,
                    SY-VLINE,
                    (18) IT_EKPO-MATNR,
                    SY-VLINE,
                    (10) IT_EKPO-INFNR,
                    SY-VLINE,
                    (15) IT_EKPO-MENGE,
                    SY-VLINE,
                    (10) IT_EKPO-MEINS,
                     SY-VLINE,
                    (12) IT_EKPO-NETPR,
                      105  SY-VLINE.
               FORMAT COLOR OFF.
              WRITE:/1(105) SY-ULINE.
              FORMAT COLOR 4.
        READ TABLE IT_KONV WITH KEY KPOSN = IT_EKPO-EBELP.
         IF SY-SUBRC = 0.
          WRITE:/1 SY-VLINE,
               (10) IT_KONV-KNUMV,
               SY-VLINE,
               (10) IT_KONV-KSCHL,
               SY-VLINE,
               (15) IT_KONV-KAWRT,
               SY-VLINE,
               (12) IT_KONV-KBETR,
               SY-VLINE.
          WRITE:/1(95) SY-ULINE.
         FORMAT COLOR OFF.
       ENDIF.
    ENDIF.
    ENDLOOP.
    endform.                    " DISPLAY_SEC3
    *&      Form  DISPLAY_SEC1
         TO CALL TRANSACTION ME23
    form DISPLAY_SEC1.
    SET PARAMETER ID 'BES' FIELD IT_EKKO-EBELN.
    CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
    endform.                    " DISPLAY_SEC1
    *&      Form  WRITE_HEADER
            HEADER DISPLAY
    form WRITE_HEADER.
    FORMAT COLOR 3.
    WRITE:/1 SY-VLINE,
                (10) 'PUR.ORDER',
                  SY-VLINE,
                (10) 'VENDOR',
                  SY-VLINE,
                (15) 'NAME',
                   SY-VLINE,
                (10) 'COMP.CODE',
                  SY-VLINE,
                (15) 'COMP.DESC',
                 75 SY-VLINE.
    WRITE:/1(75) SY-ULINE.
    FORMAT COLOR OFF.
    endform.                    " WRITE_HEADER
    *&      Form  WRITE_FOOTER
    FOOTER OF LIST
    form WRITE_FOOTER.
    FORMAT COLOR 4.
    WRITE: /1 'USER:',SY-UNAME,
            45 'DATE:', SY-DATUM.
    FORMAT COLOR OFF.
    endform.                    " WRITE_FOOTER
    *&      Form  WRITE_HEADER2
             HEADER FOR SECONDARY LIST
    form WRITE_HEADER2.
          FORMAT COLOR 4.
          WRITE: /30 'INTELLIGROUP ASIA PVT LTD' CENTERED.
          WRITE:/50  'HYDERABAD' CENTERED.
              FORMAT COLOR 5.
               WRITE:/1 SY-VLINE,
                    (10) 'PUR.ORDR',
                    SY-VLINE,
                    (10) 'ITEM',
                    SY-VLINE,
                    (18) 'MATERIAL NUMBER',
                    SY-VLINE,
                    (10) 'INFO.RECD',
                    SY-VLINE,
                    (15) 'QUANTITY',
                    SY-VLINE,
                    (10) 'UNITS',
                     SY-VLINE,
                    (12) 'NETPRICE',
                      105  SY-VLINE.
               FORMAT COLOR OFF.
              WRITE:/1(105) SY-ULINE.
               FORMAT COLOR 6.
               WRITE:/1 SY-VLINE,
               (10) 'COND.RECD',
               SY-VLINE,
               (10) 'TYPE',
               SY-VLINE,
               (15) 'BASE VALUE',
               SY-VLINE,
               (12) 'AMOUNT',
               SY-VLINE.
               FORMAT COLOR OFF.
          WRITE:/1(95) SY-ULINE.
    endform.                    " WRITE_HEADER2
    *&      Form  DISPLAY_SEC2
       TO DISPLAY VENDOR DETAILS IN POP UP WINDOW
    form DISPLAY_SEC2.
    READ TABLE IT_LFA1 WITH KEY LIFNR = IT_EKKO-LIFNR.
    IF SY-SUBRC = 0.
      WRITE:/   'NAME IS:' ,   IT_LFA1-NAME1,
            /   'STREET IS:',  IT_LFA1-STRAS,
            /   'CITY  IS:',   IT_LFA1-ORT01,
            /   'POSTEL CODE IS:',IT_LFA1-PSTLZ,
            /   'COUNTRY IS: ', IT_LFA1-LAND1.
      WINDOW STARTING AT 1  15
             ENDING   AT 50 20.
    ENDIF.
    endform.                    " DISPLAY_SEC2
    *&      Form  VALIDATE
      VALIDATE BUKRS
    form VALIDATE.
    SELECT SINGLE *
                FROM T001
                WHERE BUKRS IN S_BUKRS.
    IF SY-SUBRC <> 0.
      MESSAGE E001.
    ENDIF.
    endform.                    " VALIDATE
    Thanks & regards
    Sreenivasulu P

  • Calling sap tcode inback ground processing

    how to call sap tcdoe se38 in back ground processing.
    is - submit se38 - is enough.

    hi
    you cannot submit a t-code.
    you have to submit an executable program
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba51a35c111d1829f0000e829fbfe/content.htm
    or
    create a t-code for your report and then call the tcode.
    thx
    pavan

  • Simple reports and ALV

    Hi all,
    Following is mt requirement,
    On the first screen user should enter Purchase order no
    As he submits it there should be purchase order details should be displayed. in another window
    This  requirementi want it to be presented in Simple report, ALv using Function modules and ALV using OO Concept.
    Please help me with the coding . its urgent.

    Hi,
        As ur requirement is like enter po number and get the po details.........
    Here is an example...........
    REPORT yktest.
    *& TABLES DECLARATION *
    TABLES : ekko, ekpo, t001w, t161t, lfa1.
    *& INTERNAL TABLE DECLARATION *
    TYPES : BEGIN OF tp_itab1,
    bukrs TYPE ekko-bukrs,
    lifnr TYPE ekko-lifnr,
    ebeln TYPE ekko-ebeln,
    waers TYPE ekko-waers,
    bsart TYPE ekko-bsart,
    ekorg TYPE ekko-ekorg,
    ekgrp TYPE ekko-ekgrp,
    ebelp TYPE ekpo-ebelp,
    txz01 TYPE ekpo-txz01,
    matnr TYPE ekpo-matnr,
    werks TYPE ekpo-werks,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    netwr TYPE ekpo-netwr,
    name1 TYPE t001w-name1,
    header_text(132),
    chk TYPE c,
    END OF tp_itab1.
    DATA : t_itab1 TYPE STANDARD TABLE OF tp_itab1,
    wa_itab1 TYPE tp_itab1,
    ws_name1 TYPE t001w-name1.
    DATA : f_itab1 TYPE STANDARD TABLE OF tp_itab1,
    wa_fitab1 TYPE tp_itab1.
    DATA : f_itab2 TYPE STANDARD TABLE OF tp_itab1,
    wa_fitab2 TYPE tp_itab1.
    TYPES : BEGIN OF tp_name1,
    werks TYPE t001w-werks,
    name1 TYPE t001w-name1,
    END OF tp_name1.
    DATA : t_name1 TYPE STANDARD TABLE OF tp_name1,
    wa_name1 TYPE tp_name1.
    DATA : t_lfa1 TYPE STANDARD TABLE OF lfa1,
    wa_lfa1 TYPE lfa1.
    DATA: hold_tabix TYPE sy-tabix.
    DATA : t_tlinetab TYPE STANDARD TABLE OF tline,
    wa_tlinetab TYPE tline.
    DATA: ws_name TYPE thead-tdname,
    ws_repid TYPE sy-repid VALUE 'YKTEST'.
    DATA : repid TYPE sy-repid.
    DATA : total TYPE p DECIMALS 2,
    quantity TYPE p DECIMALS 3.
    CONSTANTS : ws_id TYPE thead-tdid VALUE 'F01',
    ws_object TYPE thead-tdobject VALUE 'EKKO',
    lc_view(1) TYPE c VALUE 'F',
    lc_form(10) TYPE c VALUE 'YK_FORM'.
    *& ALV DECLARATION *
    TYPE-POOLS : slis.
    DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
    lf_fieldcat TYPE slis_fieldcat_alv.
    DATA: lh_index LIKE lf_fieldcat-col_pos.
    DATA: l_layout TYPE slis_layout_alv.
    DATA : l_sort TYPE slis_t_sortinfo_alv,
    w_sort TYPE slis_sortinfo_alv.
    *& SELECTION-SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 2.
    SELECT-OPTIONS: s_bukrs FOR ekko-bukrs OBLIGATORY.
    SELECT-OPTIONS: s_lifnr FOR ekko-lifnr OBLIGATORY.
    SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
    PARAMETERS: p_bsart TYPE ekko-bsart.
    SELECT-OPTIONS: s_matnr FOR ekpo-matnr.
    SELECT-OPTIONS: s_ekorg FOR ekko-ekorg.
    SELECT-OPTIONS: s_ekgrp FOR ekko-ekgrp.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN END OF BLOCK a1.
    *& START-OF-SELECTION *
    START-OF-SELECTION.
    FETCHING DATA
    PERFORM fetch_data.
    BUILD FIELD CATALOG
    PERFORM build_fieldcatalog.
    BUILD LAYOUT
    PERFORM build_layout.
    SORT LAYOUT
    PERFORM sort_layout.
    *& END-OF-SELECTION. *
    END-OF-SELECTION.
    *DISPLAY GRID
    PERFORM display_grid.
    *& Form fetch_data *
    FORM fetch_data.
    IF p_bsart IS INITIAL.
    SELECT ekko~bukrs
    ekko~lifnr
    ekko~ebeln
    ekko~waers
    ekko~bsart
    ekko~ekorg
    ekko~ekgrp
    ekpo~ebelp
    ekpo~txz01
    ekpo~matnr
    ekpo~werks
    ekpo~menge
    ekpo~meins
    ekpo~netpr
    ekpo~netwr
    INTO TABLE t_itab1 FROM
    ekko INNER JOIN ekpo ON ekkoebeln = ekpoebeln
    WHERE ekko~ebeln IN s_ebeln AND
    ekko~bukrs IN s_bukrs AND
    ekko~lifnr IN s_lifnr AND
    ekko~ekorg IN s_ekorg AND
    ekko~ekgrp IN s_ekgrp AND
    ekpo~matnr IN s_matnr.
    ELSE.
    SELECT ekko~bukrs
    ekko~lifnr
    ekko~ebeln
    ekko~waers
    ekko~bsart
    ekko~ekorg
    ekko~ekgrp
    ekpo~ebelp
    ekpo~txz01
    ekpo~matnr
    ekpo~werks
    ekpo~menge
    ekpo~meins
    ekpo~netpr
    ekpo~netwr
    INTO TABLE t_itab1 FROM
    ekko INNER JOIN ekpo ON ekkoebeln = ekpoebeln
    WHERE ekko~ebeln IN s_ebeln AND
    ekko~bukrs IN s_bukrs AND
    ekko~lifnr IN s_lifnr AND
    ekko~ekorg IN s_ekorg AND
    ekko~ekgrp IN s_ekgrp AND
    ekpo~matnr IN s_matnr AND
    ekko~bsart = p_bsart.
    ENDIF.
    IF NOT t_itab1[] IS INITIAL.
    FETCHING NAME1
    SELECT werks
    name1
    FROM t001w
    INTO TABLE t_name1
    FOR ALL ENTRIES IN t_itab1
    WHERE werks = t_itab1-werks.
    SORT t_itab1 BY werks.
    SORT t_name1 BY werks.
    IF sy-subrc = 0.
    LOOP AT t_itab1 INTO wa_itab1.
    hold_tabix = sy-tabix.
    READ TABLE t_name1 INTO wa_name1 WITH KEY werks = wa_itab1-werks
    BINARY SEARCH.
    IF sy-subrc = 0.
    wa_itab1-name1 = wa_name1-name1.
    MODIFY t_itab1 INDEX hold_tabix FROM wa_itab1.
    ENDIF.
    FETCHING HEADER TEXT
    MOVE wa_itab1-ebeln TO ws_name.
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    id = ws_id
    language = sy-langu
    name = ws_name
    object = ws_object
    TABLES
    lines = t_tlinetab
    EXCEPTIONS
    id = 1
    language = 2
    name = 3
    not_found = 4
    object = 5
    reference_check = 6
    wrong_access_to_archive = 7
    OTHERS = 8.
    IF sy-subrc = 0.
    LOOP AT t_tlinetab INTO wa_tlinetab.
    wa_itab1-header_text = wa_tlinetab-tdline.
    MODIFY t_itab1 FROM wa_itab1.
    ENDLOOP.
    ENDIF. " IF sy-subrc = 0.
    CLEAR : wa_itab1,
    hold_tabix,
    wa_name1.
    ENDLOOP.
    ENDIF.
    ENDIF. " IF NOT t_itab1[] IS INITIAL.
    IF t_itab1[] IS INITIAL.
    MESSAGE i000(zg) WITH text-008.
    ENDIF.
    SORT : t_itab1 BY bukrs lifnr ebeln ebelp.
    ENDFORM. " fetch_data
    *& Form build_fieldcatalog *
    FORM build_fieldcatalog .
    COMPANY CODE
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'BUKRS'.
    lf_fieldcat-ref_tabname = 'EKKO'.
    lf_fieldcat-ref_fieldname = 'BUKRS'.
    lf_fieldcat-fix_column = 'X'.
    APPEND lf_fieldcat TO lt_fieldcat.
    VENDOR
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'LIFNR'.
    lf_fieldcat-ref_tabname = 'EKKO'.
    lf_fieldcat-ref_fieldname = 'LIFNR'.
    lf_fieldcat-fix_column = 'X'.
    APPEND lf_fieldcat TO lt_fieldcat.
    PURCHASING DOCUMENT NUMBER
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'EBELN'.
    lf_fieldcat-ref_tabname = 'EKKO'.
    lf_fieldcat-ref_fieldname = 'EBELN'.
    lf_fieldcat-key = 'X'.
    lf_fieldcat-do_sum = 'X'.
    lf_fieldcat-fix_column = 'X'.
    APPEND lf_fieldcat TO lt_fieldcat.
    ITEM NUMBER OF PURCHASING DOCUMENT
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'EBELP'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'EBELP'.
    APPEND lf_fieldcat TO lt_fieldcat.
    SHORT TEXT
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'TXZ01'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'TXZ01'.
    APPEND lf_fieldcat TO lt_fieldcat.
    MATERIAL NUMBER
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'MATNR'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'MATNR'.
    APPEND lf_fieldcat TO lt_fieldcat.
    PLANT
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'WERKS'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'WERKS'.
    APPEND lf_fieldcat TO lt_fieldcat.
    NAME
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'NAME1'.
    lf_fieldcat-ref_tabname = 'T001W'.
    lf_fieldcat-ref_fieldname = 'NAME1'.
    APPEND lf_fieldcat TO lt_fieldcat.
    PURCHASE ORDER QUANTITY
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'MENGE'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'MENGE'.
    lf_fieldcat-do_sum = 'X'.
    lf_fieldcat-qfieldname = 'MEINS'.
    APPEND lf_fieldcat TO lt_fieldcat.
    UNIT
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'MEINS'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'MEINS'.
    APPEND lf_fieldcat TO lt_fieldcat.
    NET PRICE IN PURCHASING DOCUMENT
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'NETPR'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'NETPR'.
    lf_fieldcat-cfieldname = 'WAERS'.
    lf_fieldcat-do_sum = 'X'.
    APPEND lf_fieldcat TO lt_fieldcat.
    NET ORDER VALUE IN PO CURRENCY
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'NETWR'.
    lf_fieldcat-ref_tabname = 'EKPO'.
    lf_fieldcat-ref_fieldname = 'NETWR'.
    lf_fieldcat-cfieldname = 'WAERS'.
    lf_fieldcat-do_sum = 'X'.
    APPEND lf_fieldcat TO lt_fieldcat.
    CURRENCY
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'WAERS'.
    lf_fieldcat-ref_tabname = 'EKKO'.
    lf_fieldcat-ref_fieldname = 'WAERS'.
    APPEND lf_fieldcat TO lt_fieldcat.
    HEADER TEXT
    CLEAR lf_fieldcat.
    lf_fieldcat-fieldname = 'HEADER_TEXT'.
    lf_fieldcat-seltext_m = 'Header Text'.
    APPEND lf_fieldcat TO lt_fieldcat.
    ENDFORM. " build_fieldcatalog
    *& Form display_grid *
    FORM display_grid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = ws_repid
    i_callback_pf_status_set = 'PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = l_layout
    it_fieldcat = lt_fieldcat
    it_sort = l_sort
    i_save = 'X'
    IMPORTING
    TABLES
    t_outtab = t_itab1
    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.
    ENDFORM. " display_grid
    *& Form build_layout *
    FORM build_layout .
    l_layout-colwidth_optimize = 'X'.
    l_layout-zebra = 'X'.
    l_layout-box_fieldname = 'CHK'.
    l_layout-box_tabname = 'T_ITAB1' .
    ENDFORM. " build_layout
    *& Form sort_layout *
    FORM sort_layout .
    CLEAR w_sort.
    w_sort-fieldname = 'BUKRS'.
    w_sort-tabname = 'T_ITAB1'.
    w_sort-spos = 1.
    w_sort-up = 'X'.
    w_sort-subtot = 'X'.
    APPEND w_sort TO l_sort.
    CLEAR w_sort.
    w_sort-fieldname = 'EBELN'.
    w_sort-tabname = 'T_ITAB1'.
    w_sort-spos = 1.
    w_sort-up = 'X'.
    w_sort-subtot = 'X'.
    APPEND w_sort TO l_sort.
    ENDFORM. " sort_layout
    *& Form PF_STATUS
    FORM pf_status USING rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'STANDARD1' EXCLUDING rt_extab.
    ENDFORM. " PF_STATUS

Maybe you are looking for