Sunday 9 November 2014

                               Adobe Forms Faq


1. Explain how adobe forms differ from smart forms?

Adobe forms: Adobe forms is online interactive form we can edit the output list as well as we can display the output as PDF format. But smart form not at all possible.
2. How to display a logo dynamically in the Adobe Forms?
To display a logo dynamically, we will have to upload it first into SAP using transaction SE78. This transaction will store this logo internally into a table “stxbitmaps”.

After uploading the logo we will have to create an interface and we will define two global variables there. Let’s say V1 type XSTRING and V2 type STRING (default value ‘image\bmp’). In Code initialization section we will have to write a simple query to fetch the logo from the table above by providing the log name. Then we will have to call a methodcl_ssf_xsf_utilities=>get_bds_graphic_as_bmp and pass on tdobject, tdname, tdid and tdbyte fetched from the query. This method is going to return a XSTRING type variable which we will move to the global variable V1 defined already.

After this step we have to create a Form and assign the interface created above to it. In the right side pane under the context tab, we have to create a graphic node. Select the graphic node and in the properties section make the Graphic Type as Graphic Content. Save it and drag V1 (from the left pane under the Global Data node) to the Field property of the Graphic and V2 (from the left pane under the Global Data node) to the MIME Type property of the form. Under the Layout tab create an image field and bind it with graphic node created. Save and activate. Execute the form. This will display an image dynamically.

3. What needs to be done to convert the static text in the form layout to a different language?
Go to transaction code SFP.
Enter your form name and hit display.
Now go to menu Goto -> Translation.
Give Original Language as EN and Target Language as whatever language you want to convert the static text into and hit enter.
You will find two objects TLGS and PDFB.
Double click on the form under PDFB tag.
Go to menu Utilities -> Expand Tags.
You will find vertically cascaded windows for source text and target text.
Under the target text press copy source text button. This will copy everything defined as static text in the layout to target text.
Now here we can convert the text into the respective language.
Once done, save and activate the changes.
Come out and execute the form in whatever language you want. Make sure to input the language in LA field of /1BCDWB/DOCPARAMS input table.
Execute and see the output.
    
4. How to convert the text module used in the adobe form to a different language and display it?
Ans. Create a text module (e.g.: let’s say we create Z_TEST_DEMO) in the SMARTFORMS transaction (in EN transaction). Create a Text (e.g.: let’s say we create T1) in the adobe form (SFP transaction) and assign the created text module TM1 (in smart forms transaction) to the text (in form using SFP transaction).
Execute and see the output.
Now what if you want to display it in the language FR. For that please follow the steps below:
Go to transaction SE63.

Then go to menu Translation -> ABAP Objects -> Other Long Texts.

3.   Then under Object Type selection window, select B5 SAPScript: Forms and Styles and double click on SSF Smart Form.

 4.   Give the Text Module’s name (Z_TEST_DEMO) created above and select source language as EN and Target Language as FR and hit Enter
  5.   Then in the Target text give the French translation of English text and give the same paragraph format (which in this case you will see as * on the left of the text in target language section below:


  6.   Press Save Active button.
  7.   This will activate all the changes.
  8.    Now go to your form and execute it as the text has already been assigned with the text module. Give language as FR. This will show the French text. And if you put EN as language, this will show text in English instead.


4. How to bind a static text box with a dynamic field coming from a table as an input?
For example you want to display
First Name       Scott


where First Name is a static text which you have already added in the form layout and Scott is the name of the person you want to pick from a table as per whatever conditions you have written in your code in the driver program. For this scenario, follow the steps:

In the form layout drag a text-field from the library to the design window.
On the layout tab of the properties window (for the selected text-field), select position as left and reserve as 1in.


  3.   Then on the field tab under the object tab, put caption as First Name and appearance as Sunken Box as shown.
4.   Then in the binding tab under the object tab select the data binding and bind it with the respective field.

5.   Save and activate and get the result.

When you have used a text instead of text-field then, right click on text and select edit text. Write First Name: and then again right click and select Floating field. Select the object property of that floating field and click on the binding tab and define the binding with whatever field you want to put in there.

5. How are conditions used in the adobe forms?
Suppose you want to display a particular text module in case if language you pass is EN in the input parameter. For this follow the steps below
Go to transaction SFP and create a form.
In the context tab, create a Text and assign a Text Module to it (created under smart forms transaction) under its properties.
Click on conditions button and add a row using + button. Give the Import parameter name as EX_LANGU (language parameter in my example) under first OPERAND and ‘EN’ under second OPERAND as shown.

4.   Save and activate the form.
  5.   Execute it by passing EN as language parameter. This time the text module will be displayed. If you execute it by passing FR as language parameter, the text module won’t display on the form output this time.

6. What is SAP Adobe forms?
Adobe forms is a new technology available from SAP Net Weaver, you can use to create print & interactive forms for the optimization of your form-based business processes.

7. What are business advantages of Sap Adobe form?
SAP Interactive Forms by Adobe offer the following business advantages:
Interactive functions automate the creation of data for SAP systems
Full integration into the SAP development environments for Java and ABAP
User-friendly tools reduce the time and costs associated with creating form layouts.
The usage of the PDF format means that forms retain their appearance regardless of the environment they are used in.

8. How to use SAP Adobe forms?
You can create a sales order form in adobe form and send to the sales reps. Sales reps can fill this form when they are not connected to internet / SAP system. Once they connect to SAP just send an e-mail to a specific user id in outlook. You got to customize and code how you want to process once you receive this form. This enables you to create orders even when you are not connected to the system.

9. What is the difference between Adobe forms and smart forms / scripts?
Smart forms / scripts are used to show the data in SAP. Most likely you will use these to print / display some kind of receipts / forms. Many companies must be using this for hard copies / ALE / EDI or to transfer data from SAP to others.
Adobe forms are used to post data into SAP from SAP too. So this has an additional feature compared to smart forms.


10. Where do we use SAP Adobe forms?
 You can use for offline forms usage, and as like smart forms to print.

11. What do i need to know to work on SAP Adobe forms?
You just need to know ABAP. It is beneficiary if you know java script. But it hardly matters. If i can do without knowing Java script, you can do the same. Same with XML.Transaction for doing this is SFP and this runs on net weaver.

12. What are Basic Functions of Sap Adobe form?
Basic Functions of Adobe forms
Create form templates for the layout that include logos or pictures
Generate documents by merging form templates and current system data
Edit forms online or offline
Forms can be filled in advance automatically with specific data from SAP applications and then sent to the correct recipients using secure methods
Automatic consistency checks for forms
Activate enhanced functions such as comments
Digital signatures and form certification
Send completed forms to the SAP application with automatic updates of the business data.

13. What is PDF-Based Print Form?
A PDF-based print form is a form designed for mass printing in SAP systems. It has the standard Portable Document Format (PDF).

14. What are the uses of PDF-Based Print Form?
PDF-based print forms can be used for the following:
Order confirmations
Invoices
Account statements
Checks
Salary statements
Delivery notes
Customs forms
Industry-specific forms, such as quality forms in the automotive industry.


15. What are PDF-Based Print Form Structure attributes?
A PDF-base print form has the following attributes:
A form interface that sends the application data to the form.
A form context that contains the form logic. This logic controls the dynamic formatting of the form. For example, it enables variable fields to be displayed; it specifies that certain texts appear only under certain conditions (one text for a first warning and a different text for a second warning); and it can specify that invoice items can be processed repeatedly in table.
A layout. In the layout, you define how the output data is positioned, its appearance in graphics, and the design of the pages.




FAQS – OVERVIEW SAP INTERACTIVE FORMS (IFBA) AND FLM

Q       What is SAP Interactive Forms by Adobe?
A       SAP Interactive Forms is an enterprise-grade, widely-deployed software product that brings SAP business processes to end-users via a flexible forms-based UI that leverages “PDF” – the gold standard for forms/documents – and Adobe Reader, the ubiquitous software that is the global standard for electronic document sharing.  SAP Interactive Forms is jointly developed, maintained and supported by Adobe and SAP, and provides out-of-the-box integration between Adobe Interactive Forms and SAP NetWeaver. Using SAP Interactive Forms by Adobe, customers can build e-forms solutions to reach both on-line and off-line users, inside the company or outside the firewall, thus extending core SAP processes to new communities of users.
Q       What is Forms Lifecycle Manager?
A       Arch FLM is an enterprise software product by Arch that simplifies the implementation, deployment and management of SAP Interactive Forms by providing a run-time environment with forms monitoring, version-control and other centralized services. It also enables the use of HTML-based forms and integrates forms-based processes with multiple mobile devices.
Q       What is FLM (technical description)?
A       FLM includes an SAP form server that enables the rapid development and deployment of forms-based processes, and enables customers to build and manage forms processes without the need for deep technical skills. FLM is built to leverage SAP Interactive Forms by Adobe (PDF forms) and can also handle other types of form.
Q       Who is Arch?
A       Founded in 1996, Arch is a software provider specializing in enterprise-class forms management solutions for SAP customers across PDF and other digital channels. Arch is an Adobe Enterprise Partner, an SAP software solution partner, and offers FLM, a market-leading forms lifecycle management product and an SAP-endorsed business solution. Arch has been recognized by Gartner as ‘Cool Vendor 2011’ in the SAP ecosystem for the company’s work in SAP user experience improvement.
Q       Why are SAP and Arch partnering in this way?
A       SAP customers rely on the rich functionality of SAP Interactive Forms to drive business processes; Arch has been adding strong value to customers by implementing the SAP solution at many Fortune 500 companies.  Their skills and real-world experiences resulted in the creation of Arch Forms Lifecycle Manager, which encapsulates these skills and best practices. FLM is used widely by SAP customers in the U.K., and this new relationship will enable SAP customers globally to reap the benefits of an integrated form server. FLM also adds mobile capabilities that are aligned with customer needs and SAP’s strategic direction with Sybase Unwired Platform.

FAQS – VALUE PROPOSITION

Q      What is the unique value proposition for the combination of SAP Interactive Forms and Arch FLM?
A       SAP Interactive Forms by Adobe and Arch FLM, when used together, provide an end-to-end solution to develop, deploy and manage forms-driven business processes that simplify end-user interaction with SAP systems online, offline and on mobile devices. The solutions are targeted at companies that need to automate and extend business processes to many end users via user interfaces based on forms (e.g., PDF and HTML/HTML5) and multiple devices. Unlike other solutions, the combination of SAP Interactive Forms and FLM provide seamless integration, multi-channel UI, and centralized management of forms.
Q       What value does FLM deliver on top of SAP Interactive Forms?
A       FLM delivers an enterprise-class product for simplifying the implementation, deployment and management of SAP Interactive Forms and extends forms-driven processes to multiple mobile devices.

Technical depth: FLM provides cross-application form template management, the ability to configure forms processes, form-serving for multiple online and offline form scenarios, central maintenance of business and posting logic, and form process monitoring, including full audit-trail capture. All of these functions are provided out-of-the-box, with no need for development.

FLM can manage PDF-based templates or HTML templates.  This combination of UI technologies enables customers to extend processes to more users on more devices.

Since any process can be modeled and managed using FLM, customers are using FLM for SAP-based processes, and also non-SAP processes, replacing forms processes managed using software such as Microsoft SharePoint/Infopath and Lotus Notes.
Q       What is different about form design in FLM compared to custom development method?
A       It’s quicker and much less technical. FLM allows the logical design of the form to be separated from the aesthetic design. In the standard scenario the code connecting the PDF to SAP is contained within each individual form and is specific to it. The advantage of separating the logical code from the visual design is that it enables automation of code generation without limiting the possibilities for presentation, saving time and effort while producing more visually consistent forms! In addition, no Java WebDynpro skills are needed because FLM does all the integration for you. ABAP is all that’s required, along with basic Adobe Designer skills.
Q       With FLM, I understand that entire forms are saved to the SAP Content Server for later retrieval. Does similar functionality not exist in the standard SAP scenario?
A       No the standard scenario involves binding form fields to ABAP function module parameters. This means that you can save form data back to SAP (although finding somewhere to put text of unlimited size can be hard), but you don’t get attachments without writing your own code.
Q       What are the main advantages of using FLM over using custom development?
A Custom development of SAP Interactive Forms by Adobe has the following drawbacks that are overcome by FLM:
Custom development produces applications that are form-specific and therefore creates a solution that doesn’t scale easily 
The business logic is distributed between ABAP, the web application and the form itself, and so is more difficult to support when problems occur  the custom method is a much more expensive solution. 

             

FAQS – FLM TECHNICAL 

Q       What SAP release is necessary to run FLM?
A       Any Netweaver 2004s [NW 7.0] release with Unicode.  ABAP and Java stacks are both mandatory. The SAP Netweaver architecture supports connection via a variety of routes to SAP Applications so that implementing SIFbA using FLM does not require an upgrade. This issue arises commonly and is born of increasing numbers of Adobe forms SAP is shipping with its standard product. These are only available with later releases of SAP typically ECC6 thus customers form the view that to get Adobe forms they need to upgrade. Not so.
Q       Which SAP software products support FLM? 
A       FLM is application neutral, and so can be hosted on any SAP system built on the NW2004s platform.  Currently this includes, ERP2005, CRM2005, XI, Solution Manager, SEM and SRM.
Q       If I already use SAP Interactive forms by Adobe in my landscape, does FLM alter my existing usage? 
A       No, FLM in no way interferes with or precludes the use of any other SAP Interactive forms by Adobe scenario.
Q       Does FLM support Zero-client-install [ZCI] forms?  
A       Yes.  Additionally, FLM can render forms through a BSP instead of webDynpro, and in that scenario no ZCI script is required within the form templates
Q      What skills do I need to work with FLM? I don’t have any Java skills in my organisation.
A       FLM needs only ABAP/4 and Adobe Livecycle Designer skills to develop new forms, and is implemented through an extension to the standard IMG. Validations on the form itself require JavaScript but bear in mind this is not as complex a language as Java.
Q       Our location means that bandwidth does not support download of large-size files. What is the smallest size an eForm can realistically be? Is there an alternative way of submitting data?
A       The basic FLM Master Template then it takes around 100KB to 200KB. Graphics increase the size of a PDF, as do large data connections. However, for an email form scenario you can enable data-only transport to minimize the file size being transferred by email so large-sized PDFs can be managed relatively easily. HTML forms can typically by 10 times smaller than PDF forms, so less bandwidth is required.
Q       The Form Posting Engine and its adaptors can handle the update of data to non-SAP system. Can I connect to SAP ERP earlier than 4.7?
A       Yes, FLM can handle the update of data to any system, SAP or non-SAP, that has any kind of API that ABAP can access.  This includes mechanisms such as web-service, RFC, SQL, IDoc, RMI etc – so usually there is a way of talking to any type of system. You can connect FLM easily to any SAP system down to roughly version 3.0.  For systems even older than that it is possible but more difficult.



             

FAQS – FLM FUNCTIONAL

Q       How does FLM compare with HCM Processes and Forms?
A       SAP deliver a framework for HCM e-forms including a number of pre-delivered PDF templates.   FLM differs from this approach in various ways:
o     FLM can be used for any SAP process (or non-SAP process), not just HR processes; o FLM can trigger multiple updates – for example a mixture of ‘PA‘ and ‘OM‘ in the same process; o       FLM can render HTML forms, so the forms can be accessed on multiple mobile devices; o      Customers find custom e-form development easier with FLM than the standard toolkit.
Q       What Languages are supported by FLM?
A       The FLM application (SAP add-on) is currently delivered in English.  Other languages are planned and will be prioritised by demand.
However, the e-forms accessed by users can be delivered in any language and character set supported by SAP and Adobe: At run-time multiple languages are supported.
Q       Does FLM support on-line and off-line scenarios? 
A       Yes. On-line scenario is via FLM Portal, off-line via SMTP transport.  In addition there is a download scenario, where off-line forms are accessed from an on-line Portal and then downloaded to local storage for off-line processing – this is especially useful for people who need to prepare customer-specific forms and then travel to a remote location.
Q       Does FLM handle reminders & escalations?
A       Out-of-the-box FLM supports reminders and escalations.  A reminder is sent after a fixed period from when a particular user receives the form and no action has been taken.  This takes the form of an e-mail and can be set to repeat at equal intervals if required.  An escalation occurs after a further period of delay, whereupon FLM transfers the form to another user, user determination as configured via normal FLM routing.
Q       Is any form of digital security enabled for use with FLM? 
A       Yes.  FLM supports the use of https, digital signatures and server-side signing with Adobe forms.  In addition, you can set a ‘Validity Plan’ against a form to control the period of time for which the form can be processed.
Q       How does FLM handle attachments in interactive forms? What I heard is that we can not attach a file in ABAP WebDynpro generated interactive form.
A       FLM handles attachments as part of the standard package, so no development is necessary, and this applies to both online and offline scenarios.  In the offline scenario FLM handles attachments that are inside the pdf and also attachments that are attached to the email.  


             

FAQS – INSTALLATION, PROJECTS, TRAINING

Q       How long does the basic installation of the product take? 
A Arch allow one day for this, which may include activation of the SAP Interactive Forms by Adobe software. 
Q       How is an FLM project managed?
A       It depends on the customer. In some scenarios customers take the standard FLM training course offered by Arch and the run the entire project themselves.  Alternatively Arch or its partners can take a more active role to de-risk the early stages of the project.
Q       We have a large forms catalogue but we don’t want to convert them all at once. Is it possible to stagger the implementation of our e-forms?
A       Yes. Although FLM is most cost-effective for a large form catalogue, it is typically implemented in stages. The initial software cost includes a license for five forms, and future form licenses can be purchased in bundles of ten so there are plenty of options for the expansion of a form catalogue after an initial pilot project. It is also possible to develop a few simple forms using FLM, and integrate the full functionality capability at a later stage.
Q       Where does FLM training happen and how long does it take?
A       There is a three day introduction to FLM course and a three day Advanced FLM course, depending on numbers the course can be run either at a training partner‘s site.or at the customer’s own premises.  A prequisite is a modest background in ABAP.
Q       Given that Interactive Forms by Adobe are embedded within SAP, how might you go about building forms which involve other applications, or maybe totally non-SAP?
A       Arch used FLM at a large utilities company to build a purchase requisition POC form that had a 3 level workflow approval mechanism and posted an actual requisition into SAP in a managed way; when the form is first launched it collects data from 3 systems, 2 SAP systems and 1 SQL-database non-SAP system in order to do the pre-population on the form and to drive the form workflow. With FLM Arch achieved the whole thing in 3.5 days, including installing the FLM software and training 2 customer staff to use the Adobe designer tool and FLM. So non-SAP systems can be brought into the mix quite easily – any mechanism that SAP itself supports to receive or distribute data from other systems [IDoc, SM59, file, EDI, BAPI, native SQL etc] can be utilized by FLM to make data available to/from forms.

FAQS – LICENSING AND SUPPORT 

Q       How is FLM licensed? 
A               FLM is licensed from Arch.  The license fee is based on 3 elements: o        An engine-price o          A user-price o   Annual maintenance and support fee.
Q       How is support managed? 
A       The product is supported directly by Arch in the UK who are the creators of the software. For form-related problems, FLM forms can be exported from a customer’s FLM system and sent directly to Arch for analysis.
Q       Is the product supported by SAP? 

A       FLM is an SAP endorsed business solution, it was awarded ‘Powered by Netweaver’ application status in mid-2007 so it is ‘SAP certified’ but not supported by SAP. 


13. What is PDF-Based Print Form?
A PDF-based print form is a form designed for mass printing in SAP systems. It has the standard Portable Document Format (PDF).

14. What are the uses of PDF-Based Print Form?
PDF-based print forms can be used for the following:
Order confirmations
Invoices
Account statements
Checks
Salary statements
Delivery notes
Customs forms
Industry-specific forms, such as quality forms in the automotive industry.


*&---------------------------------------------------------------------*
*& Report  Z_PDF_CREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report  z_pdf_create.

type-pools abap.
include fp_utilities.
parameters:
p_frm type fpwbformname obligatory,
p_pdf type localfile visible length 64 obligatory,
p_int type abap_bool default abap_true as checkbox,
p_dyn type abap_bool as checkbox.

data:
      l_fp        type ref to if_fp,
      l_pdfobj    type ref to if_fp_pdf_object,
      l_xftref    type string,
      l_pdfresult type xstring,
      l_fpex      type ref to cx_fp_runtime,
      l_fpex_api  type ref to cx_fp_api,
      l_error     type string.

at selection-screen on value-request for p_pdf.
perform value_help_for_output_file using 'PDF'
changing p_pdf.

start-of-selection.

*DETERMINE THE URL FOR THE FORM
try.
  cl_fp_wb_helper=>form_layout_existsi_name p_frm ).
catch cx_fp_api_usage"EC NO-HANDLER
catch cx_fp_api_repository into l_fpex_api.
  if l_fpex_api->textid =
  cx_fp_api_repository=>object_already_exists.
    l_xftref cl_fp_wb_helper=>form_layout_url(
    i_name p_frm
    i_dest_path 'X' ).
  else.
    message id 'FPRUNX' type 'E' number '050' with sy-langu.
  endif.
endtry.

*GET FP REFERENCE.
l_fp cl_fp=>get_reference).
try.
*CREATE PDF OBJECT.
  l_pdfobj l_fp->create_pdf_object).

*SET TEMPLATE.
  l_pdfobj->set_templatexftfile l_xftref
  fillable p_int ).

*TELL PDF OBJECT TO CREATE PDF
  l_pdfobj->set_task_renderpdfdynamic p_dyn ).

*EXECUTE. CALL ADS.
  l_pdfobj->execute).

*GET RESULT.
  l_pdfobj->get_pdfimporting pdfdata l_pdfresult ).
catch cx_fp_runtime_internal
  cx_fp_runtime_system
  cx_fp_runtime_usage into l_fpex.

  l_error l_fpex->get_errmsg).
  message l_error type 'E'.
endtry.

perform download_file using l_pdfresult p_pdf.

************************************************
************************************************
*&---------------------------------------------------------------------*
*&  Include           FP_UTILITIES
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*&      Form  value_help_for_destination
*&---------------------------------------------------------------------*
*       Get an RFC destination from a dialog box to select from.
*----------------------------------------------------------------------*
*      <--p_dest destination="" nbsp="" span="">
*----------------------------------------------------------------------*
form value_help_for_destination using p_fieldname type dynfnam.
                                                            "#EC CALLED
  typesbegin of lty_rfcdes,
           rfcdest    type rfcdest,
           rfctype    type rfctype_d,
           rfcoptions type rfcoptions,
         end of lty_rfcdes,
         begin of lty_disp,
           rfcdest  type rfcdest,
           ssl      type rfcsnc,
           hostname type icmhostnam,
           port     type rfcsysid,
         end of lty_disp.
  data:   lt_dest    type standard table of lty_rfcdes with key rfcdest,
          ls_dest    type lty_rfcdes,
          ls_rfcdes  type rfcdes,
          ls_display type rfcdisplay,
          ls_disp    type lty_disp.
  statics st_dests   type standard table of lty_disp with key rfcdest.

* Read all suitable RFC destinations from the database.
  if st_dests is initial.
    select rfcdest rfctype rfcoptions from rfcdes into table lt_dest
        where   rfctype if_dest_root=>co_type_http_ext
            and rfcoptions like '%AdobeDocument%'
        order by primary key.                           "#EC CI_GENBUFF
    loop at lt_dest into ls_dest.
      ls_rfcdes-rfcdest    ls_dest-rfcdest.
      ls_rfcdes-rfctype    ls_dest-rfctype.
      ls_rfcdes-rfcoptions ls_dest-rfcoptions.
      call function 'RFCDES2RFCDISPLAY'
        exporting
          import_rfcdes     ls_rfcdes
        importing
          export_rfcdisplay ls_display.
      movels_display-rfcdest  to ls_disp-rfcdest,
            ls_display-rfcsnc   to ls_disp-ssl,
            ls_display-rfchost  to ls_disp-hostname,
            ls_display-rfcsysid to ls_disp-port.
      insert ls_disp into table st_dests.
    endloop.
  endif.

* Show the value-help popup.
  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield    'RFCDEST'
      dynpprog    sy-repid
      dynpnr      sy-dynnr
      dynprofield p_fieldname
      value_org   'S'
    tables
      value_tab   st_dests.
endform.                    "value_help_for_destination


*&---------------------------------------------------------------------*
*&      Form  value_help_for_file
*&---------------------------------------------------------------------*
*       Get a local file name from a dialog box to select from.
*----------------------------------------------------------------------*
*      -->P_EXTENSION  extension
*      <--p_filename file="" name="" nbsp="" selected="" span="">
*----------------------------------------------------------------------*
form value_help_for_file using    p_extension type string
                         changing p_filename  type localfile.
                                                            "#EC CALLED
  datal_filetable type filetable,
        l_status    type i.

  call method cl_gui_frontend_services=>file_open_dialog
    exporting
      default_extension       p_extension
      file_filter             cl_gui_frontend_services=>filetype_all
    changing
      file_table              l_filetable
      rc                      l_status
    exceptions
      file_open_dialog_failed 1
      cntl_error              2
      error_no_gui            3
      not_supported_by_gui    4
      others                  5.
  if sy-subrc is initial and l_status > 0.
    read table l_filetable into p_filename index 1.
  endif.
endform.                    "value_help_for_file


*&---------------------------------------------------------------------*
*&      Form  value_help_for_output_file
*&---------------------------------------------------------------------*
*       Get a local file name where to save data
*       from a dialog box to select from.
*----------------------------------------------------------------------*
*      -->P_EXTENSION  extension
*      <--p_filename file="" name="" nbsp="" selected="" span="">
*----------------------------------------------------------------------*
form value_help_for_output_file using    p_extension type string
                                changing p_filename  type localfile.
                                                            "#EC CALLED
  datal_filename       type string,
        l_filename_dummy type string.

  call method cl_gui_frontend_services=>file_save_dialog
    exporting
      default_extension       p_extension
      file_filter             cl_gui_frontend_services=>filetype_all
    changing
      filename                l_filename_dummy
      path                    l_filename_dummy
      fullpath                l_filename
    exceptions
      cntl_error              1
      error_no_gui            2
      not_supported_by_gui    3
      others                  4.
  if sy-subrc is initial.
    move l_filename to p_filename.
  endif.
endform.                    "value_help_for_output_file


*&--------------------------------------------------------------------*
*&      Form  load_file
*&--------------------------------------------------------------------*
*       Load a file from the frontend.
*---------------------------------------------------------------------*
*      -->P_FILENAME file name
*      <--p_content content="" file="" nbsp="" of="" span="" the="">
*---------------------------------------------------------------------*
form load_file using    p_filename type localfile
               changing p_content  type xstring.            "#EC CALLED
  datal_filename type string,
        l_rawtab   type standard table of raw255,
        l_len      type i.

  move p_filename to l_filename.
  call method cl_gui_frontend_services=>gui_upload
    exporting
      filename                l_filename
      filetype                'BIN'
    importing
      filelength              l_len
    changing
      data_tab                l_rawtab
    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
      not_supported_by_gui    17
      error_no_gui            18
      others                  19.
  if sy-subrc is not initial.
    message id sy-msgid type sy-msgty number sy-msgno
               with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

  call function 'SCMS_BINARY_TO_XSTRING'
    exporting
      input_length l_len
    importing
      buffer       p_content
    tables
      binary_tab   l_rawtab
    exceptions
      failed       1
      others       2.
  if sy-subrc is not initial.
    message id sy-msgid type sy-msgty number sy-msgno
        with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

endform.                    "load_file


*&---------------------------------------------------------------------*
*&      Form  download_file
*&---------------------------------------------------------------------*
*       Download a file to the frontend.
*----------------------------------------------------------------------*
*      -->P_DATA     content to be downloaded
*      -->P_FILE     file name
*----------------------------------------------------------------------*
form download_file using p_data type xstring
                         p_file type localfile.             "#EC CALLED
  datal_len      type i,
        l_tab      type tsfixml,
        l_filename type string.

  call function 'SCMS_XSTRING_TO_BINARY'
    exporting
      buffer        p_data
    importing
      output_length l_len
    tables
      binary_tab    l_tab.
  move p_file to l_filename.
  call method cl_gui_frontend_services=>gui_download
    exporting
      bin_filesize l_len
      filename     l_filename
      filetype     'BIN'
    changing
      data_tab     l_tab
    exceptions
      others       1.
  if sy-subrc is initial.
    message id 'VER_MESSAGES' type 'S' number '082' with p_file.
  else.
    message id 'VER_MESSAGES' type 'E' number '083'.
  endif.
endform.                    "download_file


*&---------------------------------------------------------------------*
*&      Form  error
*&---------------------------------------------------------------------*
*       Show the error message.
*----------------------------------------------------------------------*
*      -->P_EXCEPTION  exception-class instance
*----------------------------------------------------------------------*
form error using p_exception type ref to cx_fp_runtime.     "#EC CALLED
  data lv_type   type string.
  data lx_system type ref to cx_fp_runtime_internal.

  lv_type substring_after(
                val cl_abap_classdescr=>get_class_namep_exception )
                sub 'RUNTIME_' ).
* Create an exception object to display the message in order to allow
* the user to request the display in a pop-up window.
  create object lx_system
    exporting
      textid cx_fp_runtime_internal=>generic
      errmsg |{ lv_type } ERROR{ p_exception->get_text}|.
  message lx_system type 'E'.
endform.                    "error


*******************************************************
*******************************************************


input:


output:














No comments:

Post a Comment