ALV to PDF output format

Hi Experts,
I am using following code to convert Alv report to pdf format..........can i change the number of output lines shown in the pdf
DATA :
       WA_TSTC              TYPE TSTC,
       WA_TSTCP             TYPE TSTCP,
       SM30_PARA            TYPE TSTCP-PARAM,
       IT_PARAM             TYPE STANDARD TABLE OF STRING,
       WA_PARAM             TYPE STRING,
       GV_REPORT            TYPE SY-REPID,
       GV_PARAMS            TYPE PRI_PARAMS,
       GV_VALID             TYPE STRING,
       GV_RQIDENT           TYPE TSP01-RQIDENT,
       GT_RSPARAMS          TYPE STANDARD TABLE OF RSPARAMS,
       WA_TSP01             TYPE TSP01,
       GV_SPOOL             TYPE TSP01-RQIDENT,
       GV_RQ2NAME           TYPE TSP01-RQ2NAME,
       PDF_BYTECOUNT         TYPE  I,
       PDF_SPOOLID           LIKE  TSP01-RQIDENT,
       LIST_PAGECOUNT       TYPE I,
       BTC_JOBNAME           TYPE  TBTCJOB-JOBNAME,
       BTC_JOBCOUNT         TYPE  TBTCJOB-JOBCOUNT,
       BIN_FILE             TYPE XSTRING,
       GT_PDF               TYPE STANDARD TABLE OF TLINE,
       GV_BIN_FILESIZE      TYPE I, " Binary File Size
       GV_FILE_NAME         TYPE STRING,
       GV_FILE_PATH         TYPE STRING,
       GV_FULL_PATH         TYPE STRING.
" Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT000.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (23) TEXT001 FOR FIELD P_TCODE.
PARAMETERS P_TCODE TYPE TSTC-TCODE OBLIGATORY.
SELECTION-SCREEN END OF LINE.
"Text
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (70) TEXT002.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK B1.
LOAD-OF-PROGRAM.
   TEXT000 =  'Selection Criteria'.
   TEXT001 =  '@8T@ Transaction Code'.
   TEXT002 =  '*Enter Tcode->Select Print Option->Execute report->Save PDF File'.
START-OF-SELECTION.
   "Fetch Tcode and Report info
   PERFORM FETCH_TCODE_REPORT.
   "Call Transaction
   PERFORM CALL_TRANSACTION.
   "Get Spool and Generate PDF
   PERFORM GET_SPOOL_TO_PDF.
*&      Form  FETCH_TCODE_REPORT
*       text
*  -->  p1        text
*  <--  p2        text
FORM FETCH_TCODE_REPORT .
   DATA :
          FLG_TCODE TYPE CHAR1,
          CHR1      TYPE CHAR40,
          CHR2      TYPE CHAR40.
   SELECT SINGLE * FROM TSTC
     INTO WA_TSTC WHERE TCODE = P_TCODE
                   AND PGMNA NE SPACE
                   AND DYPNO  = 1000. "only Standard Report
   IF SY-SUBRC =  0.
     FLG_TCODE = 'X'.
     GV_REPORT = WA_TSTC-PGMNA.
   ELSE.
     SELECT SINGLE * FROM
        TSTCP INTO WA_TSTCP
        WHERE TCODE = P_TCODE
          AND PARAM NE SPACE.
     SPLIT WA_TSTCP-PARAM AT ';' INTO TABLE IT_PARAM.
     LOOP AT IT_PARAM INTO WA_PARAM.
       IF WA_PARAM CS '-REPORT='.
         FLG_TCODE = 'X'.
         SPLIT WA_PARAM AT '-REPORT=' INTO CHR1 CHR2.
         GV_REPORT = CHR2.
         EXIT.
       ENDIF.
     ENDLOOP.
   ENDIF.
   IF FLG_TCODE IS INITIAL.
     MESSAGE 'In Valid Tcode' TYPE 'I' DISPLAY LIKE 'E'.
     LEAVE TO TRANSACTION SY-TCODE.
   ENDIF.
   CALL FUNCTION 'AUTH_CHECK_TCODE'
     EXPORTING
       TCODE                          = P_TCODE
     EXCEPTIONS
       PARAMETER_ERROR                = 1
       TRANSACTION_NOT_FOUND          = 2
       TRANSACTION_LOCKED             = 3
       TRANSACTION_IS_MENU            = 4
       MENU_VIA_PARAMETER_TRANSACTION = 5
       NOT_AUTHORIZED                 = 6
       OTHERS                         = 7.
   IF SY-SUBRC <> 0.
     MESSAGE 'No Authorization for Tcode' TYPE 'I' DISPLAY LIKE 'E'.
     LEAVE TO TRANSACTION SY-TCODE.
   ENDIF.
ENDFORM.                    " FETCH_TCODE_REPORT
*&      Form  CALL_TRANSACTION
*       text
*  -->  p1        text
*  <--  p2        text
FORM CALL_TRANSACTION .
   CALL FUNCTION 'GET_PRINT_PARAMETERS'
     IMPORTING
       OUT_PARAMETERS = GV_PARAMS
       VALID          = GV_VALID.
   IF SY-SUBRC <> 0.
   ENDIF.
   "Spool Mode, Default will be Spool Only
   CLEAR GV_PARAMS-PRIMM.
   "Spool Request Name, Pass Report name , Only 1st 12 Chars
   GV_RQ2NAME      = GV_REPORT.
   GV_PARAMS-PLIST = GV_RQ2NAME.
   SUBMIT (GV_REPORT) VIA SELECTION-SCREEN
                     TO SAP-SPOOL
                     SPOOL PARAMETERS GV_PARAMS
                     WITHOUT SPOOL DYNPRO
                     AND RETURN.
   IF SY-SUBRC NE 0.
     MESSAGE 'Unable to Execute Report' TYPE 'I' DISPLAY LIKE 'E'.
     LEAVE TO TRANSACTION SY-TCODE.
   ENDIF.
   WAIT UP TO 2 SECONDS.
ENDFORM.                    " CALL_TRANSACTION
*&      Form  GET_SPOOL_TO_PDF
*       text
*  -->  p1        text
*  <--  p2        text
FORM GET_SPOOL_TO_PDF .
   DATA :
       LV_RQCRETIME  TYPE TSP01-RQCRETIME,
       LV_RETURNCODE TYPE I.
   CONCATENATE SY-DATUM '%' INTO LV_RQCRETIME.
   SELECT MAX( RQIDENT ) INTO GV_SPOOL FROM TSP01  WHERE RQCLIENT = SY-MANDT
                                                   AND   RQ2NAME  = GV_RQ2NAME
                                                   AND   RQOWNER  = SY-UNAME
                                                   AND   RQCRETIME LIKE LV_RQCRETIME.
   CHECK SY-SUBRC = 0.
   SELECT SINGLE * FROM TSP01
     INTO WA_TSP01 WHERE RQIDENT = GV_SPOOL.
   IF WA_TSP01 IS INITIAL.
     MESSAGE 'No Valid Spool Request Found' TYPE 'I' DISPLAY LIKE 'E'.
     LEAVE TO TRANSACTION SY-TCODE.
   ENDIF.
   CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
     EXPORTING
       SRC_SPOOLID              = GV_SPOOL
       NO_DIALOG                = ABAP_FALSE
     IMPORTING
       PDF_BYTECOUNT            = PDF_BYTECOUNT
       PDF_SPOOLID              = PDF_SPOOLID
       BTC_JOBNAME              = BTC_JOBNAME
       BTC_JOBCOUNT             = BTC_JOBCOUNT
     TABLES
       PDF                      = GT_PDF
     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.
   CHECK GT_PDF IS NOT INITIAL.
   GV_FILE_NAME = P_TCODE.
* To display File SAVE dialog window
   CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
     EXPORTING
       WINDOW_TITLE         = 'Save Output as PDF' "LV_TITLE
       DEFAULT_EXTENSION    = 'PDF'
       FILE_FILTER          = '(*.pdf)|*.pdf|'
       DEFAULT_FILE_NAME    = GV_FILE_NAME
     CHANGING
       FILENAME             = GV_FILE_NAME
       PATH                 = GV_FILE_PATH
       FULLPATH             = GV_FULL_PATH
     EXCEPTIONS
       CNTL_ERROR           = 1
       ERROR_NO_GUI         = 2
       NOT_SUPPORTED_BY_GUI = 3
       OTHERS               = 4.
   IF SY-SUBRC <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.
* Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
* presentation server
   CHECK GV_FULL_PATH IS NOT INITIAL.
   CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
       BIN_FILESIZE            = GV_BIN_FILESIZE
       FILENAME                = GV_FULL_PATH
       FILETYPE                = 'BIN'
     TABLES
       DATA_TAB                = GT_PDF
     EXCEPTIONS
       FILE_WRITE_ERROR        = 1
       NO_BATCH                = 2
       GUI_REFUSE_FILETRANSFER = 3
       INVALID_TYPE            = 4
       NO_AUTHORITY            = 5
       UNKNOWN_ERROR           = 6
       HEADER_NOT_ALLOWED      = 7
       SEPARATOR_NOT_ALLOWED   = 8
       FILESIZE_NOT_ALLOWED    = 9
       HEADER_TOO_LONG         = 10
       DP_ERROR_CREATE         = 11
       DP_ERROR_SEND           = 12
       DP_ERROR_WRITE          = 13
       UNKNOWN_DP_ERROR        = 14
       ACCESS_DENIED           = 15
       DP_OUT_OF_MEMORY        = 16
       DISK_FULL               = 17
       DP_TIMEOUT              = 18
       FILE_NOT_FOUND          = 19
       DATAPROVIDER_EXCEPTION  = 20
       CONTROL_FLUSH_ERROR     = 21
       OTHERS                  = 22.
   IF SY-SUBRC = 0.
     MESSAGE 'File Generated Successfully' TYPE 'S'.
   ELSE.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.
ENDFORM.                    " GET_SPOOL_TO_PDF

Hi ,
Try this procedure...
DATA:SSFCTRLOP    TYPE SSFCTRLOP.
DATA:SSFCOMPOP    TYPE SSFCOMPOP.
DATA:IT_OTF_DATA  TYPE SSFCRESCL.
DATA:IT_OTF_FINAL TYPE ITCOO OCCURS 0 WITH HEADER LINE.
DATA:BIN_FILESIZE TYPE I.
DATA:IT_PDFDATA   TYPE TABLE OF TLINE.
DATA:IT_PDF       TYPE TABLE OF SOLISTI1.
DATA: ST_JOB_OUTPUT_INFO TYPE SSFCRESCL,
      ST_DOCUMENT_OUTPUT_INFO TYPE SSFCRESPD,
      ST_JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,
      IT_DOCS TYPE STANDARD TABLE OF DOCS,
      IT_LINES TYPE STANDARD TABLE OF TLINE,
      V_NAME TYPE STRING,
      V_PATH TYPE STRING,
      V_FULLPATH TYPE STRING,
      V_FILTER TYPE STRING,
      V_UACT TYPE I,
      V_GUIOBJ TYPE REF TO CL_GUI_FRONTEND_SERVICES,
      V_FILENAME TYPE STRING,
      V_BIN_FILESIZE TYPE I.
****** PDF
TYPES: T_DOCUMENT_DATA  TYPE  SODOCCHGI1,
       T_PACKING_LIST   TYPE  SOPCKLSTI1,
       T_ATTACHMENT     TYPE  SOLISTI1,
       T_BODY_MSG       TYPE  SOLISTI1,
       T_RECEIVERS      TYPE  SOMLRECI1,
       T_PDF            TYPE  TLINE.
DATA : W_DOCUMENT_DATA  TYPE  T_DOCUMENT_DATA,
       W_PACKING_LIST   TYPE  T_PACKING_LIST,
       W_ATTACHMENT     TYPE  T_ATTACHMENT,
       W_BODY_MSG       TYPE  T_BODY_MSG,
       W_RECEIVERS      TYPE  T_RECEIVERS,
       W_PDF            TYPE  T_PDF.
DATA : I_DOCUMENT_DATA  TYPE STANDARD TABLE OF T_DOCUMENT_DATA,
       I_PACKING_LIST   TYPE STANDARD TABLE OF T_PACKING_LIST,
       I_ATTACHMENT     TYPE STANDARD TABLE OF T_ATTACHMENT,
       I_BODY_MSG       TYPE STANDARD TABLE OF T_BODY_MSG,
       I_RECEIVERS      TYPE STANDARD TABLE OF T_RECEIVERS,
       I_PDF            TYPE STANDARD TABLE OF T_PDF.
DATA : G_SENT_TO_ALL   TYPE SONV-FLAG,
       G_TAB_LINES     TYPE I.
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
      IMPORTING
        BIN_FILESIZE           = V_BIN_FILESIZE
      TABLES
        OTF                    = ST_JOB_OUTPUT_INFO-OTFDATA
        DOCTAB_ARCHIVE         = IT_DOCS
        LINES                  = IT_LINES
      EXCEPTIONS
        ERR_CONV_NOT_POSSIBLE  = 1
        ERR_OTF_MC_NOENDMARKER = 2
        OTHERS                 = 3.
**** ........................GET THE FILE NAME TO STORE....................
    CONCATENATE 'Order Vs Billing' '.pdf' INTO V_NAME.
    CREATE OBJECT V_GUIOBJ.
    CALL METHOD V_GUIOBJ->FILE_SAVE_DIALOG
      EXPORTING
        DEFAULT_EXTENSION = 'pdf'
        DEFAULT_FILE_NAME = V_NAME
        FILE_FILTER       = V_FILTER
      CHANGING
        FILENAME          = V_NAME
        PATH              = V_PATH
        FULLPATH          = V_FULLPATH
        USER_ACTION       = V_UACT.
    IF V_UACT = V_GUIOBJ->ACTION_CANCEL.
      EXIT.
    ENDIF.
**** ..................................DOWNLOAD AS FILE....................
    MOVE V_FULLPATH TO V_FILENAME.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        BIN_FILESIZE            = V_BIN_FILESIZE
        FILENAME                = V_FILENAME
        FILETYPE                = 'BIN'
      TABLES
        DATA_TAB                = IT_LINES
      EXCEPTIONS
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION  = 20
        CONTROL_FLUSH_ERROR     = 21
        OTHERS                  = 22.
  ENDIF.
if it's helpfur for you.. pls give reward points.

Similar Messages

  • Broadcast Email to PDF output format

    Hi All,
    We are using the standard web template (0ANALYSIS_PATTERN) to broadcast email for PDF output format. I'm managed to received the PDF attachment email but however instead of one query, it contains duplication of the same query (repeated query) in the PDF file. We are also using the standard 0QUERY_TEMPLATE_BROADCAST_PDF web template.
    Has anyone experience this issue before and what is the solution for this?

    Hi All,
    We are using the standard web template (0ANALYSIS_PATTERN) to broadcast email for PDF output format. I'm managed to received the PDF attachment email but however instead of one query, it contains duplication of the same query (repeated query) in the PDF file. We are also using the standard 0QUERY_TEMPLATE_BROADCAST_PDF web template.
    Has anyone experience this issue before and what is the solution for this?

  • ALV report - control output format

    Hello all,
    I have an ALV report and when we try to print the output from List -> Print  , we would see Format under properties. I would like to control this format from inside my program. How can we do this? I tried LINE-COUNT and LINE-SIZE additions already with the REPORT statement but did not work. Please share your thoughts. Thanks.

    Hello,
    Thanks for the info. One more thing before I close the ticket. I have a report output with 7 pages. Second page has 20 columns in it. When I use format X_65_255, all 20 columns on the page are not being displayed. When I used X_65_512, the remaining columns overflowed to next page but all other pages (pages 1, 3, 4, 5, 6 and 7) have a blank page after them. Couple of quick questions.
    1. How can we get rid of the blank pages?
    2. Or is it possible to fit all columns from 2 page into just one page, may be reducing the font?
    Please help. Thanks.

  • Is html/pdf output format from BO 508 compliant?

    Hi Experts -
    I heard BO reporting tool can output html/pdf format.  Are they 508 compliant?  If not, how can I make them into 508 compliant please advice.
    Thanks

    Hi
    You can make it 508 complaint  by choosing/check marking this option from BusinessObjects InfoView > Preferences > Webi > 508 Complaint.
    Please note that this forum is not the right area to discuss BO technical questions.
    Raise your future queries at: SAP BusinessObjects Web Intelligence
    Hope this helps.
    Best,
    DeepB

  • Help on ALV GRID display outputting format for 2 internal tables

    Hi,
        I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
    Regards,
    Mira

    Hi,
    U can try out this code
    REPORT zzz_test NO STANDARD PAGE HEADING
                           MESSAGE-ID zz.
    The Data Declarations
    INCLUDE zzm_test_alv_data.
    The Selection Screen Definition
    INCLUDE zzm_test_alv_selscrn.
    The definition and implementation of the event reciever class
    INCLUDE zzm_test_alv_class.
    START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM f1000_load_itabs.
    END-OF-SELECTION
    END-OF-SELECTION.
      IF NOT cb_disp IS INITIAL.
        CALL SCREEN 9001.
      ENDIF.
    Include for getting data
      INCLUDE zzm_test_alv_forms.
    Include for PAI and PBO of screen
      INCLUDE zzm_test_alv_screen.
      INCLUDE ZZM_TEST_ALV_DATA                                          *
    This include has all the data declaration defined
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    Table Declarations:
    TABLES: mara,
            makt.
    Internal Tables:
    The following structure type must be defined in the data dictionary
    DATA:  i_fieldcat  TYPE lvc_t_fcat,
           i_fieldcat1 TYPE lvc_t_fcat,
           i_output1   TYPE STANDARD TABLE OF mara,
           i_output2   TYPE STANDARD TABLE OF makt,
    Work Areas:
           w_output1   TYPE STANDARD TABLE OF mara,
           w_output2   TYPE STANDARD TABLE OF makt.
    Variable:
    DATA: lv_repid    LIKE sy-repid.
    lv_repid = sy-repid.
      INCLUDE ZZM_TEST_ALV_SELSCRN                                       *
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: cb_disp AS CHECKBOX.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK b_main.
      INCLUDE ZZM_TEST_ALV_CLASS                                         *
    This include has all the data declaration defined for ALV
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    INCLUDE <icon>.
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
           o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
           cont_for_cognos1   TYPE scrfname VALUE 'BCALC_GRID_01_9100',
           cont_for_cognos2   TYPE scrfname VALUE 'BCALC_GRID_01_9200',
           custom_container1 TYPE REF TO cl_gui_custom_container,
           custom_container2 TYPE REF TO cl_gui_custom_container,
          Work Area
           w_layout TYPE lvc_s_layo ,
           w_variant TYPE disvariant.
          Constants
    CONSTANTS : c_lay(1) TYPE c VALUE 'A' .                  " All Layouts
    CONSTANTS: BEGIN OF c_main_tab,
               tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1',   "
               tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2',   "
               END OF c_main_tab.
      INCLUDE ZZM_TEST_ALV_FORMS                                         *
    This Include has the various forms used in the program
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    *&      Form  f9001_build_field_cat
          To Build Field Catalog
         -->P_I_FIELDCAT  text
         -->P_0021   text
    FORM f9001_build_field_cat TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                          USING value(p_structure).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name       = p_structure
           CHANGING
                ct_fieldcat            = p_fieldcat[]
           EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
                                                                " text-e05.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " f9001_build_field_cat
    *&      Form  f9000_objects_create
          For creating Custom Containers
    -->  p1        text
    <--  p2        text
    FORM f9000_objects_create.
      CREATE OBJECT custom_container1
          EXPORTING
              container_name = cont_for_cognos1
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT custom_container2
          EXPORTING
              container_name = cont_for_cognos2
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc NE 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = lv_repid
                  txt2  = sy-subrc
                  txt1  = 'The control could not be created'(510).
      ENDIF.
      CREATE OBJECT o_alvgrid1
           EXPORTING i_parent = custom_container1.
      CREATE OBJECT o_alvgrid2
           EXPORTING i_parent = custom_container2.
    ENDFORM.                    " f9000_objects_create
    *&      Form  f9003_layout
          To define the layout
         -->P_SY_TITLE  text
         -->P_0030   text
         -->P_0031   text
         -->P_0032   text
    FORM f9003_layout USING  value(ptitle)
                             value(pzebra)
                             value(pmode)
                             value(pwidth).
      w_layout-grid_title  = ptitle.
      w_layout-zebra       = pzebra.
      w_layout-sel_mode    = pmode.
      w_layout-cwidth_opt  = pwidth.
      w_variant-report     = sy-repid.
    ENDFORM.                    " f9003_layout
    *&      Form  f9006_error_handle
         To handle event
         -->P_PTEXT  text
    FORM f9006_error_handle USING value(ptext).
      IF sy-subrc NE 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = text-e03 " Error Note
                  txt2  = sy-subrc
                  txt1  = ptext.
      ENDIF.
    ENDFORM.                    " f9006_error_handle
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      CALL METHOD custom_container1->free.
      CALL METHOD custom_container2->free.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc NE 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = lv_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in FLush'(500).
      ENDIF.
    ENDFORM.
    *&      Form  f1000_load_itabs
          Select from Database
    -->  p1        text
    <--  p2        text
    form f1000_load_itabs.
      SELECT * FROM mara
               INTO TABLE i_output1
               UP TO 50 rows.
      SELECT * FROM makt
               INTO TABLE i_output2
               UP TO 50 rows.
    endform.                    " f1000_load_itabs
      INCLUDE ZZM_TEST_ALV_SCREEN                                        *
    2/ Description / Include functions
    This include contains PBO and PAI events for the screen of report
    ZZZJJ_TEST_ALV
    3/ Responsibility
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    DATA FOR TABSTRIP 'MAIN_TAB'
    CONTROLS:  main_tab TYPE TABSTRIP.
    DATA:      BEGIN OF i_main_tab,
                 subscreen   LIKE sy-dynnr,
                 prog        LIKE sy-repid VALUE
                                  'ZZZ_TEST',
                 pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
               END OF i_main_tab.
    *&      Module  STATUS_9001  OUTPUT
          text
    MODULE status_9001 OUTPUT.
    IF custom_container1 IS INITIAL.
      SET PF-STATUS 'ZSTATUS'.
      SET TITLEBAR 'ZTITLE'.
      Creating Object
        PERFORM f9000_objects_create.
      Building the field catalog
        PERFORM f9001_build_field_cat TABLES i_fieldcat
                                USING 'MARA'.
        PERFORM f9001_build_field_cat TABLES i_fieldcat1
                                USING 'MAKT'.
      Modifying the field catalog
       PERFORM f9002_modify_field_cat TABLES i_fieldcat.
      For Layout
        PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
    ENDIF.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  MAIN_TAB_ACTIVE_TAB_SET  OUTPUT
          Call method to display in the output grid
    MODULE main_tab_active_tab_set OUTPUT.
      main_tab-activetab = i_main_tab-pressed_tab.
      CASE i_main_tab-pressed_tab.
        WHEN c_main_tab-tab1.
      To display report
         i_main_tab-subscreen = '9100'.
          CALL METHOD o_alvgrid1->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_lay
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_output1[]
             it_fieldcatalog               = i_fieldcat[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
        WHEN c_main_tab-tab2.
      To display report
          i_main_tab-subscreen = '9200'.
          CALL METHOD o_alvgrid2->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_lay
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_output2[]
             it_fieldcatalog               = i_fieldcat1[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i005 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
    WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET OUTPUT
    *&      Module MAIN_TAB_ACTIVE_TAB_GET INPUT
          Check & Process the selected Tab
    MODULE main_tab_active_tab_get INPUT.
      CASE sy-ucomm.
        WHEN c_main_tab-tab1.
          i_main_tab-pressed_tab = c_main_tab-tab1.
        WHEN c_main_tab-tab2.
          i_main_tab-pressed_tab = c_main_tab-tab2.
        WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_GET INPUT
    *&      Module USER_COMMAND_9001 INPUT
          User Command
    MODULE user_command_9001 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          PERFORM exit_program.
          SET SCREEN '0'.
        WHEN 'EXIT' OR  'CANC'.
          PERFORM exit_program.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 “USER_COMMAND_9000 INPUT
    *&      Module MAIN_TAB_ACTIVE_TAB_SET INPUT
          Set sunscreen
    MODULE main_tab_active_tab_set INPUT.
      main_tab-activetab = i_main_tab-pressed_tab.
      CASE i_main_tab-pressed_tab.
        WHEN c_main_tab-tab1.
            i_main_tab-subscreen = '9100'.
        WHEN c_main_tab-tab2.
            i_main_tab-subscreen = '9200'.
        WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET INPUT
    Thanks & Regards,
    Judith.

  • PDF Output Issue

    Hi All ,
    I am facing a strange issue in PDF output format.
    When I preview PDF output i am seeing some special character like *0E-00001111232* . The actual value should be *$ 2,343,500*.
    When ever i face this issue immediately if i download and upload the same template its working fine. But after 15 days or 1 week again i am facing the same issue(On a regular interval).
    Its not only for the number data type columns also for some varchar columns.
    I checked the xml output its coming correctly , but only in preview i am facing this issue.
    BIP Version : 10.1.3.4.1.
    If any one faced with same issue please share your approach.
    Thanks,
    Ananth v

    I guess that might be what format style i have to select for a 11" X 17" report.
    or do i have to create a custom style.

  • How can I convert a report/ ALV in PDF format?

    Can you tell me how can I convert a report or ALV in PDF format?
    Regards,
    Subhasish

    hi ,
    check this..
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           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.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    regards,
    venkat.

  • How to save the output  format of Quotation in PDF

    Dear all,
    When i am take a print priew of Quotation it show the quotation format in std sap format but it dosenot allow to save ?
    Is there any std setting for Saving the output format?
    Plz send the some solution for the same.
    Thx & Regards,
    PM
    Edited by: PM on Feb 7, 2008 12:46 PM

    HI
    If the output is sapscript, you can convert it into PDF format . There is one standard report RSTXPDFT2 to convert into PDF .
    Before Execute you will have to create a spool request . when you will execute this report you will have to enter the
    spool no. Then you can send this PDF file as attachment.
    Hope this will helpful.
    Bye
    Ellath

  • How to get this output format in ALV report

    Hi.
    Can any one pls let me know how to get the following output format in ALV report.Following are the outputfields
    companycode   location     position     approver
    300    800       01    watson
    null   null        03     candy
    null   null        04     smith
    null   null        05     michael
    one empty line after this again
    300     800     01     ryant
    null      null    02     gyan
    null      null    03     fermi
    null      null    04     ogata
    *Note: Null     indicates  empty space .( i.e I need to get empty space in  output where ever null is there.)
            Thanks in advance.
    Kind Regards,
    samiulla.

    hi,
    u can use 'REUSE_ALV_LIST_DISPLAY'
                           or
    'REUSE_ALV_GRID_DISPLAY'  function modules.
    SAMPLE CODE :
    *& Report  Y101982CHD
    *                         TABLES
    TABLES: vbak.    " standard table
    *                           Type Pools                                 *
    TYPE-POOLS: slis.
    *                     Global Structure Definitions                     *
    *-- Structure to hold data from table CE1MCK2
    TYPES: BEGIN OF tp_itab1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           END OF tp_itab1.
    *-- Data Declaration
    DATA: t_itab1 TYPE TABLE OF tp_itab1.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
    *                    Selection  Screen                                 *
    *--Sales document-block
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN END OF  BLOCK b1.
    *--Display option - block
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETERS: alv_list RADIOBUTTON GROUP g1,
                alv_grid RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF  BLOCK b2.
    *file download - block
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    PARAMETERS: topc AS CHECKBOX,
                p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF  BLOCK b3.
    *                      Initialization.                                *
    *                      At Selection Screen                            *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
        EXPORTING
          dynpfield_filename = 'P_FILE'
          dyname             = sy-cprog
          dynumb             = sy-dynnr
          filetype           = 'P'      "P-->Physical
          location           = 'P'     "P Presentation Srever
          server             = space.
    AT SELECTION-SCREEN ON s_vbeln.
      PERFORM vbeln_validate.
    *                           Start Of Selection                         *
    START-OF-SELECTION.
    *-- Fetching all the required data into the internal table
      PERFORM select_data.
    *                           End Of Selection                           *
    END-OF-SELECTION.
      IF t_itab1[] IS NOT INITIAL.
        IF topc IS NOT INITIAL.
          PERFORM download.
          MESSAGE 'Data Download Completed' TYPE 'S'.
        ENDIF.
        PERFORM display.
      ELSE.
        MESSAGE 'No Records Found' TYPE 'I'.
      ENDIF.
    *                           Top Of Page Event                          *
    TOP-OF-PAGE.
    *& Form           :      select_data
    * Description     : Fetching all the data into the internal tables
    *  parameters    :  none
    FORM select_data .
      SELECT vbeln
         posnr
         werks
         lgort
         INTO CORRESPONDING  FIELDS OF TABLE t_itab1
         FROM vbap
         WHERE  vbeln IN s_vbeln.
      IF sy-subrc <> 0.
        MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
        EXIT.
      ENDIF.
    ENDFORM.                    " select_data
    *& Form        : display
    *  decription  : to display data in given format
    * parameters   :  none
    FORM display .
      IF alv_list = 'X'.
        PERFORM build_fieldcat TABLES i_fieldcat[]
                               USING :
    *-Output-field Table      Len  Ref fld Ref tab Heading    Col_pos
       'VBELN'       'T_ITAB1'     10   'VBAP'  'VBELN'    ''            1,
       'POSNR'       'T_ITAB1'     6    'VBAP'  'POSNR'    ''            2,
       'WERKS'       'T_ITAB1'     4    'VBAP'  'WERKS'    ''            3,
       'LGORT'       'T_ITAB1'     4    'VBAP'  'LGORT'    ''            4.
        *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'*
          *EXPORTING*
            *i_callback_program       = sy-repid*
    **        i_callback_pf_status_set = c_pf_status*
            *i_callback_user_command  = 'USER_COMMAND '*
    **        it_events                = t_alv_events[]*
            *it_fieldcat              = i_fieldcat[]*
          *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.*
      ENDIF.
      IF alv_grid = 'X'.
        PERFORM build_fieldcat TABLES i_fieldcat[]
                                 USING :
    *-Output-field Table      Len  Ref fld Ref tab Heading    Col_pos
         'VBELN'       'T_ITAB1'     10   'VBAP'  'VBELN'    ''            1,
         'POSNR'       'T_ITAB1'     6    'VBAP'  'POSNR'    ''            2,
         'WERKS'       'T_ITAB1'     4    'VBAP'  'WERKS'    ''            3,
         'LGORT'       'T_ITAB1'     4    'VBAP'  'LGORT'    ''            4.
        *CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'*
          *EXPORTING*
            *i_callback_program       = sy-repid*
    **        i_callback_pf_status_set = c_pf_status*
            *i_callback_user_command  = 'USER_COMMAND '*
            *it_fieldcat              = i_fieldcat*
          *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.*
      *ENDIF.*
    ENDFORM.                    " display
    *& Form        : vbeln_validate
    *  description : to validate sales document number
    * parameters   :  none
    FORM vbeln_validate .
      DATA: l_vbeln TYPE vbak-vbeln.
      SELECT SINGLE vbeln
        FROM vbak
        INTO l_vbeln
        WHERE vbeln IN s_vbeln.
      IF sy-subrc NE 0.
        MESSAGE 'ENTER THE VALID SALES DOCUMENT NO:' TYPE 'I'.
        EXIT.
      ENDIF.
    ENDFORM.                    " vbeln_validate
    *& Form       :build_fieldcat
    * Description : This routine fills field-catalogue
    *  Prameters  : none
    FORM build_fieldcat TABLES  fpt_fieldcat TYPE slis_t_fieldcat_alv
                        USING   fp_field     TYPE slis_fieldname
                                fp_table     TYPE slis_tabname
                                fp_length    TYPE dd03p-outputlen
                                fp_ref_tab   TYPE dd03p-tabname
                                fp_ref_fld   TYPE dd03p-fieldname
                                fp_seltext   TYPE dd03p-scrtext_l
                                fp_col_pos   TYPE sy-cucol.
    *-- Local data declaration
      DATA:   wl_fieldcat TYPE slis_fieldcat_alv.
    *-- Clear WorkArea
      wl_fieldcat-fieldname       = fp_field.
      wl_fieldcat-tabname         = fp_table.
      wl_fieldcat-outputlen       = fp_length.
      wl_fieldcat-ref_tabname     = fp_ref_tab.
      wl_fieldcat-ref_fieldname   = fp_ref_fld.
      wl_fieldcat-seltext_l       = fp_seltext.
      wl_fieldcat-col_pos         = fp_col_pos.
    *-- Update Field Catalog Table
      APPEND wl_fieldcat  TO  fpt_fieldcat.
    ENDFORM.                    "build_fieldcat
    *& Form        : download
    *  description : To Download The Data
    *  Parameters  :  none
    FORM download .
      DATA: l_file TYPE string.
      l_file = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
        TABLES
          data_tab                = t_itab1
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6.
      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.                    " download
    HOPE IT WILL HELP YOU
    REGARDS
    RAHUL SHARMA

  • PDF output not retaining same formatting as done in RTF

    Hi All,
    I have created a RTF template and need to show the output in PDF. Now in the RTF, as per the requirements, I am not enclosing my form fields in any table or inside any tabular cells. So I have to display the output something like this
    Name : Peter
    Age : 30 years
    Address : New Jersy
    Dept : Accounts
    but after placing the form fields in their right places, when I see the output in PDF, the formatting is lost and values are NOT displayed at their desired places as set in the RTF template. So I get the PDF output something like this
    Name : Peter
    Age:
    30 years
    Address :
    New Jersy
    Dept :
    Accounts
    Is there a method to fix the form fields so that they don't move and i get the output in the same way as I have designed in the RTF template.
    Any help on this would be much appreciated.
    Thanks,
    Ronny

    Ronny,
    There is the concept of CONTEXT COMMANDS:
    http://docs.oracle.com/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#con_freeform
    It may help to get what you want along with the example from the XML Publisher blog:
    http://blogs.oracle.com/xmlpublisher/entry/inline_grouping
    regards
    Jorge

  • PDF Output File Format

    Hi all,
    Does somebody know what is the PDF output file format in Oracle EBS 11.5.10.2?
    Is it PDF/X, PDF/E, PDF/UA, PDF/VT or something else?
    Thanks and regards,
    Karmit

    Hi,
    See this thread.
    concurrent ouput to email
    concurrent ouput to email
    Regards,
    Hussein

  • Change output format of  MC45,key usage value report to ALV format?

    Can someone please help me to change the change the Output of MC45 report to ALV format?
    Please help!!!
    Thanks!!!
    Owais

    I know i have to create a copy of MC45 to some z program but afterwards I am not sure where to look for to change the output format.
    Our ababper is extremely busy so i wanted to do litle bit of chnages by myself. I do have couple of years of java experience several years back, I thought i could help our abaper and learn myself little bit also.
    Thanks!!!
    Owais

  • Can we Compare PDF Output with CSV format

    Team,
    Can we Compare PDF Output with CSV format.
    In Excel I need to two text boxes asking us to browse the files and compare the files PDF & CSV format.
    Please suggest me if we have solution for this.
    Thanks!
    Kiran

    Hi
    I'm afraid the Excel Application does not support this function currently, I am suggesting you to take advantage of a third party component to achieve this goal.
    Thanks for your understanding.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Query about Email Address Format & PDF Output

    I'm using XML Publisher and an RTF word template linked to an Oracle XML file to generate PDF Purchase Orders.
    Part of the PDF output displays an email address.
    If the email address is in this format:
    [email protected]
    then when the PDF output is generated, the address is outputted into a clickable hyperlink which sends an email to:
    [email protected]
    However, if the email address is set to:
    [email protected]
    then the resulting email hyperlink will only be sent to:
    [email protected] (i.e. all to the right of the dot)...
    Just wondered if there is any way to stop this from happening?
    Thank you

    Sorry - I know months have passed since I first raised this query.
    Just double checking again, to see if anyone is aware of a workaround for this email issue? Is there anything I can do in the XSL in the background to force a particular email hyperlink format?
    Thank you

  • Different output format on pdf,  same report same data same user Report 10g

    Hi
    I’ve recently came up with a very strange problem
    I have the same report ( DevSuite 10g ) running on a win2003 server and without any obvious reason the output format changes from the original –correct one - ( the underlined text is not correct , font size is decreased , line spacing differs)
    The report is executed with the same user, the same parameters and the same data...
    Problem is solved only after a full server restart ( restarting only the report server, web cacle will not make any difference )
    Once the report is formatted strangely we cannot run it correctly (reboot is needed)
    Trace and log files shows nothing strange about the execution.
    Can you please tell me how to start investigate or suggest a solution?
    Thank you,
    M

    This is a wild guess, but it could be the result of there being no default printer. If you're using an in-process Reports Server, this runs by default under the LocalSystem operating system account. By default, this account does not have a default printer. Without a default printer, Reports may not format fonts correctly when producing PDF output.
    For more information, see "Printing and Font Errors When Using In-process Server" in Appendix D (Troubleshooting OracleAS Reports Services) of Oracle Application Server Reports Services Publishing Reports to the Web 10g Release 2 (10.1.2). It (like Metalink note 272017.1) suggests changing the registry to set a default printer that the LocalSystem account can "see"). Metalink note 370150.1 offers a more drastic solution -- configuring the Reports Server to run under a different operating system account that does have a default printer.
    Still, the theory that this "default printer" issue is the problem is not exactly consistent with the fact that your reports do work as expected at first, although there could be explanations for why the default printer is periodically changing (startup scripts, user intervention, etc.).
    Hope this helps.

Maybe you are looking for