Combining 2 Programs into 1

Hi,
I have 2 report programs that I want to combine into 1.
Basically , I have created my own version of transaction SP01 ( business requirement ) , which displays spool information, but does not display the spool on the screen. I also have another program, which displays information in pdf on the screen, I know there are functions avilable to convert spools into .pdf format.
My second program has a screen representation, and what I tried initally, create the screen, paste the code from the report into a form , and then call the form.
But I keep getting the error message:
Incorrect nesting: Before the statement "MODULE", the structure          
introduced by "FORM" must be concluded by "ENDFORM"
the code for my report , which displays the pdf file is shown below;
REPORT  viewing_demo MESSAGE-ID demoofficeintegratio.
TYPES: BEGIN OF document_descr,
          document_name(40), document_id(64),
       END OF document_descr.
TYPES: document_list TYPE document_descr OCCURS 0.
TYPES: t_url LIKE bapiuri-uri.
DATA: bds_instance TYPE REF TO cl_bds_document_set,
    url_lifetime TYPE sbdst_url_lifetime.
DATA: type(128) TYPE c, subtype(128) TYPE c.
DATA: delimiter(1) TYPE c VALUE'/'.
DATA: size TYPE i.
DATA: content_table TYPE sbdst_content.
DATA: mycontent_table TYPE sbdst_content. "Sanjay Internal Table
DATA: viewer TYPE REF TO i_oi_document_viewer,
      my_container TYPE REF TO cl_gui_custom_container.
DATA: fcode LIKE sy-ucomm,
      edurl(2048).
DATA: inplace(1) VALUE space, via_url(1) VALUE space.
DATA: p_fname LIKE rlgrap-filename VALUE
        'c:\a.pdf', v_ans.
SET SCREEN 100.
*&      Module  STATUS_0100  OUTPUT
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'TESTVIEWER'.
  SET TITLEBAR '001' WITH delimiter.
  set titlebar 'Purchase Order Archive Documen'.
  IF my_container IS INITIAL.
    CREATE OBJECT my_container
        EXPORTING
            container_name = 'VIEW'
        EXCEPTIONS
            OTHERS = 1.
    CASE sy-subrc.
      WHEN 0.
      WHEN OTHERS.
        RAISE cntl_error.
    ENDCASE.
  ENDIF.
  IF viewer IS INITIAL.
    CALL METHOD c_oi_container_control_creator=>get_document_viewer
      IMPORTING
        viewer               = viewer
      EXCEPTIONS
        unsupported_platform = 1.
    IF sy-subrc NE 0.
      MESSAGE i009.
    ENDIF.
    CALL METHOD viewer->init_viewer
      EXPORTING
        parent             = my_container
      EXCEPTIONS
        cntl_error         = 1
        cntl_install_error = 2
        dp_install_error   = 3
        dp_error           = 4.
    IF sy-subrc NE 0.
      MESSAGE i009.
    ENDIF.
  ENDIF.
  CLEAR edurl.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                     = 'C:\A.PDF'
     filetype                      = 'BIN'
  HAS_FIELD_SEPARATOR           = ' '
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
    TABLES
      data_tab                      = mycontent_table
EXCEPTIONS
  FILE_OPEN_ERROR               = 1
  FILE_READ_ERROR               = 2
  NO_BATCH                      = 3
  GUI_REFUSE_FILETRANSFER       = 4
  INVALID_TYPE                  = 5
  NO_AUTHORITY                  = 6
  UNKNOWN_ERROR                 = 7
  BAD_DATA_FORMAT               = 8
  HEADER_NOT_ALLOWED            = 9
  SEPARATOR_NOT_ALLOWED         = 10
  HEADER_TOO_LONG               = 11
  UNKNOWN_DP_ERROR              = 12
  ACCESS_DENIED                 = 13
  DP_OUT_OF_MEMORY              = 14
  DISK_FULL                     = 15
  DP_TIMEOUT                    = 16
  OTHERS                        = 17
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  type  = 'application'.
  subtype = 'PDF'.
  inplace = 'X'.
  CALL METHOD viewer->view_document_from_table
    EXPORTING
      type                 = type
      subtype              = subtype
      size                 = 72704
      show_inplace         = inplace
    CHANGING
      document_table       = mycontent_table
    EXCEPTIONS
      cntl_error           = 1
      not_initialized      = 2
      dp_error_general     = 3
      invalid_parameter    = 4
      dp_invalid_parameter = 5.
  IF sy-subrc NE 0.
    MESSAGE i009.
  ENDIF.
ENDMODULE.                    "STATUS_0100 OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
MODULE user_command_0100 INPUT.
  CASE fcode.
    WHEN 'BACK'.
      IF NOT viewer IS INITIAL.
        CALL METHOD viewer->destroy_viewer
          EXCEPTIONS
            not_initialized = 1
            free_failed     = 2.
        IF sy-subrc NE 0.
          MESSAGE i009.
        ENDIF.
        FREE viewer.
      ENDIF.
      IF NOT my_container IS INITIAL.
        CALL METHOD my_container->free
          EXCEPTIONS
            OTHERS = 1.
        IF sy-subrc <> 0.
          MESSAGE i009.
        ENDIF.
        FREE my_container.
      ENDIF.
      LEAVE PROGRAM.
    WHEN 'CLOSE'.
      CALL METHOD viewer->close_document
        EXCEPTIONS
          cntl_error      = 1
          not_initialized = 2.
      IF sy-subrc NE 0.
        MESSAGE i009.
      ENDIF.
      IF NOT viewer IS INITIAL.
        CALL METHOD viewer->destroy_viewer
          EXCEPTIONS
            not_initialized = 1
            free_failed     = 2.
        IF sy-subrc NE 0.
          MESSAGE i009.
        ENDIF.
        FREE viewer.
      ENDIF.
      IF NOT my_container IS INITIAL.
        CALL METHOD my_container->free
          EXCEPTIONS
            OTHERS = 1.
        IF sy-subrc <> 0.
          MESSAGE i009.
        ENDIF.
        FREE my_container.
      ENDIF.
      LEAVE PROGRAM.
  ENDCASE.
  CLEAR fcode.
ENDMODULE.                    "USER_COMMAND_0100 INPUT

Hi,
"I think I'm getting confused how I should try and integrate this code, or if there is a way to call it from the main program, with parameters"
Use SUBMIT <Program Name> Technique and call your second report from the main program. Then to pass parameters, you have to convert some your data variables in the second report into parameters with defaults so that they can also be filled from the main program while callling it using SUBMIT.
Check keyword documentation for SUBMIT if you have further doubts.
Sri

Similar Messages

  • Possibility to execute Acrobat Pro's "Combine files into PDF" function from within SAP?

    Good day.
    Presently, a company uses Acrobat Pro to manually combine files such as *.pdf, *.jpg, *.doc, which have been downloaded from SAP's Document Management System, into one pdf file. I would like to know if it is possible to automatically execute Acrobat Pro's "Combine files into PDF" function from within SAP (ECC 6.0) application system. I'm wondering if this could be achieved from a program via OLE (Object Linking and Embedding) or RFC (remote function call).
    Thanks in advance for your thoughts and inputs.

    Yes, you can combine PDF files via IAC/COM methods.

  • Combining files into a single pdf stopped working

    I used to be able to combine files into a single pdf on my Mac using Adobe Acrobat XI Professional. Now when I select "combine files into a single pdf", I just get a short vertical line with a gray cloud around it in the center of my screen. Do I need to reinstall the program?

    Hi geolawrocks,
    Welcome to Forums, I would be more than happy to help you with the issue but, i have few questions.
    1) What is the error message you get while combining files?
    2) When did it last worked?
    3)Any changes to the application/OS that you made (Update)?
    If possible, Kindly include the screenshot.
    Thanks,
    Vikrantt

  • I have 3 different itunes accounts and would like to combine them into just one for all my devices, a macbook pro, an iphone 4S, an older IPOD, and a ver sion one Ipad. how can i do this on all devices ?

    i have 3 different itunes accounts and would like to combine them into just one for all my devices, a macbook pro, an iphone 4S, an older IPOD, and a ver sion one Ipad. how can i do this on all devices ?

    i had one for a long time, then when i got the ipad i didn't realize they would all still work under one so i set up the second one on that
    then when i got the new iphone i put in the info for the first and main one from my mac pro and it would not work at all, and i knew it was right, then it asked me to create a new one or i couldnt finish the setup
    hence why i have 3 now
    hard to believe you cannot combine into one
    oh well, i will just make them all accessible for all 3
    thanks

  • Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it?

    Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it in some other form befor dragging it?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • I have several pics of my new grandson throughout the year.  How do I combine them into one event

    I have several pics of my new grandson throughout the year.  How do I combine them into one event

    You can drag and drop photos from one Event to another. Or you can flag them and use the Events: Add Flagged photos to Select Event.
    However, why not use an Album for the job?

  • I have two different itunes music files on my computer.  How do I combine them into one file?

    I have two different itunes music files on my computer.  How do I combine them into one file?

    I don't think so. The only other ID I have is a developer id, and I didn't get that until several months after I got the phone. In addition purchases I made from the App Store onthe phone would sync up with It unes on the Mac meaning it would be the same id.
    However I looked at the AppStore on my phone while it was connected to the Mac with iTunes open, and now the balance has changed to the same as the others.

  • I seem to have at least two, and maybe four, iCloud accounts, across my iPhone, my iPad and my MacBook Pro. Can I combine them into one iCloud account?

    I seem to have at least two, and maybe four, iCloud accounts, across my iPhone, my iPad and my MacBook Pro. Can I combine them into one iCloud account? I have been able to log into what appears to be three of the four iCloud accounts I have. Two of them seem to be remarkably similar, and one appears to be only for my MacBook.I think I know which one my iPhone is backing up to, as I successfully restored from a back-up last week. The fourth iCloud account I can't access via password or security questions. Any advice would be much appreciated.
    Thanks.
    Cheers,
    Aaron
    Melbourne, Australia

    You cannot merge accounts.

  • I have multiple documents how can I combine them into one document?

    I have multiple document files in Pages. How can I combine them into one document?

    Menu > View > Page Thumbnails > click on the thumbnails > Copy/Paste into thumbnails of other document
    Peter

  • I have 3 podcast folders in my iTunes account, how can I combine them into one folder in my iTunes library?

    I have 3 podcast folders in my iTunes account, how can I combine them into one folder in my iTunes library?

    What is the title of the other bookmark folder that can not be deleted?
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Please report back soon.

  • TS3981 After migration files are now shared between two user accounts. How can I combine them into one account?

    After migration, from PC, files are now shared between two user accounts.I have to switch users to access files. How can I combine them into one account?

    See Pondini's  Transferring files from one User Account to another, for starters

  • Songs in my Itunes show up as separate folders.  How do I combine them into one album?

    Songs in my Itunes show up as separate folders.  How do I combine them into one album?

    Is this one of those CDs where the main artist asks their friend to sing a song with them?
    Such as, Slash's new album. Track 1 is "Slash Feat. Ian Astbury", track 2 is "Slash Feat. Ozzy Osbourne" and so on.
    To fix this, select all the tracks on that album, right-click > Get Info, and say YES to changing multiple items.
    Put "Slash" in the *Album Artist* field (for this example, of course).
    Make sure it is the *Album Artist* field, not the plain Artist field.

  • How do I combine PDFs into one document?

    I want to scan CD booklets for online digital storage. I have Pages and Preview, of course. I do not have Acrobat Professional.
    I have a large scanner and can make individual TIFs or PDFs of each spread. What would be the best way to combine these into one file?

    etresoft,
    Please don't read this as an actual reply to your post because it is not.
    But, since the thread is dealing with CUPS-PDF and I have been desperately seeking CUPS-PDF for a long time ever since I've got my brand new iMac only 5 days ago (5 days on a new iMac [which is not only new but is intel-based, and which I was forced to buy because my older PPC iMac G5 died of preternatural or some other causes] is an extremely long time on account of Snow Leopard, about which I am like a babe trying to start speaking for the first time) I found it more expedient to "reply" in order to get some help with CUPS-PDF from someone who knows.
    I've downloaded CUPS-PDF from "https://bitbucket.org/codepoet/cups-pdf-for-mac-os-x/wiki/Home" and installed it following the instructions included therein.
    The only instruction I could not follow is to pick "Generic postscript color printer"; I could pick  "Generic postscript printer" though.
    CUPS-PDF shows in the printer list.
    CUPS-PDF apparently prints as indicated by the progress bar.
    But, the print doesn't show anywhere on my computer:
    The output is not in /Users/Shared/CUPS-PDF in a folder with my user account's name.
    I did make an alias to this folder on my desktop but it only contains two folders: "my user name" and "SPOOL"
    The first folder had a "clone" of the download source page (which I deleted.)
    SPOOL has nothing in it.
    I've never had a problem using CUPS-PDF while on OS X 10.4.11, something I'll never be able to revert to.
    I'll be eternally grateful to you if you could help me with this issue but, on condition that you use a language as plain as English since my expertise with OS X, which was never as considerable as to be able to use terminal to any advantage, nor understanding terms such as sudos and the like, is now even diminished on account of the new OS I am forced to use from now on.
    Thank you so much for your help and excuse me for using this approach to ask for help.
    Best regards,
    Ruben

  • How do I combine Projects into one project?

    I like to make small projects while travelling and post on facebook. When home, I would like to combine them into one longer project for my Apple TV.
    Any suggestions would be greatly appreciated.
    Thanks,
    Skip

    you can copy (copy all) the clips from one project and paste them into another clip, but music and titles will not come with that. If you export one project as a .mov file and then reimport it into iMovie as suggested, that will easily work, but you wont be able to edit that movie's music or titles.
    rr

  • How can we put the report which is generated by the program into spool??

    How can we put the report which is generated by the program into spool??
    I had generated a file in Unix which had the report but now the requirement has changed.
    Regards,
    Shashank.

    Hi Shashank,
    If the program is executed in the background and it has the write statement then the spool will automatically generated.
    Reward points if useful.
    Regards,
    Atish

  • How can I put the report generated by a program into a File?

    Hi all,
       How can I put the report generated by a program into a File?It can be in TXT format or excel format which ever is possible.
    I need to export this file to memory,How can I do that??
    Regards,
    Shashank.

    Hello Shashank,
    Please ignore my previous answer... Ofcourse it works...
    There are several ways to do this...
    two of them are
    1. List -> Save -> File and press enter..
        it will ask for the format, then path where to save it. Just give the path.
    2. Using function module 'GUI_DOWNLOAD'.
    I'm giving the example bellow which explains the usage of both GUI_UPLOAD and GUI_DOWNLOAD.
    To do this... you need to have folder with name 'TEST' and a .txt file in it with name 'test'. And contents of it are :
    TEST1             ,BOT 
    TEST2             ,BOT 
    TEST3             ,BUT 
    with spaces.
    REPORT zssr_bdc .
    DATA: BEGIN OF g_t_itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
          END OF g_t_itab.
    DATA: g_t_bdcdata TYPE TABLE OF bdcdata.
    DATA: path TYPE string,
          path1 type string.
    path = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test.txt'.
    path1 = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test1.txt'.
    *contents of test.txt    *
    *TEST1             ,BOT  *
    *TEST2             ,BOT  *
    *TEST3             ,BUT  *
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = path
      TABLES
        data_tab                      = g_t_itab.
    LOOP AT g_t_itab.
      WRITE:/1(18) g_t_itab-matnr, 20(40) g_t_itab-maktx.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       filename = path1
       filetype                      = 'ASC'
      TABLES
        data_tab                      = g_t_itab.
    Now you will get one .txt file with name 'TEST1.TXT' in the TEST folder.
    <b>REWARD POINTS IF IT IS HELPFUL</b>
    Regards
    Sasidhar Reddy Matli

Maybe you are looking for