Delivering documents to SAPconnect nodes in SAP

advertisement
Technical Note
Delivering documents to SAPconnect
nodes in SAP R/3 Enterprise
This technical note provides the following information:
•
Examples of how to deliver SAP R/3 application-generated documents intended for fax and e-mail destinations
to a SAPconnect node in an SAP R/3 Enterprise system. The examples use sample SAPscript programs, sample
layout sets, and a sample ABAP report program that are described in Table 1-1. The sample code for these
programs are included in “Sample Programs” on page 15.
•
Instructions for uploading and testing the execution of these programs in a test environment of an SAP R/3
Enterprise system.
•
Instructions for using the Job Wizard in an SAP R/3 Enterprise system to schedule a background job to deliver
documents waiting in a queue at a SAPconnect node to the Dazel SAPconnect server.
NOTE: The screen images in this technical note are from the SAP R/3 GUI version 6.20.
Prerequisites
The information in this technical note is intended for SAPscript and ABAP developers. It assumes that you know how
to develop SAPscript and ABAP programs for use in an SAP R/3 Enterprise system. It also assumes that your SAP
R/3 Enterprise test environment includes an installation of HP Output Server 3.3 and HP Output Manager for R/3 6.1
at the appropriate service pack levels for use with an SAP R/3 Enterprise system. For more information about using
HP Output Server 3.3 and HP Output Manager for R/3 6.1 with an SAP R/3 Enterprise system, see the release notes
for Service Pack 03.4 for HP Output Manager for R/3 6.1. The information in this technical note also assumes that
you know how to configure the following:
•
an RFC destination in an SAP R/3 Enterprise system
•
a SAPconnect node in an SAP R/3 Enterprise system
•
a Dazel SAPconnect Server in HP Output Manager for R/3 6.1
Background
SAP R/3 Enterprise does not support the SAPcomm communication connection for faxing. The SAPcomm
communication connection enables SAP application-generated documents to be sent through the the R/3 host spool
system and enables the automatic lookup of customer fax numbers and routing of documents to the correct
destination based on various parameters, such as customer or vendor name. The SAP-recommended alternative for
faxing SAP R/3 application-generated documents in an SAP R/3 Enterprise system is the SAPconnect
communication connection.
1
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
Obtaining the sample programs and layout sets
HP Output Manager for R/3 is a set of interfaces that integrates SAP R/3 applications with HP Output Server. The
Dazel SAPconnect Server component of HP Output Manager for R/3 is an R/3 communications server that provides
SAP R/3 users a fax interface and job-status reporting. The Dazel SAPconnect Server integrates the SAP BC-CON
interface with HP Output Server by accepting documents from a SAPconnect node and passing them to HP Output
Server. It does not use the R/3 host spool system for faxing; all messages communicated in or out of the SAPconnect
Server are stored in the SAPoffice message queue.
The sample SAPscript and ABAP programs in this technical note are examples of programs that enable SAP R/3
Enterprise to deliver SAP R/3 application-generated documents to SAPconnect nodes. These documents can then be
routed to HP Output Server fax and e-mail destinations through the Dazel SAPconnect Server of HP Output Manager
for R/3.
Obtaining the sample programs and layout sets
Table 1-1 identifies the program names and a brief description of the sample SAPscript print programs, layout sets,
and the ABAP report program referenced in Examples 1, 3, and 4 in this technical note. Example 2 references the
standard invoice driver program (RLB_INVOICE) and Smart Form (SF_LB_INVOICE) that are included in an SAP
R/3 Enterprise system. “Sample Programs” on page 15 contains the text of the sample print programs, layout sets,
and report program described in Table 1-1.
Table 1-1. Sample programs, layout sets, and report
Sample Name
Sample Type
Description
YRVADOR01
SAPscript print program
Generates a custom SAPscript sales order with the sample layout set
YRVORDER01 for order confirmation in the Sales and Distribution
module of an SAP R/3 Enterprise system.
YRVORDER01
layout set
Used with the sample print program YRVADOR01 to generate a
custom SAPscript sales order in the Sales and Distribution module
of an SAP R/3 Enterprise system.
YHP_POFORM
SAPscript print program
Generates a purchase order form with the sample layout set
ZHP_POFORM.
ZHP_POFORM
layout set
Used with the sample print program YHP_FORM to generate a
purchase order form.
YSALES_SC
ABAP report program
Retrieves a data list, creates a document, and sends it to a
SAPconnect node.
Uploading the sample files
To see how the sample programs and layout sets identified in Table 1-1 function in the examples described in this
technical note, you must first upload each file to your SAP R/3 Enterprise test environment. To upload the sample
SAPscript programs and the ABAP report program, follow the steps in the following section, “Uploading the sample
programs into the test environment.” To upload the sample layout sets, follow the steps in “Uploading the sample
layout sets” on page 4.
Uploading the sample programs into the test environment
This section shows you how to upload the sample SAPscript print programs and the sample ABAP report program to
your SAP R/3 Enterprise test environment.
NOTE: To upload the sample layout sets identified in Table 1-1, follow the steps in “Uploading
the sample layout sets” on page 4.
2
Technical Note
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
Uploading the sample files
To upload a sample SAPscript program or the ABAP report identified in Table 1-1 into your SAP R/3 test
environment, follow these steps:
1.
Log on to the test environment installation of your SAP R/3 Enterprise system.
2.
In the command field, type /nse38 and press ENTER.
The ABAP Editor: Initial Screen appears.
3.
In the Program field, type the name of the sample program (for example, YRVADOR01).
4.
Under Subobjects, select Source code.
5.
From the Program menu, click Create.
The ABAP: Program Attributes screen appears.
6.
In the Title field, type a title (for example, Test Program).
7.
In the Type field, select Executable program.
8.
In the Status field, select Test program.
Technical Note
3
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
Uploading the sample files
9.
Click Save.
The Create Object Directory Entry screen appears.
10. Do not enter any information in this screen. Hewlett-Packard recommends that you treat each sample program as
a local object.
11. Click Local Object.
The ABAP Editor: Change Report screen appears.
12. From the Utilities menu, point to More Utilities.
13. Point to Upload/Download, and then click Upload.
14. In the File name field, enter the path and file name of the sample program to upload.
15. Click Open.
The SAP R/3 system uploads the sample program.
Uploading the sample layout sets
This section shows you how to upload the sample layout sets identified in Table 1-1 to your SAP R/3 Enterprise test
environment.
NOTE: To upload the sample SAPscript programs and the ABAP report program identified in
Table 1-1, follow the steps in “Uploading the sample programs into the test environment”
on page 2.
To upload a sample layout set identified in Table 1-1 into your SAP R/3 test environment, follow these steps:
1.
Log on to the test environment installation of your SAP R/3 Enterprise system.
2.
In the command field, type /nse38 and then press ENTER.
3.
In the Program field, type RSTXSCRP.
4.
From the Program menu, point to Execute, and then click Direct processing.
The SAPscript Export to Dataset/SAPscript Import from Dataset screen appears.
5.
Under Object selection and session ctrl, select Form.
6.
In the Object name field, type the file name of the layout set to upload (for example, YRVORDER01).
7.
In the Mode (EXPORT/IMPORT) field, type IMPORT.
4
Technical Note
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
8.
Leave the Dataset name field blank.
9.
Click Execute.
10. In the File name field, enter the path and file name of the sample layout set to upload.
11. Click Open.
The SAP R/3 system uploads the sample layout set.
SAPscripts, Smart Forms, and Reports
SAPscript and Smart Forms are programmatic methods for creating documents; reports is an ABAP programming
method for creating documents. This technical note provides three examples for delivering documents generated by
SAPscript and Smart Forms to a SAPconnect node and one example for reports.
Before you can generate output using these methods, you must configure your SAP R/3 system for output generation.
For example, you must ensure that the appropriate data is available in master table entries. Without the appropriate
data, SAPscript, Smart Forms, and reports cannot generate output.
Within the Sales and Distribution (S & D) module of SAP R/3 Enterprise, you can send documents through fax,
e-mail, and print communication methods by making modifications to the output configuration of the application.
Within SAPscript, you do this programmatically. The following examples generate output for documents created
through the S & D module.
Checking data
Before generating the documents described in the examples in this technical note, make sure that you have the
appropriate data in your test environment. Select a test customer, check the customer’s address, and enter a fax
number and e-mail address in the customer’s general data record by performing the following steps:
1.
In the command field, type /nXD02 and press ENTER.
The Change Customer: Initial Screen appears.
2.
Enter a customer number in the Customer field.
3.
Click Continue or Enter.
Technical Note
5
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
The Change Customer: General data screen appears.
4.
6
Under the Address tab, verify that data exists in the Fax and E-mail fields.
Technical Note
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
Example 1: Custom SAPscript documents
The following example shows how to deliver a custom SAPscript sales order from the S & D module to a
SAPconnect node using the sample print program YRVADOR01 and the sample custom layout set YRVORDER01.
The sales order number used in the example is based on sales order numbers available in the test environment of your
SAP R/3 system.
You must specify the sample SAPscript print program and the sample custom layout set in the output configuration
for the selected application. In this example, the configuration is for Order Confirmation in the S & D module. The
output type is BA00.
1.
In the command field, type /nspro and press ENTER.
The Customizing: Execute Project screen appears.
2.
Click SAP Reference IMG
.
The Display IMG screen appears.
Technical Note
7
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
3.
Locate Maintain Output Types by clicking Sales and Distribution -> Basic Functions -> Output Control ->
Output Determination -> Output Determination Using the Condition Technique -> Maintain Output
Determination for Sales Documents.
4.
Click the Execute icon
next to Maintain Output Types.
The Display View “Output Types”: Overview screen appears.
5.
Double-click the output type BA00 (Order Confirmation).
The Display View “Output Types”: Details screen appears.
6.
On the Default values tab, verify that the value in the Transmission medium field is either External send (for
e-mail) or Fax.
7.
Press the Back
8
button to go back to the Display View “Output Types”: Overview screen.
Technical Note
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
8.
Select the output type BA00 and then double-click the Processing routines folder under the Dialog Structure
pane.
The Display View “Processing routines”: Overview screen appears.
9.
Click Display->Change.
10. Under the Short text column, make sure that entries for Fax and External send exist. Under the Program
column for these entries, specify YRVADOR01 to use the sample program. Under the Form column for these
entries, specify YRVORDER01 to use the sample custom layout set.
NOTE: Under the Program and Forms columns, you can specify programs and forms that are
included in an SAP R/3 Enterprise system or custom SAPscript programs and layout sets,
such as the ones used in this example.
11. Click Save.
12. Double-click the Partner functions folder under the Dialog Structure pane.
13. Under the Medium column, make sure that the Fax and Eternal send mediums each have an entry.
Generating the output record from the S & D module
After you configure the system for output, follow these steps to generate the output record.
1.
In the command field, type /nva02 and then press ENTER.
2.
In the Order field, type a sales order number, and then press ENTER.
3.
From the Extras menu, point to Output, then Header, and click Edit.
Technical Note
9
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
The Change Standard Order: Output screen appears.
4.
Select the record with the medium Fax (or External send, if output generation is for e-mail), and click Repeat
output
.
5.
Click Save.
6.
In the command field, type /nscot and then press ENTER.
7.
Verify that a new job is placed in the waiting queue for fax (or for e-mail) for the appropriate SAPconnect node.
Example 2: SAPscript documents generated with Smart Forms
The following example shows how to deliver an invoice document from the S & D module to a SAPconnect node
using the SAP R/3 invoice driver program RLB_INVOICE and the SAP R/3 Smart Form SF_LB_INVOICE.
NOTE: Be sure that your test environment has sufficient data to generate an invoice.
1.
In your test environment, follow steps 1 through 8 in “Example 1: Custom SAPscript documents” on page 7.
2.
In the Display View “Processing routines”: Overview screen, click Display/Change.
3.
Examine the entries for the Fax and External send mediums. Under the Program column for these entries,
specify RLB_INVOICE to use the invoice driver program. Under the Form column for these entries, specify
SF_LB_INVOICE to use the Smart Form.
4.
Click Save.
5.
Double-click the Partner functions folder under the Dialog Structure pane.
6.
Under the Medium column, make sure that the Fax and Eternal send mediums each have an entry.
7.
Test the output by following the steps in “Generating the output record from the S & D module” on page 9.
10
Technical Note
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
SAPscripts, Smart Forms, and Reports
Example 3: Using a standalone SAPscript print (driver) program
The following example uses the sample SAPscript print program YHP_POFORM and the sample layout set
ZHP_POFORM to generate a purchase order and send it to a SAPconnect node. The print program references the
layout set. The print program is not dependent upon a particular module or another program that must be supplied
within a particular module. Follow these steps in your test environment to see how this sample print program and
layout set function.
1.
In the command field, type /nse38 and press ENTER.
2.
In the Program field, type YHP_POFORM.
3.
Select Source code under Subobjects, and then click Display.
The program displays.
4.
Click Direct Processing
to execute the program.
The PO form script screen appears.
Technical Note
11
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
Automating delivery of jobs from a SAPconnect node
5.
Type or select a purchase order number in the PONUMBER field.
6.
Select FAX (or INTERNET for e-mail).
7.
Click Execute.
8.
In the command field, type /nscot and press ENTER.
9.
Verify that a new job is placed in the waiting queue for the appropriate SAPconnect node.
Example 4: Reports
In this example, the sample ABAP report program YSALES_SC retrieves a data list, creates a report document, and
sends the document to a SAPconnect node. Follow these steps in your test environment to see how this sample report
program functions.
1.
In the command field, type /nse38 and press ENTER.
2.
In the Program field, type YSALES_SC
3.
Under Subobjects, select Source code, and then click Display.
4.
Click Direct Processing
to execute the program.
The sales script screen appears.
5.
In the RECEIVER field, type an e-mail address.
6.
In the MAILTYPE field, select the type of output required: F for faxing or U for e-mail.
7.
To view the data, select P1. To send the data to a SAPconnect node, select P2.
8.
Click Execute.
Automating delivery of jobs from a SAPconnect node
The following steps show how to use the Job Wizard in an SAP R/3 Enterprise system to schedule a background job
to deliver documents waiting in a queue at a SAPconnect node to the Dazel SAPconnect server. You can use a
background job, for example, to schedule a job to deliver a batch of documents waiting in a queue at a SAPconnect
node configured for faxing to the Dazel SAPconnect server.
1.
12
In the command field, type /nsm36 and press ENTER.
Technical Note
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
Automating delivery of jobs from a SAPconnect node
The Define Background Job screen appears.
2.
Click Job Wizard.
The Job Wizard prompts you for information about the job, including:
-
the job name and priority
-
whether the job should run on a particular server
3.
After supplying the requested information, click Continue.
4.
Select ABAP program step and click Continue.
Technical Note
13
Delivering documents to SAPconnect nodes in SAP R/3 Enterprise
Automating delivery of jobs from a SAPconnect node
The next screen that appears prompts you for an ABAP program name and variant.
5.
In the ABAP program name field, type RSCONN01
6.
In the Variant field, select FAX (or INT for e-mail).
7.
Click Continue.
8.
Follow the instructions on the remaining screens that appear.
14
Technical Note
Sample Programs
Automating delivery of jobs from a SAPconnect node
Appendix
Sample Programs
This appendix contains the text of the sample programs that are described in Table 1-1 and Examples 1, 3, and 4 in
this technical note.
THE SOFTWARE INCLUDED HEREIN IS PROVIDED AS AN EXAMPLE ONLY. MODIFICATIONS MAY BE
NECESSARY TO UTILIZE THIS SOFTWARE PROPERLY IN YOUR ENVIRONMENT.
NOTICE TO USER: PLEASE READ THIS CAREFULLY. BY USING ALL OR ANY PORTION OF THE
SOFTWARE YOU ACCEPT ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
AGREE WITH THE TERMS OF THIS AGREEMENT, DO NOT USE THE SOFTWARE.
DISCLAIMER OF WARRANTY
The Software is provided to you on an "AS IS" basis. HP makes no representation as to the adequacy of the Software
for any particular purpose or to produce any particular result. HP shall not be liable for loss or damage arising out of
this Agreement or from the distribution or use of the Software or any other materials. HP AND ITS SUPPLIERS DO
NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE
SOFTWARE, EXCEPT FOR ANY WARRANTY, CONDITION, REPRESENTATION OR TERM TO THE
EXTENT TO WHICH THE SAME CANNOT OR MAY NOT BE EXCLUDED OR LIMITED BY LAW
APPLICABLE TO YOU IN YOUR JURISDICTION, HP AND ITS SUPPLIERS MAKE NO WARRANTIES,
CONDITIONS, REPRESENTATIONS OR TERMS, EXPRESS OR IMPLIED, WHETHER BY STATUTE,
COMMON LAW, CUSTOM, USAGE OR OTHERWISE AS TO ANY OTHER MATTERS, INCLUDING BUT
NOT LIMITED TO NON-INFRINGEMENT OF THIRD PARTY RIGHTS, INTEGRATION, SATISFACTORY
QUALITY OR FITNESS FOR ANY PARTICULAR PURPOSE. YOU MAY HAVE ADDITIONAL RIGHTS
WHICH VARY FROM JURISDICTION TO JURISDICTION.
LIMITATION OF LIABILITY
IN NO EVENT WILL HP OR ITS SUPPLIERS BE LIABLE TO YOU FOR ANY DAMAGES, CLAIMS OR
COSTS WHATSOEVER OR ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL DAMAGES, OR ANY LOST
PROFITS OR LOST SAVINGS, EVEN IF AN HP REPRESENTATIVE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS OR FOR ANY CLAIM BY ANY THIRD
PARTY. THE FOREGOING LIMITATIONS AND EXCLUSIONS APPLY TO THE EXTENT PERMITTED BY
APPLICABLE LAW IN YOUR JURISDICTION. HP 'S AGGREGATE LIABILITY AND THAT OF ITS
SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE
AMOUNT PAID FOR THE SOFTWARE. Nothing contained in this Agreement limits HP 's liability to you in the
event of death or personal injury resulting from HP 's negligence or for the tort of deceit (fraud). HP is acting on
behalf of its suppliers for the purpose of disclaiming, excluding and/or limiting obligations, warranties and liability as
provided in this Agreement, but in no other respects and for no other purpose.
This Agreement is effective until terminated. HP has the right to terminate this Agreement immediately if you fail to
comply with any term hereof. Upon any such termination, you must return to HP all full and partial copies of the
Software in your possession or control.
Technical Note
15
Sample Programs
Sample Program YRVADOR01 (Example 1)
Sample Program YRVADOR01 (Example 1)
*----------------------------------------------------------------------*
*
Print of an order confirmation by SAPscript
*----------------------------------------------------------------------*
REPORT RVADOR01 LINE-COUNT 100 MESSAGE-ID VN.
TABLES: KOMK,
KOMP,
KOMVD,
VBCO3,
VBDKA,
VBDPA,
VBDPAU,
CONF_OUT,
SADR,
TVAG,
VEDKA,
VEDPA,
VEDKN,
VEDPN,
RISERLS,
KOMSER,
TVBUR,
TVKO,
ADRS,
FPLTDR,
WTAD_ADDIS_IN_SO_PRINT,
WTAD_BUYING_PRINT_EXTRA_TEXT.
INCLUDE RVADTABL.
INCLUDE RVDIREKT.
INCLUDE VEDADATA.
"Communicationarea for conditions
"Communicationarea for conditions
"Communicationarea for conditions
"Communicationarea for view
"Headerview
"Itemview
"Subitemnumbers
"Configuration data
"Addresses
"Reason for rejection
"Servicecontract head data
"Servicecontract position data
"Servicecontract head notice data
"Servicecontract pos. notice data
"Serialnumbers
"Serialnumbers for print
"Sales office
"Sales organisation
"Communicationarea for Address
"billing schedules
"additional
"texts belonging to additional
* data for access to central address maintenance
INCLUDE SDZAVDAT.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TYPE-POOLS: ADDI.
DATA PRICE_PRINT_MODE(1) TYPE C.
DATA: RETCODE
LIKE SY-SUBRC.
DATA: REPEAT(1) TYPE C.
DATA: XSCREEN(1) TYPE C.
DATA: BEGIN OF STEU,
VDKEX(1) TYPE C,
VDPEX(1) TYPE C,
KBKEX(1) TYPE C,
KBPEX(1) TYPE C,
END OF STEU.
DATA: BEGIN OF TVBDPA OCCURS 0.
INCLUDE STRUCTURE VBDPA.
16
"Print-mode
"Returncode
"Output on printer or screen
"Controldata for output
"Internal table for items
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
DATA: END OF TVBDPA.
DATA: BEGIN OF TKOMV OCCURS 50.
INCLUDE STRUCTURE KOMV.
DATA: END OF TKOMV.
DATA: BEGIN OF TKOMVD OCCURS 50.
INCLUDE STRUCTURE KOMVD.
DATA: END OF TKOMVD.
DATA: BEGIN OF TVBDPAU OCCURS 5.
INCLUDE STRUCTURE VBDPAU.
DATA: END
OF TVBDPAU.
DATA: BEGIN OF TKOMCON OCCURS 50.
INCLUDE STRUCTURE CONF_OUT.
DATA: END
OF TKOMCON.
DATA: BEGIN OF TKOMSERVH OCCURS 1.
INCLUDE STRUCTURE VEDKA.
DATA: END
OF TKOMSERVH.
DATA: BEGIN OF TKOMSERVP OCCURS 5.
INCLUDE STRUCTURE VEDPA.
DATA: END
OF TKOMSERVP.
DATA: BEGIN OF TKOMSERVHN OCCURS 5.
INCLUDE STRUCTURE VEDKN.
DATA: END
OF TKOMSERVHN.
DATA: BEGIN OF TKOMSERVPN OCCURS 5.
INCLUDE STRUCTURE VEDPN.
DATA: END
OF TKOMSERVPN.
DATA: BEGIN OF TKOMSER OCCURS 5.
INCLUDE STRUCTURE RISERLS.
DATA: END
OF TKOMSER.
DATA: BEGIN OF TKOMSER_PRINT OCCURS 5.
INCLUDE STRUCTURE KOMSER.
DATA: END
OF TKOMSER_PRINT.
DATA: BEGIN OF TFPLTDR OCCURS 5.
INCLUDE STRUCTURE FPLTDR.
DATA: END
OF TFPLTDR.
DATA: TADDI_PRINT TYPE ADDI_SO_PRINT_ITAB WITH HEADER LINE.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DATA: PR_KAPPL(01)
TYPE C VALUE 'V'. "Application for pricing
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Technical Note
17
Sample Programs
Sample Program YRVADOR01 (Example 1)
FORM ENTRY USING RETURN_CODE US_SCREEN.
CLEAR RETCODE.
XSCREEN = US_SCREEN.
PERFORM PROCESSING.
IF RETCODE NE 0.
RETURN_CODE = 1.
ELSE.
RETURN_CODE = 0.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM PROCESSING
*
*---------------------------------------------------------------------*
*
........
*
*---------------------------------------------------------------------*
FORM PROCESSING.
PERFORM GET_DATA.
CHECK RETCODE = 0.
PERFORM FORM_OPEN USING XSCREEN VBDKA-LAND1.
CHECK RETCODE = 0.
* PERFORM FORM_TITLE_PRINT.
CHECK RETCODE = 0.
PERFORM VALIDITY_PRINT.
CHECK RETCODE = 0.
PERFORM HEADER_DATA_PRINT.
CHECK RETCODE = 0.
PERFORM HEADER_SERV_PRINT.
CHECK RETCODE = 0.
PERFORM HEADER_NOTICE_PRINT.
CHECK RETCODE = 0.
PERFORM HEADER_INTER_PRINT.
CHECK RETCODE = 0.
PERFORM HEADER_TEXT_PRINT.
CHECK RETCODE = 0.
PERFORM ITEM_PRINT.
CHECK RETCODE = 0.
PERFORM END_PRINT.
CHECK RETCODE = 0.
PERFORM FORM_CLOSE.
CHECK RETCODE = 0.
ENDFORM.
***********************************************************************
*
S U B R O U T I N E S
*
***********************************************************************
*---------------------------------------------------------------------*
*
FORM ALTERNATIVE_ITEM
*
*---------------------------------------------------------------------*
18
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*
A text is printed, if the item is an alternative item.
*
*---------------------------------------------------------------------*
FORM ALTERNATIVE_ITEM.
CHECK VBDPA-GRPOS CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ALTERNATIVE_ITEM'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM CHECK_REPEAT
*
*---------------------------------------------------------------------*
*
A text is printed, if it is a repeat print for the document. *
*---------------------------------------------------------------------*
FORM CHECK_REPEAT.
CLEAR REPEAT.
SELECT * INTO *NAST FROM NAST WHERE
AND
AND
AND
AND
AND
AND
CHECK *NAST-VSTAT = '1'.
REPEAT = 'X'.
EXIT.
ENDSELECT.
KAPPL
OBJKY
KSCHL
SPRAS
PARNR
PARVW
NACHA
= NAST-KAPPL
= NAST-OBJKY
= NAST-KSCHL
= NAST-SPRAS
= NAST-PARNR
= NAST-PARVW
BETWEEN '1' AND '4'.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM DELIVERY_DATE
*
*---------------------------------------------------------------------*
*
If the delivery date in the item is different to the header
*
*
date and there are no scheduled quantities, the delivery date *
*
is printed in the item block.
*
*---------------------------------------------------------------------*
FORM DELIVERY_DATE.
IF VBDKA-LFDAT = SPACE AND
VBDPA-LFDAT NE SPACE AND
VBDPA-ETENR_DA = SPACE.
Technical Note
19
Sample Programs
Sample Program YRVADOR01 (Example 1)
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_DELIVERY_DATE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM DIFFERENT_CONSIGNEE
*
*---------------------------------------------------------------------*
*
If the consignee in the item is different to the header con- *
*
signee, it is printed by this routine.
*
*---------------------------------------------------------------------*
FORM DIFFERENT_CONSIGNEE.
CHECK VBDKA-NAME1_WE NE VBDPA-NAME1_WE
OR VBDKA-NAME2_WE NE VBDPA-NAME2_WE
OR VBDKA-NAME3_WE NE VBDPA-NAME3_WE
OR VBDKA-NAME4_WE NE VBDPA-NAME4_WE.
CHECK VBDPA-NAME1_WE NE SPACE
OR VBDPA-NAME2_WE NE SPACE
OR VBDPA-NAME3_WE NE SPACE
OR VBDPA-NAME4_WE NE SPACE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_CONSIGNEE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM DIFFERENT_REFERENCE_NO
*
*---------------------------------------------------------------------*
*
If the reference number in the item is different to the header*
*
reference number, it is printed by this routine.
*
*---------------------------------------------------------------------*
FORM DIFFERENT_REFERENCE_NO.
CHECK VBDPA-VBELN_VANG NE VBDKA-VBELN_VANG
OR VBDPA-VBTYP_VANG NE VBDKA-VBTYP_VANG.
CALL FUNCTION 'WRITE_FORM'
20
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
EXPORTING
ELEMENT = 'ITEM_REFERENCE_NO'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM DIFFERENT_TERMS
*
*---------------------------------------------------------------------*
*
If the terms in the item are different to the header terms,
*
*
they are printed by this routine.
*
*---------------------------------------------------------------------*
FORM DIFFERENT_TERMS.
DATA: US_VPOSN
LIKE VEDPA-VPOSN.
DATA: US_TEXT(1) TYPE C.
"Flag for Noticetext was printed
IF VBDPA-ZTERM NE VBDKA-ZTERM AND
VBDPA-ZTERM NE SPACE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_PAYMENT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
IF VBDPA-INCO1 NE SPACE.
IF VBDPA-INCO1 NE VBDKA-INCO1 OR
VBDPA-INCO2 NE VBDKA-INCO2.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_DELIVERY'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDIF.
* Print different validity-data for the position
READ TABLE TKOMSERVP WITH KEY VBDPA-POSNR.
IF SY-SUBRC EQ 0.
VEDPA = TKOMSERVP.
IF VEDPA-VBEGDAT NE SPACE
AND
Technical Note
21
Sample Programs
Sample Program YRVADOR01 (Example 1)
VEDPA-VENDDAT NE SPACE
AND
NOT VEDPA-VBEGDAT IS INITIAL AND
NOT VEDPA-VENDDAT IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_SERV1'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSEIF VEDPA-VBEGDAT NE SPACE AND
NOT VEDPA-VBEGDAT IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_SERV2'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_SERV3'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDIF.
* Notice-rules for the positions.
MOVE VBDPA-POSNR TO US_VPOSN.
CLEAR US_TEXT.
LOOP AT TKOMSERVPN WHERE VPOSN = US_VPOSN.
VEDPN = TKOMSERVPN.
IF US_TEXT IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_NOTTXT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
US_TEXT = CHARX.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
22
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
EXPORTING
ELEMENT = 'ITEM_TERMS_OF_NOTICE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDLOOP.
IF NOT US_TEXT IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'EMPTY_LINE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM END_PRINT
*
*---------------------------------------------------------------------*
*
*
*---------------------------------------------------------------------*
FORM END_PRINT.
PERFORM GET_HEADER_PRICES.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'.
PERFORM HEADER_PRICE_PRINT.
IF NOT PRICE_PRINT_MODE EQ CHARA.
* Pricing data init
CALL FUNCTION 'RV_PRICE_PRINT_GET_BUFFER'
EXPORTING
I_INIT
= CHARX
TABLES
T_TKOMV = TKOMV
T_TKOMVD = TKOMVD.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'END_VALUES'.
CALL FUNCTION 'CONTROL_FORM'
Technical Note
23
Sample Programs
Sample Program YRVADOR01 (Example 1)
EXPORTING
COMMAND = 'ENDPROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'SUPPLEMENT_TEXT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM FORM_CLOSE
*
*---------------------------------------------------------------------*
*
End of printing the form
*
*---------------------------------------------------------------------*
FORM FORM_CLOSE.
DATA DA_CLEAR_VBELN(1) TYPE C.
* bei Druckansicht im Anlegen gibt es noch keine Belegnummer - für die
* Anzeige temporäre Belegnummer übergeben und danach zurücknehmen, damit
* Folgeverarbeitung noch funktioniert
IF VBDKA-VBELN IS INITIAL.
DA_CLEAR_VBELN = CHARX.
VBDKA-VBELN = '$000000001'.
ENDIF.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
RETCODE = 1.
ENDIF.
SET COUNTRY SPACE.
IF DA_CLEAR_VBELN EQ CHARX.
CLEAR VBDKA-VBELN.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM FORM_OPEN
*
*---------------------------------------------------------------------*
*
Start of printing the form
*
*---------------------------------------------------------------------*
* --> US_SCREEN Output on screen
*
*
' ' = printer
*
24
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*
'X' = screen
*
* --> US_COUNTRY County for telecommunication and SET COUNTRY
*
*---------------------------------------------------------------------*
FORM FORM_OPEN USING US_SCREEN US_COUNTRY.
INCLUDE RVADOPFO.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM FORM_TITLE_PRINT
*
*---------------------------------------------------------------------*
*
Printing of the form title depending of the field VBTYP
*
*---------------------------------------------------------------------*
FORM FORM_TITLE_PRINT.
CASE VBDKA-VBTYP.
WHEN 'A'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_A'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'B'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_B'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'C'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_C'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'E'.
CALL FUNCTION 'WRITE_FORM'
Technical Note
25
Sample Programs
Sample Program YRVADOR01 (Example 1)
EXPORTING
ELEMENT = 'TITLE_E'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'F'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_F'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'G'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_F'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'H'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_H'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'K'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_K'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN 'L'.
26
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_L'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
WHEN OTHERS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TITLE_OTHERS'
WINDOW = 'TITLE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDCASE.
IF REPEAT NE SPACE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'REPEAT'
WINDOW = 'REPEAT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM GET_DATA
*
*---------------------------------------------------------------------*
*
General provision of data for the form
*
*---------------------------------------------------------------------*
FORM GET_DATA.
DATA: US_VEDA_VBELN
LIKE VEDA-VBELN.
DATA: US_VEDA_POSNR_LOW LIKE VEDA-VPOSN.
DATA: DA_MESS LIKE VBFS OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'RV_PRICE_PRINT_GET_MODE'
IMPORTING
E_PRINT_MODE = PRICE_PRINT_MODE.
Technical Note
27
Sample Programs
Sample Program YRVADOR01 (Example 1)
IF PRICE_PRINT_MODE EQ CHARA.
CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
TABLES
TKOMV = TKOMV.
ENDIF.
CLEAR KOMK.
CLEAR KOMP.
VBCO3-MANDT
VBCO3-SPRAS
VBCO3-VBELN
VBCO3-KUNDE
VBCO3-PARVW
=
=
=
=
=
SY-MANDT.
NAST-SPRAS.
NAST-OBJKY.
NAST-PARNR.
NAST-PARVW.
CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
EXPORTING
COMWA
=
IMPORTING
KOPF
=
TABLES
POS
=
MESS
=
EXCEPTIONS
FEHLER_BEI_DATENBESCHAFFUNG =
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
RETCODE = 1.
EXIT.
ELSE.
LOOP AT DA_MESS.
SY-MSGID = DA_MESS-MSGID.
SY-MSGNO = DA_MESS-MSGNO.
SY-MSGTY = DA_MESS-MSGTY.
SY-MSGV1 = DA_MESS-MSGV1.
SY-MSGV2 = DA_MESS-MSGV2.
SY-MSGV3 = DA_MESS-MSGV3.
SY-MSGV4 = DA_MESS-MSGV4.
PERFORM PROTOCOL_UPDATE.
ENDLOOP.
ENDIF.
VBCO3
VBDKA
TVBDPA
DA_MESS
1.
* fill address key --> necessary for emails
ADDR_KEY-ADDRNUMBER = VBDKA-ADRNR.
ADDR_KEY-PERSNUMBER = VBDKA-ADRNP.
ADDR_KEY-ADDR_TYPE = VBDKA-ADDRESS_TYPE.
* Fetch servicecontract-data and notice-data for head and position.
US_VEDA_VBELN
= VBDKA-VBELN.
US_VEDA_POSNR_LOW = POSNR_LOW.
CALL FUNCTION 'SD_VEDA_GET_PRINT_DATA'
EXPORTING
I_DOCUMENT_NUMBER = US_VEDA_VBELN
I_LANGUAGE
= SY-LANGU
28
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
I_POSNR_LOW
TABLES
PRINT_DATA_POS
PRINT_DATA_HEAD
PRINT_NOTICE_POS
PRINT_NOTICE_HEAD
= US_VEDA_POSNR_LOW
=
=
=
=
TKOMSERVP
TKOMSERVH
TKOMSERVPN
TKOMSERVHN.
PERFORM GET_CONTROLL_DATA.
PERFORM SENDER.
PERFORM CHECK_REPEAT.
PERFORM TVBDPAU_CREATE.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM GET_ITEM_BILLING_SCHEDULES
*
*---------------------------------------------------------------------*
*
In this routine the billing schedules are fetched from the
*
*
database.
*
*---------------------------------------------------------------------*
FORM GET_ITEM_BILLING_SCHEDULES.
REFRESH TFPLTDR.
CHECK NOT VBDPA-FPLNR IS INITIAL.
CALL FUNCTION 'BILLING_SCHED_PRINTVIEW_READ'
EXPORTING
I_FPLNR
= VBDPA-FPLNR
I_LANGUAGE = NAST-SPRAS
I_VBELN
= VBDKA-VBELN
TABLES
ZFPLTDR
= TFPLTDR.
ENDFORM.
*&---------------------------------------------------------------------*
*&
Form ITEM_BILLING_SCHEDULES_PRINT
*&---------------------------------------------------------------------*
*
This routine prints the billing shedules of a salesdocument
*
*
position.
*
*----------------------------------------------------------------------*
FORM ITEM_BILLING_SCHEDULES_PRINT.
DATA: FIRST_LINE(1) TYPE C.
FIRST_LINE = CHARX.
LOOP AT TFPLTDR.
FPLTDR = TFPLTDR.
*
Output of the following printlines
IF NOT FPLTDR-PERIO IS INITIAL.
*
periodische Fakturen
CALL FUNCTION 'WRITE_FORM'
Technical Note
29
Sample Programs
Sample Program YRVADOR01 (Example 1)
*
*
*
30
EXPORTING
ELEMENT = 'ITEM_BILLING_SCHEDULE_PERIODIC'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
bei periodischen nur eine Zeile
EXIT.
ELSEIF FPLTDR-FAREG CA '14'.
prozentuale Teilfakturierung
IF NOT FIRST_LINE IS INITIAL.
CLEAR FIRST_LINE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_BILLING_SCHEDULE_PERCENT_HEADER'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_BILLING_SCHEDULE_PERCENT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ELSEIF FPLTDR-FAREG CA '235'.
wertmäßige Teilfakturierung
IF NOT FIRST_LINE IS INITIAL.
CLEAR FIRST_LINE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_BILLING_SCHEDULE_VALUE_HEADER'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_BILLING_SCHEDULE_VALUE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ELSEIF FPLTDR-FAREG CA '3'.
*
Schlußrechnung
ENDIF.
ENDLOOP.
ENDFORM.
*eject
*&---------------------------------------------------------------------*
*&
FORM GET_ITEM_ADDIS
*&---------------------------------------------------------------------*
*
Additionals data are fetched from database
*----------------------------------------------------------------------*
FORM GET_ITEM_ADDIS.
CLEAR: TADDI_PRINT.
CALL FUNCTION 'WTAD_ADDIS_IN_SO_PRINT'
EXPORTING
FI_VBELN
= VBDKA-VBELN
FI_POSNR
= VBDPA-POSNR
*
FI_LANGUAGE
= SY-LANGU
TABLES
FET_ADDIS_IN_SO_PRINT = TADDI_PRINT
EXCEPTIONS
ADDIS_NOT_ACTIVE
= 1
NO_ADDIS_FOR_SO_ITEM = 2
OTHERS
= 3.
ENDFORM.
" GET_ITEM_ADDIS
*---------------------------------------------------------------------*
*
FORM GET_ITEM_CHARACTERISTICS
*
*---------------------------------------------------------------------*
*
In this routine the configuration data item is fetched from
*
*
the database.
*
*---------------------------------------------------------------------*
FORM GET_ITEM_CHARACTERISTICS.
DATA DA_T_CABN LIKE CABN OCCURS 10 WITH HEADER LINE.
DATA: BEGIN OF DA_KEY,
MANDT LIKE CABN-MANDT,
ATINN LIKE CABN-ATINN,
END
OF DA_KEY.
REFRESH TKOMCON.
CHECK NOT VBDPA-CUOBJ IS INITIAL AND
VBDPA-ATTYP NE VAR_TYP.
CALL FUNCTION 'VC_I_GET_CONFIGURATION'
Technical Note
31
Sample Programs
Sample Program YRVADOR01 (Example 1)
EXPORTING
INSTANCE
LANGUAGE
PRINT_SALES
TABLES
CONFIGURATION
EXCEPTIONS
OTHERS
= VBDPA-CUOBJ
= NAST-SPRAS
= CHARX
= TKOMCON
= 4.
RANGES : DA_IN_CABN FOR DA_T_CABN-ATINN.
* Beschreibung der Merkmale wegen Objektmerkmalen auf sdcom-vkond holen
CLEAR DA_IN_CABN. REFRESH DA_IN_CABN.
LOOP AT TKOMCON.
DA_IN_CABN-OPTION = 'EQ'.
DA_IN_CABN-SIGN
= 'I'.
DA_IN_CABN-LOW
= TKOMCON-ATINN.
APPEND DA_IN_CABN.
ENDLOOP.
*
*
*
*
*
*
*
CLEAR DA_T_CABN. REFRESH DA_T_CABN.
CALL FUNCTION 'CLSE_SELECT_CABN'
EXPORTING
KEY_DATE
BYPASSING_BUFFER
WITH_PREPARED_PATTERN
I_AENNR
IMPORTING
AMBIGUOUS_OBJ_CHARACTERISTIC
TABLES
IN_CABN
T_CABN
EXCEPTIONS
NO_ENTRY_FOUND
OTHERS
=
=
=
=
SY-DATUM
' '
' '
' '
=
= DA_IN_CABN
= DA_T_CABN
= 1
= 2.
* Preisfindungsmerkmale / Merkmale auf VCSD_UPDATE herausnehmen
SORT DA_T_CABN.
LOOP AT TKOMCON.
DA_KEY-MANDT = SY-MANDT.
DA_KEY-ATINN = TKOMCON-ATINN.
READ TABLE DA_T_CABN WITH KEY DA_KEY BINARY SEARCH.
IF SY-SUBRC <> 0 OR
( ( DA_T_CABN-ATTAB = 'SDCOM' AND
DA_T_CABN-ATFEL = 'VKOND'
) OR
( DA_T_CABN-ATTAB = 'VCSD_UPDATE' ) ) .
DELETE TKOMCON.
ENDIF.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM GET_ITEM_PRICES
*
*---------------------------------------------------------------------*
32
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*
In this routine the price data for the item is fetched from
*
*
the database.
*
*---------------------------------------------------------------------*
FORM GET_ITEM_PRICES.
CLEAR: KOMP,
TKOMV.
IF KOMK-KNUMV NE VBDKA-KNUMV OR
KOMK-KNUMV IS INITIAL.
CLEAR KOMK.
KOMK-MANDT = SY-MANDT.
KOMK-KALSM = VBDKA-KALSM.
KOMK-KAPPL = PR_KAPPL.
KOMK-WAERK = VBDKA-WAERK.
KOMK-KNUMV = VBDKA-KNUMV.
KOMK-VBTYP = VBDKA-VBTYP.
KOMK-LAND1 = VBDKA-LAND1.
KOMK-VKORG = VBDKA-VKORG.
KOMK-VTWEG = VBDKA-VTWEG.
KOMK-SPART = VBDKA-SPART.
KOMK-BUKRS = VBDKA-BUKRS_VF.
KOMK-HWAER = VBDKA-WAERS.
KOMK-PRSDT = VBDKA-ERDAT.
KOMK-KURST = VBDKA-KURST.
KOMK-KURRF = VBDKA-KURRF.
KOMK-KURRF_DAT = VBDKA-KURRF_DAT.
ENDIF.
KOMP-KPOSN = VBDPA-POSNR.
KOMP-KURSK = VBDPA-KURSK.
KOMP-KURSK_DAT = VBDPA-KURSK_DAT.
IF PRICE_PRINT_MODE EQ CHARA.
CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
EXPORTING
COMM_HEAD_I = KOMK
COMM_ITEM_I = KOMP
LANGUAGE
= NAST-SPRAS
IMPORTING
COMM_HEAD_E = KOMK
COMM_ITEM_E = KOMP
TABLES
TKOMV
= TKOMV
TKOMVD
= TKOMVD.
ELSE.
CALL FUNCTION 'RV_PRICE_PRINT_ITEM_BUFFER'
EXPORTING
COMM_HEAD_I = KOMK
COMM_ITEM_I = KOMP
LANGUAGE
= NAST-SPRAS
IMPORTING
COMM_HEAD_E = KOMK
COMM_ITEM_E = KOMP
Technical Note
33
Sample Programs
Sample Program YRVADOR01 (Example 1)
TABLES
TKOMV
TKOMVD
= TKOMV
= TKOMVD.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM GET_HEADER_PRICES
*
*---------------------------------------------------------------------*
*
In this routine the price data for the header is fetched from *
*
the database.
*
*---------------------------------------------------------------------*
FORM GET_HEADER_PRICES.
LOOP AT TVBDPA.
CALL FUNCTION 'SD_TAX_CODE_MAINTAIN'
EXPORTING
KEY_KNUMV
= VBDKA-KNUMV
KEY_KPOSN
= TVBDPA-POSNR
I_APPLICATION
= ' '
I_PRICING_PROCEDURE = VBDKA-KALSM
TABLES
XKOMV
= TKOMV.
ENDLOOP.
IF PRICE_PRINT_MODE EQ CHARA.
CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
EXPORTING
COMM_HEAD_I = KOMK
LANGUAGE
= NAST-SPRAS
IMPORTING
COMM_HEAD_E = KOMK
TABLES
TKOMV
= TKOMV
TKOMVD
= TKOMVD.
ELSE.
CALL FUNCTION 'RV_PRICE_PRINT_HEAD_BUFFER'
EXPORTING
COMM_HEAD_I = KOMK
LANGUAGE
= NAST-SPRAS
IMPORTING
COMM_HEAD_E = KOMK
TABLES
TKOMV
= TKOMV
TKOMVD
= TKOMVD.
ENDIF.
ENDFORM.
34
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*&---------------------------------------------------------------------*
*&
Form HEADER_DATA_PRINT
*&---------------------------------------------------------------------*
*
Printing of header data like terms, weights ....
*
*----------------------------------------------------------------------*
FORM HEADER_DATA_PRINT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_DATA'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
" HEADER_DATA_PRINT
*---------------------------------------------------------------------*
*
FORM HEADER_PRICE_PRINT
*
*---------------------------------------------------------------------*
*
Printout of the header prices
*
*---------------------------------------------------------------------*
FORM HEADER_PRICE_PRINT.
LOOP AT TKOMVD.
AT FIRST.
IF KOMK-SUPOS NE 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_SUM'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'UNDER_LINE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDAT.
KOMVD = TKOMVD.
IF KOMVD-KOAID = 'D'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TAX_LINE'.
ELSE.
Technical Note
35
Sample Programs
Sample Program YRVADOR01 (Example 1)
IF NOT KOMVD-KNTYP EQ 'f'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'SUM_LINE'.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE TKOMVD LINES SY-TFILL.
IF SY-TFILL = 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'UNDER_LINE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM HEADER_TEXT_PRINT
*
*---------------------------------------------------------------------*
*
Printout of the headertexts
*
*---------------------------------------------------------------------*
FORM HEADER_TEXT_PRINT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TEXT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_BILLING_CORRECTION_HEADER
*
*---------------------------------------------------------------------*
*
In the case of a billing correction, the header of the item
*
*
debit memo / credit memo position, is printed by this routine *
*---------------------------------------------------------------------*
FORM ITEM_BILLING_CORRECTION_HEADER USING US_GANF US_LANF.
CHECK VBDKA-VBKLT EQ VBKLT_RECH_KORR.
36
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*
IF VBDKA-VBTYP = VBTYP_GANF.
Gutschriftsanforderung
IF VBDPA-SHKZG = CHARX.
IF US_GANF IS INITIAL.
MOVE CHARX TO US_GANF.
MOVE SPACE TO US_LANF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CORRECTION_TEXT_K'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ELSE.
IF US_LANF IS INITIAL.
MOVE CHARX TO US_LANF.
MOVE SPACE TO US_GANF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CORRECTION_TEXT_L'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*
IF VBDKA-VBTYP = VBTYP_LANF.
Lastschriftssanforderung
IF VBDPA-SHKZG = SPACE.
IF US_LANF IS INITIAL.
MOVE CHARX TO US_LANF.
MOVE SPACE TO US_GANF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CORRECTION_TEXT_L'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ELSE.
IF US_GANF IS INITIAL.
Technical Note
37
Sample Programs
Sample Program YRVADOR01 (Example 1)
MOVE CHARX TO US_GANF.
MOVE SPACE TO US_LANF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CORRECTION_TEXT_K'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*&
Form ITEM_ADDIS_PRINT
*&---------------------------------------------------------------------*
*
Printout of item additionals
*----------------------------------------------------------------------*
FORM ITEM_ADDIS_PRINT.
LOOP AT TADDI_PRINT.
MOVE-CORRESPONDING TADDI_PRINT TO WTAD_ADDIS_IN_SO_PRINT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_ADDI_SO_INFO'
EXCEPTIONS
OTHERS = 1.
LOOP AT TADDI_PRINT-ADDI_SO_EXTRA_TEXT_INFO
INTO WTAD_BUYING_PRINT_EXTRA_TEXT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_ADDI_EXTRA_TEXT'
EXCEPTIONS
OTHERS = 1.
ENDLOOP.
ENDLOOP.
ENDFORM.
" ITEM_ADDIS_PRINT
*---------------------------------------------------------------------*
*
FORM ITEM_CHARACERISTICS_PRINT
*
*---------------------------------------------------------------------*
*
Printout of the item characteristics -> configuration
*
*---------------------------------------------------------------------*
FORM ITEM_CHARACTERISTICS_PRINT.
LOOP AT TKOMCON.
CONF_OUT = TKOMCON.
IF SY-TABIX = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
38
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
ELEMENT = 'ITEM_LINE_CONFIGURATION_HEADER'
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE_CONFIGURATION'
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_DELIVERY_CONFIRMATION
*
*---------------------------------------------------------------------*
*
If the delivery date is not confirmed, a text is printed
*
*---------------------------------------------------------------------*
FORM ITEM_DELIVERY_CONFIRMATION.
CHECK VBDKA-VBTYP NE VBTYP_GANF AND VBDKA-VBTYP NE VBTYP_LANF.
CHECK VBDPA-LFDAT = SPACE.
CHECK VBDPA-KWMENG NE 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_DELIVERY_CONFIRMATION'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_PRICE_PRINT
*
*---------------------------------------------------------------------*
*
Printout of the item prices
*
*---------------------------------------------------------------------*
FORM ITEM_PRICE_PRINT.
LOOP AT TKOMVD.
KOMVD = TKOMVD.
IF SY-TABIX = 1 AND
( KOMVD-KOAID = CHARB OR
Technical Note
39
Sample Programs
Sample Program YRVADOR01 (Example 1)
KOMVD-KSCHL = SPACE ).
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE_PRICE_QUANTITY'.
ELSE.
IF KOMVD-KNTYP NE 'f'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE_PRICE_TEXT'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE_REBATE_IN_KIND'.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_PRINT
*
*---------------------------------------------------------------------*
*
Printout of the items
*
*---------------------------------------------------------------------*
FORM ITEM_PRINT.
DATA: DA_SUBRC LIKE SY-SUBRC,
DA_DRAGR LIKE TVAG-DRAGR.
DATA: DA_GANF(1) TYPE C,
"Print flag for billing correction
DA_LANF(1) TYPE C.
"Print flag for billing correction
CALL FUNCTION 'WRITE_FORM'
"First header
EXPORTING ELEMENT = 'ITEM_HEADER'
EXCEPTIONS OTHERS = 1.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
"Activate header
EXPORTING ELEMENT = 'ITEM_HEADER'
TYPE
= 'TOP'
EXCEPTIONS OTHERS = 1.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
LOOP AT TVBDPA.
VBDPA = TVBDPA.
IF VBDPA-DRAGR EQ SPACE.
"Print rejected item?
IF VBDPA-POSNR_NEU NE SPACE.
"Item
PERFORM ITEM_BILLING_CORRECTION_HEADER USING DA_GANF DA_LANF.
PERFORM GET_ITEM_SERIALS.
PERFORM GET_ITEM_CHARACTERISTICS.
40
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
PERFORM GET_ITEM_BILLING_SCHEDULES.
PERFORM GET_ITEM_PRICES.
PERFORM GET_ITEM_ADDIS.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'ENDPROTECT'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE'.
PERFORM ITEM_REJECTED.
PERFORM ITEM_PRICE_PRINT.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'ENDPROTECT'.
PERFORM ITEM_TEXT_PRINT.
PERFORM ITEM_SERIALS_PRINT.
PERFORM ITEM_CHARACTERISTICS_PRINT.
PERFORM ITEM_ADDIS_PRINT.
PERFORM ITEM_REFERENCE_BILLING.
PERFORM ALTERNATIVE_ITEM.
PERFORM DELIVERY_DATE.
PERFORM ITEM_DELIVERY_CONFIRMATION.
PERFORM ITEM_BILLING_SCHEDULES_PRINT.
PERFORM DIFFERENT_REFERENCE_NO.
PERFORM DIFFERENT_TERMS.
PERFORM DIFFERENT_CONSIGNEE.
PERFORM SCHEDULE_HEADER.
PERFORM MAIN_ITEM.
ELSE.
PERFORM SCHEDULE_PRINT.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT =
FUNCTION =
TYPE
=
EXCEPTIONS OTHERS
=
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
"Deactivate Header
'ITEM_HEADER'
'DELETE'
'TOP'
1.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_REFERENCE_BILLING
*
*---------------------------------------------------------------------*
*
If the reference number of the billing is printed by this
*
*
routine. In case (debit memo / credit memo)
*
*---------------------------------------------------------------------*
Technical Note
41
Sample Programs
Sample Program YRVADOR01 (Example 1)
FORM ITEM_REFERENCE_BILLING.
CHECK VBDKA-VBKLT EQ VBKLT_RECH_KORR.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_REFERENCE_BILLING'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_REJECTED
*
*---------------------------------------------------------------------*
*
A text is printed, if the item is rejected
*
*---------------------------------------------------------------------*
FORM ITEM_REJECTED.
CHECK NOT VBDPA-ABGRU IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_REJECTED'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM MAIN_ITEM
*
*---------------------------------------------------------------------*
*
A text is printed, if the item is a main item
*
*---------------------------------------------------------------------*
FORM MAIN_ITEM.
READ TABLE TVBDPAU WITH KEY VBDPA-POSNR BINARY SEARCH.
CHECK SY-SUBRC = 0.
VBDPAU = TVBDPAU.
IF VBDPAU-UPOSB IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ONE_SUBITEM'
EXCEPTIONS
ELEMENT = 1
42
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'SEVERAL_SUBITEMS'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM ITEM_TEXT_PRINT
*
*---------------------------------------------------------------------*
*
Printout of the item texts
*
*---------------------------------------------------------------------*
FORM ITEM_TEXT_PRINT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_TEXT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM PROTOCOL_UPDATE
*
*---------------------------------------------------------------------*
*
The messages are collected for the processing protocol.
*
*---------------------------------------------------------------------*
FORM PROTOCOL_UPDATE.
CHECK XSCREEN = SPACE.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
MSG_ARBGB = SYST-MSGID
MSG_NR
= SYST-MSGNO
MSG_TY
= SYST-MSGTY
MSG_V1
= SYST-MSGV1
MSG_V2
= SYST-MSGV2
Technical Note
43
Sample Programs
Sample Program YRVADOR01 (Example 1)
MSG_V3
MSG_V4
EXCEPTIONS
OTHERS
= SYST-MSGV3
= SYST-MSGV4
= 1.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM SCHEDULE_HEADER
*
*---------------------------------------------------------------------*
*
If there are schedules in the item, then here is printed the *
*
header for the schedules.
*
*---------------------------------------------------------------------*
FORM SCHEDULE_HEADER.
CHECK VBDPA-ETENR_DA NE SPACE.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_SCHEDULE_HEADER'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM SCHEDULE_PRINT
*
*---------------------------------------------------------------------*
*
This routine prints the schedules for an item.
*
*---------------------------------------------------------------------*
FORM SCHEDULE_PRINT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_SCHEDULE_PRINT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM SENDER
*
44
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*---------------------------------------------------------------------*
*
This routine determines the address of the sender (Table VKO) *
*---------------------------------------------------------------------*
FORM SENDER.
SELECT SINGLE * FROM TVKO WHERE VKORG = VBDKA-VKORG.
IF SY-SUBRC NE 0.
SYST-MSGID = 'VN'.
SYST-MSGNO = '203'.
SYST-MSGTY = 'E'.
SYST-MSGV1 = 'TVKO'.
SYST-MSGV2 = SYST-SUBRC.
PERFORM PROTOCOL_UPDATE.
EXIT.
ENDIF.
CLEAR GV_FB_ADDR_GET_SELECTION.
GV_FB_ADDR_GET_SELECTION-ADDRNUMBER = TVKO-ADRNR.
CALL FUNCTION 'ADDR_GET'
EXPORTING
ADDRESS_SELECTION = GV_FB_ADDR_GET_SELECTION
ADDRESS_GROUP
= 'CA01'
IMPORTING
SADR
= SADR
EXCEPTIONS
OTHERS
= 01.
IF SY-SUBRC NE 0.
CLEAR SADR.
ENDIF.
"SADR40A
VBDKA-SLAND = SADR-LAND1.
IF SY-SUBRC NE 0.
SYST-MSGID = 'VN'.
SYST-MSGNO = '203'.
SYST-MSGTY = 'E'.
SYST-MSGV1 = 'SADR'.
SYST-MSGV2 = SYST-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDIF.
SELECT SINGLE * FROM TVBUR WHERE VKBUR = VBDKA-VKBUR.
IF SY-SUBRC NE 0.
SYST-MSGID = 'VN'.
SYST-MSGNO = '203'.
SYST-MSGTY = 'E'.
SYST-MSGV1 = 'TVBUR'.
SYST-MSGV2 = SYST-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDIF.
"SADR40A
ENDFORM.
*---------------------------------------------------------------------*
*
FORM TVBDPAU_CREATE
*
*---------------------------------------------------------------------*
Technical Note
45
Sample Programs
Sample Program YRVADOR01 (Example 1)
*
This routine is creating a table which includes the subitem- *
*
numbers
*
*---------------------------------------------------------------------*
FORM TVBDPAU_CREATE.
CLEAR TVBDPAU.
REFRESH TVBDPAU.
LOOP AT TVBDPA.
IF TVBDPA-UEPOS IS INITIAL.
* Eintrag der letzten Positon merken
IF TVBDPAU-UPOSV > 0.
APPEND TVBDPAU.
CLEAR TVBDPAU.
ENDIF.
* Neuen Eintrag anfangen
TVBDPAU-POSNR = TVBDPA-POSNR.
ELSE.
IF TVBDPAU-UPOSV IS INITIAL OR
TVBDPAU-UPOSV > TVBDPA-POSNR.
TVBDPAU-UPOSV = TVBDPA-POSNR.
ENDIF.
IF TVBDPAU-UPOSB < TVBDPA-POSNR AND
TVBDPAU-UPOSV < TVBDPA-POSNR.
TVBDPAU-UPOSB = TVBDPA-POSNR.
ENDIF.
TVBDPAU-UEPVW = TVBDPA-UEPVW.
"UPOS-Verwendung
ENDIF.
ENDLOOP.
IF TVBDPAU-UPOSV > 0.
APPEND TVBDPAU.
ENDIF.
SORT TVBDPAU.
ENDFORM.
*---------------------------------------------------------------------*
*
FORM VALIDITY_PRINT
*
*---------------------------------------------------------------------*
*
This routine is printing the period of validity for offers
*
*
and contracts
*
*---------------------------------------------------------------------*
FORM VALIDITY_PRINT.
CHECK STEU-VDKEX EQ SPACE.
CASE VBDKA-VBTYP.
WHEN 'B'.
IF VBDKA-ANGDT CN '0' OR
VBDKA-BNDDT CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VALIDITY_OFFER'
WINDOW = 'VALIDITY'
46
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
WHEN 'E'.
IF VBDKA-GUEBG CN '0' OR
VBDKA-GUEEN CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VALIDITY_CONTRACT'
WINDOW = 'VALIDITY'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
WHEN 'F'.
IF VBDKA-GUEBG CN '0' OR
VBDKA-GUEEN CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VALIDITY_CONTRACT'
WINDOW = 'VALIDITY'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
WHEN 'G'.
IF VBDKA-GUEBG CN '0' OR
VBDKA-GUEEN CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VALIDITY_CONTRACT'
WINDOW = 'VALIDITY'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
Technical Note
47
Sample Programs
Sample Program YRVADOR01 (Example 1)
*&
Form HEADER_NOTICE_PRINT
*&---------------------------------------------------------------------*
*
This routine prints the notice-rules of the contract-header.
*
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM HEADER_NOTICE_PRINT.
DATA: US_TEXT(1) TYPE C.
"Kz. falls Text für Kündigungsbed.
* Kündigungsbedingungen auf Kopfebene.
CLEAR US_TEXT.
LOOP AT TKOMSERVHN.
VEDKN = TKOMSERVHN.
IF US_TEXT IS INITIAL.
*
For the first time a headertext is printed.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TERMS_OF_NOTTXT'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
US_TEXT = CHARX.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TERMS_OF_NOTICE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDLOOP.
* If notice-rules exists a empty line is printed.
IF NOT US_TEXT IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'EMPTY_LINE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*eject
48
" HEADER_NOTICE_PRINT
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
*&---------------------------------------------------------------------*
*&
Form GET_ITEM_SERIALS
*&---------------------------------------------------------------------*
*
This routine give back the serialnumbers of salesdocument
*
*
position. The numbers are processed as print-lines in the
*
*
table KOMSER_PRINT.
*
*----------------------------------------------------------------------*
* --> US_VBELN Salesdocument
* --> US_POSNR Position of the salesdocument
*----------------------------------------------------------------------*
FORM GET_ITEM_SERIALS.
DATA: KEY_DATA LIKE RSEROB,
SERNOS LIKE RSEROB OCCURS 0 WITH HEADER LINE.
KEY_DATA-TASER = 'SER02'.
KEY_DATA-SDAUFNR = VBDKA-VBELN.
KEY_DATA-POSNR = VBDPA-POSNR.
IF KEY_DATA-SDAUFNR IS INITIAL AND NOT
KEY_DATA-POSNR IS INITIAL.
* beim Anlegen ist Belegnummer leer - deshalb Dummy-Belegnummer
KEY_DATA-SDAUFNR = CHAR$.
ENDIF.
* Read the Serialnumbers of a Position.
REFRESH: TKOMSER,
TKOMSER_PRINT.
CALL FUNCTION 'GET_SERNOS_OF_DOCUMENT'
EXPORTING
KEY_DATA
= KEY_DATA
TABLES
SERNOS
= SERNOS
EXCEPTIONS
KEY_PARAMETER_ERROR = 1
NO_SUPPORTED_ACCESS = 2
NO_DATA_FOUND
= 3
OTHERS
= 4.
IF SY-SUBRC NE 0 AND
SY-SUBRC NE 3.
PERFORM PROTOCOL_UPDATE.
ENDIF.
CHECK SY-SUBRC EQ 0.
* Serialnummern übergeben
TKOMSER-VBELN = SERNOS-SDAUFNR.
TKOMSER-POSNR = SERNOS-POSNR.
LOOP AT SERNOS.
TKOMSER-SERNR = SERNOS-SERNR.
APPEND TKOMSER.
ENDLOOP.
* Process the stringtable for Printing.
CALL FUNCTION 'PROCESS_SERIALS_FOR_PRINT'
EXPORTING
Technical Note
49
Sample Programs
Sample Program YRVADOR01 (Example 1)
I_BOUNDARY_LEFT
I_BOUNDARY_RIGHT
I_SEP_CHAR_STRINGS
I_SEP_CHAR_INTERVAL
I_USE_INTERVAL
I_BOUNDARY_METHOD
I_LINE_LENGTH
I_NO_ZERO
I_ALPHABET
I_DIGITS
I_SPECIAL_CHARS
I_WITH_SECOND_DIGIT
TABLES
SERIALS
SERIALS_PRINT
EXCEPTIONS
BOUNDARY_MISSING
INTERVAL_SEPARATION_MISSING
LENGTH_TO_SMALL
INTERNAL_ERROR
WRONG_METHOD
WRONG_SERIAL
TWO_EQUAL_SERIALS
SERIAL_WITH_WRONG_CHAR
SERIAL_SEPARATION_MISSING
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
*eject
=
=
=
=
=
=
=
=
=
=
=
=
'(_'
'_)'
',_'
'_-_'
'X'
'C'
50
'X'
SY-ABCDE
'0123456789'
'-'
' '
= TKOMSER
= TKOMSER_PRINT
=
=
=
=
=
=
=
=
=
01
02
03
04
05
06
07
08
09.
" GET_ITEM_SERIALS
*&---------------------------------------------------------------------*
*&
Form ITEM_SERIALS_PRINT
*&---------------------------------------------------------------------*
*
This routine prints the serialnumbers of a salesdocument
*
*
position.
*
*----------------------------------------------------------------------*
FORM ITEM_SERIALS_PRINT.
DATA: FIRST_LINE(1) TYPE C.
FIRST_LINE = CHARX.
LOOP AT TKOMSER_PRINT.
KOMSER = TKOMSER_PRINT.
IF NOT FIRST_LINE IS INITIAL.
*
Output of the Headerline
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE_SERIAL_HEADER'
EXCEPTIONS
ELEMENT = 1
50
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
CLEAR FIRST_LINE.
ELSE.
*
Output of the following printlines
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE_SERIAL'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDLOOP.
* If serialnumbers exists a empty line is printed.
IF FIRST_LINE IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'EMPTY_LINE'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
*eject
" ITEM_SERIALS_PRINT
*&---------------------------------------------------------------------*
*&
Form HEADER_INTER_PRINT
*&---------------------------------------------------------------------*
*
Prints the message that if other condition for the positions
*
*
exists they are printed there.
*
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM HEADER_INTER_PRINT.
CHECK NOT STEU-VDKEX IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TERMS_OF_TXTEND'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
Technical Note
51
Sample Programs
Sample Program YRVADOR01 (Example 1)
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDFORM.
" HEADER_INTER_PRINT
*&---------------------------------------------------------------------*
*&
Form GET_CONTROLL_DATA
*&---------------------------------------------------------------------*
*
Checks if servicedata for the header exists.
*
*
Checks if servicedata for the position exists.
*
*
Checks if noticedata for the header exists.
*
*
Checks if noticedata for the position exists.
*
*----------------------------------------------------------------------*
FORM GET_CONTROLL_DATA.
DATA: LINES TYPE I.
* Exists servicedata for the header?
DESCRIBE TABLE TKOMSERVH LINES LINES.
IF LINES GT 0.
STEU-VDKEX = 'X'.
ENDIF.
* Exists servicedata for the position?
DESCRIBE TABLE TKOMSERVP LINES LINES.
IF LINES GT 0.
STEU-VDPEX = 'X'.
ENDIF.
* Exists noticedata for the header?
DESCRIBE TABLE TKOMSERVHN LINES LINES.
IF LINES GT 0.
STEU-KBKEX = 'X'.
ENDIF.
* Exists noticedata for the position?
DESCRIBE TABLE TKOMSERVPN LINES LINES.
IF LINES GT 0.
STEU-KBPEX = 'X'.
ENDIF.
ENDFORM.
*eject
" GET_CONTROLL_DATA
*&---------------------------------------------------------------------*
*&
Form HEADER_SERV_PRINT
*&---------------------------------------------------------------------*
*
Output of the validity of a service-contract.
*
*----------------------------------------------------------------------*
FORM HEADER_SERV_PRINT.
CHECK NOT STEU-VDKEX IS INITIAL.
READ TABLE TKOMSERVH INDEX 1.
52
Technical Note
Sample Programs
Sample Program YRVADOR01 (Example 1)
MOVE TKOMSERVH TO VEDKA.
* Output of the validity.
IF NOT VEDKA-VENDDAT IS INITIAL OR
VEDKA-VENDDAT EQ SPACE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TERMS_OF_SERV1'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSEIF VEDKA-VBEGDAT NE SPACE AND
NOT VEDKA-VBEGDAT IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TERMS_OF_SERV2'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER_TERMS_OF_SERV3'
EXCEPTIONS
ELEMENT = 1
WINDOW = 2.
IF SY-SUBRC NE 0.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
ENDFORM.
Technical Note
" HEADER_SERV_PRINT
53
Sample Programs
Sample layout set YRVORDER01 (Example 1)
Sample layout set YRVORDER01 (Example 1)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
54
SFORMYRVORDER01
HFORMYRVORDER01
OLANE
HEADFORM
YRVORDER01
SAP
DEF ETEST
YRVORDER01
00046DEVELOP
46C 20030624165312DEVELOPER
620 2003070107335313200064
E0
800
LINE/:FORM CPI 10; LPI 6; TAB-STOP 1 CM; START-PAGE FIRST; PARAGRAPH AS;
RDI;
LINE/:FORM RDIDEV;
LINE/:PARAGRAPH AS LINE-SPACE 1 LN;
LINE/:PARAGRAPH CN LINE-SPACE 1 LN;
LINE/:PARAGRAPH FT ALIGN CENTER; PROTECT ALL; NOBLANKS ON; LINE-SPACE
0.50 LN;
LINE/:PARAGRAPH FT FONT HELVE; FONT-SIZE 6;
LINE/:PARAGRAPH HT LINE-SPACE 1 LN;
LINE/:PARAGRAPH ID LINE-SPACE 1 LN; LEFT-INDENT 7 CH;
LINE/:PARAGRAPH IL ALIGN RIGHT; LINE-SPACE 1 LN;
LINE/:PARAGRAPH IM LINE-SPACE 1 LN;
LINE/:PARAGRAPH IN LINE-SPACE 1 LN;
LINE/:PARAGRAPH IP LINE-SPACE 1 LN;
LINE/:PARAGRAPH IS LINE-SPACE 1 LN; LEFT-INDENT 7 CH;
LINE/:PARAGRAPH IT LINE-SPACE 1 LN; LEFT-INDENT 7 CH;
LINE/:PARAGRAPH SU LINE-SPACE 1 LN;
LINE/:PARAGRAPH TI LINE-SPACE 1 LN; FONT HELVE; FONT-SIZE 14; BOLD ON;
ITALIC OFF;
LINE/:PARAGRAPH TI ULINE OFF;
LINE/:PARAGRAPH UL LINE-SPACE 1 LN;
LINE/:PARAGRAPH CN TAB 1 70 CH RIGHT;
LINE/:PARAGRAPH IL TAB 1 7 CH LEFT; TAB 2 26 CH LEFT;
LINE/:PARAGRAPH IM TAB 1 7 CH LEFT; TAB 2 20 CH LEFT;
LINE/:PARAGRAPH IN TAB 1 2 CH LEFT; TAB 2 3 CH LEFT; TAB 3 5 CH LEFT;
LINE/:PARAGRAPH IP TAB 1 7 CH LEFT; TAB 2 19 CH RIGHT; TAB 3 20 CH LEFT;
LINE/:PARAGRAPH IP TAB 4 38 CH SIGN; TAB 5 39 CH LEFT; TAB 6 50 CH RIGHT;
LINE/:PARAGRAPH IP TAB 7 51 CH LEFT; TAB 8 71 CH SIGN;
LINE/:PARAGRAPH IS TAB 1 22 CH RIGHT; TAB 2 24 CH LEFT; TAB 3 25 CH RIGHT;
LINE/:PARAGRAPH IS TAB 4 47 CH LEFT;
LINE/:PARAGRAPH SU TAB 1 12 CH SIGN; TAB 2 13 CH LEFT; TAB 3 29 CH SIGN;
LINE/:PARAGRAPH SU TAB 4 30 CH LEFT; TAB 5 41 CH RIGHT; TAB 6 42 CH LEFT;
LINE/:PARAGRAPH SU TAB 7 58 CH SIGN; TAB 8 71 CH SIGN;
LINE/:STRING B BOLD ON;
LINE/:STRING I ITALIC ON;
LINE/:STRING K FONT HELVE; FONT-SIZE 10;
LINE/:STRING PR SUBSCRIPT OFF; SUPERSCRIPT OFF; HIDDEN OFF; PROTECT ON;
MARK OFF;
LINE/:STRING S FONT HELVE; FONT-SIZE 8;
LINE/:STRING U ULINE ON;
LINE/:WINDOW ADDRESS TYPE VAR;
LINE/:WINDOW FOOTER TYPE VAR;
LINE/:WINDOW GRAPH1 TYPE GRAPH;
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
LINE/:WINDOW GRAPH2 TYPE GRAPH;
LINE/:WINDOW HEADER TYPE VAR;
LINE/:WINDOW INFO TYPE CONST;
LINE/:WINDOW INFO1 TYPE VAR;
LINE/:WINDOW INFO2 TYPE VAR;
LINE/:WINDOW MAIN
LINE/:WINDOW PAGE TYPE VAR;
LINE/:WINDOW REPEAT TYPE CONST;
LINE/:PAGE FIRST NEXT NEXT; PAGE-COUNT START;
LINE/:PAGE NEXT NEXT NEXT;
LINE/:PAGE FIRST MAIN 0 7.87 CH 34.25 LN 71 CH 29 LN;
LINE/:PAGE FIRST WINDOW ADDRESS 7.87 CH 10.63 LN 35 CH 10 LN;
LINE/:PAGE FIRST WINDOW FOOTER 7.87 CH 64.96 LN 71 CH 4 LN;
LINE/:PAGE FIRST WINDOW GRAPH1 21 MM 15 MM 20.32 MM 17.60 MM;
LINE/:PAGE FIRST WINDOW GRAPH2 159 MM 17 MM 34.89 MM 9.49 MM;
LINE/:PAGE FIRST WINDOW HEADER 7.87 CH 1.18 LN 71 CH 10 LN;
LINE/:PAGE FIRST WINDOW INFO 43.31 CH 10.63 LN 35 CH 15 LN;
LINE/:PAGE FIRST WINDOW INFO1 7.87 CH 22.44 LN 35 CH 10 CM;
LINE/:PAGE FIRST WINDOW REPEAT 43.31 CH 11.81 LN 35 CH 1 LN;
LINE/:PAGE NEXT MAIN 0 7 CH 15 LN 71 CH 48 LN;
LINE/:PAGE NEXT WINDOW ADDRESS 7 CH 11 LN 35 CH 3 LN;
LINE/:PAGE NEXT WINDOW FOOTER 7 CH 65 LN 71 CH 4 LN;
LINE/:PAGE NEXT WINDOW HEADER 7 CH 1 LN 71 CH 10 LN;
LINE/:PAGE NEXT WINDOW INFO2 43 CH 11 LN 25 CH 3 LN;
LINE/:PAGE NEXT WINDOW PAGE 68 CH 11 LN 10 CH 3 LN;
END
HEADFORM
YRVORDER01
SAP
TXT DTEST
YRVORDER01
00008DEVELOP
46C 20030624165312DEVELOPER
620 2003070107335313200372
E0
800
LINE/:FORM TEXT 'TEST';
LINE/:PARAGRAPH AS TEXT 'Standard paragraph';
LINE/:PARAGRAPH CN TEXT 'Requirements';
LINE/:PARAGRAPH HT TEXT 'Header text';
LINE/:PARAGRAPH ID TEXT 'Alternative item data';
LINE/:PARAGRAPH IL TEXT 'Line item';
LINE/:PARAGRAPH IM TEXT 'Serial numbers';
LINE/:PARAGRAPH IN TEXT 'Cancellation dates';
LINE/:PARAGRAPH IP TEXT ' Line item prices';
LINE/:PARAGRAPH IS TEXT 'Schedule line';
LINE/:PARAGRAPH IT TEXT 'Item text';
LINE/:PARAGRAPH SU TEXT 'Totals line';
LINE/:PARAGRAPH TI TEXT 'Description of layout set';
LINE/:PARAGRAPH UL TEXT 'Separator';
LINE/:STRING B TEXT 'Bold';
LINE/:STRING I TEXT 'Italics';
LINE/:STRING K TEXT 'Key word';
LINE/:STRING PR TEXT 'Character string protected';
LINE/:STRING S TEXT 'Short key word';
LINE/:STRING U TEXT 'Character string underlined';
LINE/:WINDOW ADDRESS TEXT 'Addressee';
LINE/:WINDOW FOOTER TEXT 'Footer';
LINE/:WINDOW HEADER TEXT 'Header';
Technical Note
55
Sample Programs
Sample layout set YRVORDER01 (Example 1)
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
56
LINE/:WINDOW INFO TEXT 'Information (General data)';
LINE/:WINDOW INFO1 TEXT 'Additional data window';
LINE/:WINDOW INFO2 TEXT 'Info window - Next page';
LINE/:WINDOW MAIN TEXT 'Main window';
LINE/:WINDOW PAGE TEXT 'Page numbering';
LINE/:WINDOW REPEAT TEXT 'Repeat printout';
LINE/:PAGE FIRST TEXT 'FIrst Page';
LINE/:PAGE NEXT TEXT 'Next page';
LINE/WFOOTER
LINE/:INCLUDE &TVKO-TXNAM_FUS& OBJECT TEXT ID ADRS LANGUAGE
&VBDKA-SPRAS_VKO&
LINE/WHEADER
LINE/:INCLUDE &TVKO-TXNAM_KOP& OBJECT TEXT ID ADRS LANGUAGE
&VBDKA-SPRAS_VKO&
LINE/WINFO
LINE/:POSITION WINDOW
LINE/:POSITION XORIGIN '-0.5' CH YORIGIN '-0.25' LN
LINE/:SIZE WIDTH +0.4 CH HEIGHT +1 LN
LINE/:BOX FRAME 10 TW
LINE/:BOX HEIGHT '1.7' LN INTENSITY 20
LINE/:CASE &VBDKA-VBTYP&.
LINE/:WHEN 'A'.
LINETIInquiry
LINE/:WHEN 'B'.
LINETIQuotation
LINE/:WHEN 'C'.
LINETIOrder confirmation
LINE/:WHEN 'E'.
LINETIScheduling agreement confirmation
LINE/:WHEN 'G'.
LINETIContract confirmation
LINE/:WHEN 'H'.
LINETIReturns
LINE/:WHEN 'I'.
LINETIFree-of-charge delivery
LINE/:WHEN 'K'.
LINETICredit memo request
LINE/:WHEN 'L'.
LINETIDebit memo request
LINE/:WHEN OTHERS.
LINETIOrder confirmation
LINE/:ENDCASE.
LINE/
LINEASNumber/Date
LINE/ &VBDKA-VBELN&&' / 'VBDKA-AUDAT&
LINE/ Reference no./Date
LINE/ &VBDKA-BSTKD&&' /'VBDKA-BSTDK&
LINE/:IF &VBDKA-VBTYP_VANG& = 'B'.
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&.
LINE/ Quotation no./Date
LINE/ &VBDKA-VBELN_VANG&&' / 'VBDKA-AUDAT_VANG&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBDKA-VBTYP_VANG& = 'F' OR &VBDKA-VBTYP_VANG& = 'G'.
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&.
LINE/ Contract no./Date
LINE/ &VBDKA-VBELN_VANG&&' / 'VBDKA-AUDAT_VANG&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBDKA-VBTYP& = 'B' OR &VBDKA-VBTYP& = 'G'.
LINE/:IF &VBDKA-DELCO& NE &SPACE& AND &VBDKA-DELCO_BEZ& NE &SPACE&.
LINE/ Agreed delivery date
LINE/ &VBDKA-DELCO_BEZ&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBDKA-DATBEZ& NE &SPACE& OR &VBDKA-LFDAT& NE &SPACE&.
LINE/ Delivery date
LINE/:IF &VBDKA-DATBEZ& NE &SPACE&.
LINE/ &'&VBDKA-DATBEZ& 'VBDKA-LFDAT&
LINE/:ELSE.
LINE/ &VBDKA-LFDAT&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBCO3-KUNDE& NE &SPACE&.
LINE/ Cust. no.
LINE/ &VBCO3-KUNDE&
LINE/:ENDIF.
LINE/:IF &VBDKA-ANGDT& NE &SPACE&.
LINE/ Validity period
LINE/ &VBDKA-ANGDT& &'bis 'VBDKA-BNDDT&
LINE/:ENDIF.
LINE/:IF &VBDKA-GUEBG& NE &SPACE&.
LINE/ Validity period
LINE/ &VBDKA-GUEBG& &'bis 'VBDKA-GUEEN&
LINE/:ENDIF.
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINE/WREPEAT
LINE/EREPEAT
LINE/ Repeat printout
LINE/WINFO2
LINEAS<s>Doc. no./Date</>
LINE/ &VBDKA-VBELN&&' / 'VBDKA-AUDAT&
LINE/WPAGE
LINEAS<s>Page</>
LINE/ &PAGE&
LINE/*You can also print out the page number as "x of y":
LINE/*&PAGE& / &SAPSCRIPT-FORMPAGES&
LINE*
LINE*
LINE*
Technical Note
57
Sample Programs
Sample layout set YRVORDER01 (Example 1)
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
58
LINE*
LINE*
LINE/WMAIN
LINE/*POSITION XORIGIN '-0.1' CH YORIGIN '-35' LN
LINE/*SIZE WIDTH 71 CH HEIGHT +39 LN
LINE/*BOX FRAME 20 TW
LINE/*BOX WIDTH '+5' CH HEIGHT '72' LN INTENSITY 10
LINE/ESPACE_LINE
LINE/
LINE/EUNDER_LINE
LINEUL&ULINE(71)&
LINE/EHEADER_DATA
LINECN<k>We deliver according to the following conditions:</>
LINE= ,,&'<k>Currency</> 'VBDKA-WAERK&
LINE/:IF &VBDKA-ZTERM_TX1& NE &SPACE& OR &VBDKA-ZTERM_TX2& NE &SPACE& OR
&VBDK
LINEAS&'Terms of payment 'VBDKA-ZTERM_TX1&
LINE/ &'
'VBDKA-ZTERM_TX2&
LINE/ &'
'VBDKA-ZTERM_TX3&
LINE/:ELSE
LINE/:INCLUDE &VBDKA-ZTERM& OBJECT TEXT ID SDTP PARAGRAPH L
LINE/:ENDIF
LINEAS&'Terms of delivery
'VBDKA-INCO1& &VBDKA-INCO2&,,
LINE/
LINEAS<k>Weights (gross/net) - Volume - Mark</>
LINE/=<PR>&'Gross weight 'VBDKA-BRGEW(13)' &VBDKA-GEWEI& '&</>
LINE= <PR>&'Net weight
'VBDKA-NTGEW(13)' &VBDKA-GEWEI& '&</>
LINE= <PR>&'Volume
'VBDKA-VOLUM(13)' &VBDKA-VOLEH& '&</>
LINE/
LINE/EHEADER_TEXT
LINE/:INCLUDE 'SD_RVADOR01' OBJECT TEXT ID SDVD PARAGRAPH HT
LINE/:INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0001 PARAGRAPH HT
LINE/EITEM_HEADER
LINEUL&ULINE(71)&
LINEIL<k>Item,,Material,,Description</>
LINEIP<k>,,,,Qty,,,,Price,,Price unit,,,,,,Value</>
LINEUL&ULINE(71)&
LINE/
LINE/EITEM_LINE
LINEIL&VBDPA-POSNR&,,&VBDPA-MATNR&,,&VBDPA-ARKTX&
LINE/ ,,&'Customer mat. no. 'VBDPA-IDNKD' '&&'Item 'VBDPA-POSEX&
LINE/ ,,&'Purch.ord.no. /Item 'VBDPA-BSTKD&&' /'VBDPA-POSEX&
LINE/ ,,&'Purch.ord.no. GR/Item 'VBDPA-BSTKD_E&&' /'VBDPA-POSEX_E&
LINE/ ,,&'Batch 'VBDPA-CHARG&
LINE/EITEM_LINE_PRICE_QUANTITY
LINEIP,,,,&VBDPA-KWMENG(I12)&,,&VBDPA-VRKME&,,&KOMVD-KBETR(I12)& ,,
LINE=
&KOMVD-KOEIN&,,&KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KWERT(I14)&
LINE/EITEM_LINE_PRICE_TEXT
LINEIP,,&KOMVD-VTEXT(17)&,,,,,,&KOMVD-KBETR(I12)&,,&KOMVD-KOEIN& ,,
LINE= &KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KWERT(I14)&
LINE/EITEM_TEXT
LINE/:INCLUDE &VBDPA-TDNAME& OBJECT VBBP ID 0001 PARAGRAPH IT
LINE/EITEM_TERMS_OF_PAYMENT
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
LINE/:PROTECT
LINE/:IF &VBDPA-ZTERM_TX1& NE &SPACE& OR &VBDPA-ZTERM_TX2& NE &SPACE& OR
&VBDP
LINEID&'Terms of payment
'VBDPA-ZTERM_TX1&
LINE/ &'
'VBDPA-ZTERM_TX2&
LINE/ &'
'VBDPA-ZTERM_TX3&
LINE/:ELSE
LINE/:INCLUDE &VBDPA-ZTERM& OBJECT TEXT ID SDTP PARAGRAPH ID
LINE/:ENDIF
LINE/:ENDPROTECT
LINE/EITEM_TERMS_OF_DELIVERY
LINEIDAlternative terms of delivery: &VBDPA-INCO1& &VBDPA-INCO2&
LINE/EITEM_REFERENCE_NO
LINE/:IF &VBDPA-VBTYP_VANG& = 'B'
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&
LINEIL,,Quotat. &VBDPA-VBELN_VANG&&'from 'VBDPA-AUDAT_VANG&
LINE/:ENDIF
LINE/:ENDIF
LINE/:IF &VBDKA-VBTYP_VANG& = 'F' OR &VBDKA-VBTYP_VANG& = 'G'
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&
LINEIL,,Contract &VBDPA-VBELN_VANG&&'from 'VBDPA-AUDAT_VANG&
LINE/:ENDIF
LINE/:ENDIF
LINE/EITEM_DELIVERY_DATE
LINEIDDelivery date: &VBDPA-DATBEZ(C)& &VBDPA-LFDAT&
LINE/EITEM_DELIVERY_CONFIRMATION
LINEIDUnconfirmed delivery date
LINE/EITEM_AGREED_DELIVERY_TIME
LINEIDAgreed delivery time: &VBDPA-DELCO_BEZ&
LINE/EITEM_BILLING_SCHEDULE_PERIODIC
LINEIDInvoicing &FPLTDR-PETXT&
LINE/ ,,from &FPLTDR-BETXT& &FPLTDR-BEDAT&
LINE/ ,,to
&FPLTDR-ENTXT& &FPLTDR-ENDAT&
LINE/EITEM_BILLING_SCHEDULE_PERCENT_
LINEIDPartial invoices &FPLTDR-FPROZ& % at &FPLTDR-TMTXT&
LINE/EITEM_BILLING_SCHEDULE_PERCENT
LINEID
&FPLTDR-FPROZ& % at &FPLTDR-TMTXT&
LINE/EITEM_BILLING_SCHEDULE_VALUE_HE
LINEIDPartial invoices &FPLTDR-FAKWR& &FPLTDR-WAERS& at &FPLTDR-TMTXT&
LINE/EITEM_BILLING_SCHEDULE_VALUE
LINEID
&FPLTDR-FAKWR& &FPLTDR-WAERS& at &FPLTDR-TMTXT&
LINE/EALTERNATIVE_ITEM
LINEIDAlternative item for item &VBDPA-GRPOS&
LINE/EONE_SUBITEM
LINE/:IF &VBDPAU-UEPVW& = 'B' OR &VBDPAU-UEPVW& = 'C'
LINEIDWith this item, we deliver sub-item &VBDPAU-UPOSV& free-of-charge.
LINE/:ELSE
LINEIDSub-item &VBDPAU-UPOSV& belongs to this item.
LINE/:ENDIF
LINE/ESEVERAL_SUBITEMS
LINEIDSub-items &VBDPAU-UPOSV& to &VBDPAU-UPOSB& belong to item
LINE/EITEM_LINE_CONFIGURATION_HEADER
LINEIC,,With the following configuration:
LINE/ ,,&CONF_OUT-ATBEZ&,,&CONF_OUT-ATWTB&
Technical Note
59
Sample Programs
Sample layout set YRVORDER01 (Example 1)
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
60
LINE/EITEM_LINE_CONFIGURATION
LINEIC,,&CONF_OUT-ATBEZ&,,&CONF_OUT-ATWTB&
LINE/EITEM_REJECTED
LINEID*** The item has been rejected ***
LINE/EITEM_CONSIGNEE
LINEIDShip-to party
LINE/:ADDRESS PARAGRAPH ID LINES 4 DELIVERY
LINE/: ADDRESSNUMBER &VBDPA-ADRNR_WE(K)&
LINE/:ENDADDRESS
LINE/
LINE/EITEM_SCHEDULE_HEADER
LINEISSplit the overall quantity over the following delivery dates:
LINE/ ,,Qty,,Unit,,Delivery date
LINE/EITEM_SCHEDULE_PRINT
LINEIS,,&VBDPA-BMENG(I15)&,,&VBDPA-VRKME&,,&'&VBDPA-DATBEZ&
'VBDPA-LFDAT&
LINE/EITEM_SUM
LINEUL&ULINE(71)&
LINESUItems total,,,,,,,,,,,,,,,,&KOMK-SUPOS(I13)&
LINE/ESUM_LINE
LINESU&KOMVD-VTEXT(15)&,,,,,,&KOMVD-KBETR(I12)&,,&KOMVD-KOEIN& ,,
LINE= &KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KAWRT(I12)& ,,
LINE &KOMVD-KWERT(I13)&
LINE/ETAX_LINE
LINESU&KOMVD-VTEXT(15)&,,,,,,&KOMVD-KBETR(12)&,,&KOMVD-KOEIN& ,,
LINE= &KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KAWRT(I12)&
,,&KOMVD-KWERT(13)&
LINE/EEND_VALUES
LINESUFinal amount,,,,,,,,,,,,,,,,&KOMK-FKWRT(I13)&
LINE/
LINE/ESUPPLEMENT_TEXT
LINE/:INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0010 PARAGRAPH HT
LINE/EITEM_TERMS_OF_NOTTXT
LINE/
LINEIN,,,,Deviating terms of cancellation:
LINE/
LINE/EITEM_TERMS_OF_NOTICE
LINEIN,,,,,,- &vedpn-bezei_d1(60)&
LINE/:IF &VEDPN-BEZEI_D2& NE &SPACE&
LINEIN,,,,,, &vedpn-bezei_d2(60)&
LINE/:ENDIF
LINE/EHEADER_TERMS_OF_NOTTXT
LINEINThe following terms of cancellation apply to the contract:
LINE/
LINE/EHEADER_TERMS_OF_NOTICE
LINEIN,,- &vedkn-bezei_d1(60)&
LINE/:IF &VEDKN-BEZEI_D2& NE &SPACE&
LINEIN,, &vedkn-bezei_d2(60)&
LINEIN
LINE/:ENDIF
LINE/EHEADER_TERMS_OF_TXTEND
LINEINIf different terms apply to individual items, they will be listed
LINE separately in the iten.
LINE/
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
LINE/EEMPTY_LINE
LINE/
LINE/EITEM_LINE_SERIAL_HEADER
LINEIM,,Serial no.:,,&komser-snrln(50)&
LINE/EITEM_LINE_SERIAL
LINEIM,,,,&komser-snrln(50)&
LINE/EITEM_TERMS_OF_SERV1
LINEIM,,Validity period &vedpa-vbegdat& bis &vedpa-venddat&.
LINE/EITEM_TERMS_OF_SERV2
LINEIM,,Validity period on &vedpa-vbegdat&.
LINE/EITEM_TERMS_OF_SERV3
LINEINValidity start date: &vedpa-bezei_beg&.
LINE/EHEADER_TERMS_OF_SERV1
LINEINValidity start date &vedka-vbegdat& to &vedka-venddat&.
LINE/EHEADER_TERMS_OF_SERV2
LINEINValidity start date on &vedka-vbegdat&.
LINE/EHEADER_TERMS_OF_SERV3
LINEINValidity start date: &vedka-bezei_beg&.
LINE/ECORRECTION_TEXT_K
LINEAS<k>Credit memo request :
LINE/ECORRECTION_TEXT_L
LINEAS<k>Debit memo request :
LINE/EITEM_REFERENCE_BILLING
LINEIP,,Ref:
Invoice
&vbdpa-vgbel& / &vbdpa-vgpos&
LINE/EITEM_LINE_REBATE_IN_KIND
LINEIR,,,,&KOMVD-NRMNG(I12)&,,&KOMVD-KMEIN&,,&KOMVD-VTEXT(17)& ,,,,
LINE= &KOMVD-KWERT(I14)&
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
LINE*
Technical Note
61
Sample Programs
Sample layout set YRVORDER01 (Example 1)
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
62
LINE*
LINE*
LINE*
LINE*
LINE/WINFO1
LINE/:IF &VBDKA-LAND1_WE& NE &SPACE&.
LINE/ <s>Ship-to address</>
LINE/:ENDIF.
LINE/:ADDRESS DELIVERY PARAGRAPH AS
LINE/: ADDRESSNUMBER &VBDKA-ADRDR_WE(K)&
LINE/: FROMCOUNTRY &VBDKA-SLAND&
LINE/:ENDADDRESS
LINE*
LINE*
LINE*
LINE*
LINE*
LINE/WADDRESS
LINE/:IF &PAGE& EQ '1 '.
LINE/:INCLUDE &TVKO-TXNAM_ADR& OBJECT TEXT ID ADRS
LINE/:ENDIF.
LINE/:ADDRESS PARAGRAPH AS
LINE/: TITLE
&VBDKA-ANRED&
LINE/: NAME
&VBDKA-NAME1&, &VBDKA-NAME2&, &VBDKA-NAME3&,
&VBDKA-NAME4&
LINE/: STREET
&VBDKA-STRAS&
LINE/: POBOX
&VBDKA-PFACH& CODE &VBDKA-PSTL2& CITY &VBDKA-PFORT&
LINE/: CITY
&VBDKA-ORT01&, &VBDKA-ORT02&
LINE/: POSTCODE &VBDKA-PSTLZ&
LINE/: COUNTRY &VBDKA-LAND1&
LINE/: REGION
&VBDKA-REGIO&
LINE/: FROMCOUNTRY &VBDKA-SLAND&
LINE/:ENDADDRESS
END
HEADFORM
YRVORDER01
SAP
TXT ETEST
YRVORDER01
00046DEVELOP
46C 20030624165312DEVELOPER
620 2003070107335313200383
E0
800
LINE/:FORM TEXT 'TEST';
LINE/:PARAGRAPH AS TEXT 'Standard paragraph';
LINE/:PARAGRAPH CN TEXT 'Requirements';
LINE/:PARAGRAPH FT TEXT 'Footer';
LINE/:PARAGRAPH HT TEXT 'Header text';
LINE/:PARAGRAPH ID TEXT 'Alternative item data';
LINE/:PARAGRAPH IL TEXT 'Line item';
LINE/:PARAGRAPH IM TEXT 'Serial numbers';
LINE/:PARAGRAPH IN TEXT 'Cancellation dates';
LINE/:PARAGRAPH IP TEXT ' Line item prices';
LINE/:PARAGRAPH IS TEXT 'Schedule line';
LINE/:PARAGRAPH IT TEXT 'Item text';
LINE/:PARAGRAPH SU TEXT 'Totals line';
LINE/:PARAGRAPH TI TEXT 'Description of layout set';
LINE/:PARAGRAPH UL TEXT 'Separator';
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
LINE/:STRING B TEXT 'Bold';
LINE/:STRING I TEXT 'Italics';
LINE/:STRING K TEXT 'Key word';
LINE/:STRING PR TEXT 'Character string protected';
LINE/:STRING S TEXT 'Short key word';
LINE/:STRING U TEXT 'Character string underlined';
LINE/:WINDOW ADDRESS TEXT 'Addressee';
LINE/:WINDOW FOOTER TEXT 'Footer';
LINE/:WINDOW GRAPH1 TEXT 'HP';
LINE/:WINDOW GRAPH2 TEXT 'DIGITAL';
LINE/:WINDOW HEADER TEXT 'Header';
LINE/:WINDOW INFO TEXT 'Information (General data)';
LINE/:WINDOW INFO1 TEXT 'Additional data window';
LINE/:WINDOW INFO2 TEXT 'Info window - Next page';
LINE/:WINDOW MAIN TEXT 'Main window';
LINE/:WINDOW PAGE TEXT 'Page numbering';
LINE/:WINDOW REPEAT TEXT 'Repeat printout';
LINE/:PAGE FIRST TEXT 'FIrst Page';
LINE/:PAGE NEXT TEXT 'Next page';
LINE/WHEADER
LINE/:INCLUDE &TVKO-TXNAM_KOP& OBJECT TEXT ID ADRS LANGUAGE
&VBDKA-SPRAS_VKO&
LINE/WINFO
LINE/:POSITION WINDOW
LINE/:POSITION XORIGIN '-0.5' CH YORIGIN '-0.25' LN
LINE/:SIZE WIDTH +0.4 CH HEIGHT +1 LN
LINE/:BOX FRAME 10 TW
LINE/:BOX HEIGHT '1.7' LN INTENSITY 20
LINE/:CASE &VBDKA-VBTYP&.
LINE/:WHEN 'A'.
LINETIInquiry
LINE/:WHEN 'B'.
LINETIQuotation
LINE/:WHEN 'C'.
LINETIOrder confirmation
LINE/:WHEN 'E'.
LINETIScheduling agreement confirmation
LINE/:WHEN 'G'.
LINETIContract confirmation
LINE/:WHEN 'H'.
LINETIReturns
LINE/:WHEN 'I'.
LINETIFree-of-charge delivery
LINE/:WHEN 'K'.
LINETICredit memo request
LINE/:WHEN 'L'.
LINETIDebit memo request
LINE/:WHEN OTHERS.
LINETIOrder confirmation
LINE/:ENDCASE.
LINE/
LINEASNumber/Date
LINE/ &VBDKA-VBELN&&' / 'VBDKA-AUDAT&
LINE/ Reference no./Date
Technical Note
63
Sample Programs
Sample layout set YRVORDER01 (Example 1)
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
64
LINE/ &VBDKA-BSTKD&&' /'VBDKA-BSTDK&
LINE/:IF &VBDKA-VBTYP_VANG& = 'B'.
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&.
LINE/ Quotation no./Date
LINE/ &VBDKA-VBELN_VANG&&' / 'VBDKA-AUDAT_VANG&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBDKA-VBTYP_VANG& = 'F' OR &VBDKA-VBTYP_VANG& = 'G'.
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&.
LINE/ Contract no./Date
LINE/ &VBDKA-VBELN_VANG&&' / 'VBDKA-AUDAT_VANG&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBDKA-VBTYP& = 'B' OR &VBDKA-VBTYP& = 'G'.
LINE/:IF &VBDKA-DELCO& NE &SPACE& AND &VBDKA-DELCO_BEZ& NE &SPACE&.
LINE/ Agreed delivery date
LINE/ &VBDKA-DELCO_BEZ&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBDKA-DATBEZ& NE &SPACE& OR &VBDKA-LFDAT& NE &SPACE&.
LINE/ Delivery date
LINE/:IF &VBDKA-DATBEZ& NE &SPACE&.
LINE/ &'&VBDKA-DATBEZ& 'VBDKA-LFDAT&
LINE/:ELSE.
LINE/ &VBDKA-LFDAT&
LINE/:ENDIF.
LINE/:ENDIF.
LINE/:IF &VBCO3-KUNDE& NE &SPACE&.
LINE/ Cust. no.
LINE/ &VBCO3-KUNDE&
LINE/:ENDIF.
LINE/:IF &VBDKA-ANGDT& NE &SPACE&.
LINE/ Validity period
LINE/ &VBDKA-ANGDT& &'bis 'VBDKA-BNDDT&
LINE/:ENDIF.
LINE/:IF &VBDKA-GUEBG& NE &SPACE&.
LINE/ Validity period
LINE/ &VBDKA-GUEBG& &'bis 'VBDKA-GUEEN&
LINE/:ENDIF.
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINEAS
LINE/WREPEAT
LINE/EREPEAT
LINE/ Repeat printout
LINE/WINFO2
LINEAS<s>Doc. no./Date</>
LINE/ &VBDKA-VBELN&&' / 'VBDKA-AUDAT&
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
LINE/WPAGE
LINEAS<s>Page</>
LINE/ &PAGE&
LINE/*You can also print out the page number as "x of y":
LINE/*&PAGE& / &SAPSCRIPT-FORMPAGES&
LINE*
LINE*
LINE*
LINE*
LINE*
LINE/WINFO1
LINE/:IF &VBDKA-LAND1_WE& NE &SPACE&.
LINE/ <s>Ship-to address</>
LINE/:ENDIF.
LINE/:ADDRESS DELIVERY PARAGRAPH AS
LINE/: ADDRESSNUMBER &VBDKA-ADRDR_WE(K)&
LINE/: FROMCOUNTRY &VBDKA-SLAND&
LINE/:ENDADDRESS
LINE*
LINE*
LINE*
LINE*
LINE*
LINE/WADDRESS
LINE/:IF &PAGE& EQ '1 '.
LINE/:INCLUDE &TVKO-TXNAM_ADR& OBJECT TEXT ID ADRS
LINE/:ENDIF.
LINE/:ADDRESS PARAGRAPH AS
LINE/: TITLE
&VBDKA-ANRED&
LINE/: NAME
&VBDKA-NAME1&, &VBDKA-NAME2&, &VBDKA-NAME3&,
&VBDKA-NAME4&
LINE/: STREET
&VBDKA-STRAS&
LINE/: POBOX
&VBDKA-PFACH& CODE &VBDKA-PSTL2& CITY &VBDKA-PFORT&
LINE/: CITY
&VBDKA-ORT01&, &VBDKA-ORT02&
LINE/: POSTCODE &VBDKA-PSTLZ&
LINE/: COUNTRY &VBDKA-LAND1&
LINE/: REGION
&VBDKA-REGIO&
LINE/: FROMCOUNTRY &VBDKA-SLAND&
LINE/:ENDADDRESS
LINE/:
LINE/WMAIN
LINE/*POSITION XORIGIN '-0.1' CH YORIGIN '-35' LN
LINE/*SIZE WIDTH 71 CH HEIGHT +39 LN
LINE/*BOX FRAME 20 TW
LINE/*BOX WIDTH '+5' CH HEIGHT '72' LN INTENSITY 10
LINE/ESPACE_LINE
LINE/
LINE/EUNDER_LINE
LINEUL&ULINE(71)&
LINE/EHEADER_DATA
LINECN<k>We deliver according to the following conditions:</>
LINE= ,,&'<k>Currency</> 'VBDKA-WAERK&
LINE/:IF &VBDKA-ZTERM_TX1& NE &SPACE& OR &VBDKA-ZTERM_TX2& NE &SPACE& OR
&VBDK
Technical Note
65
Sample Programs
Sample layout set YRVORDER01 (Example 1)
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
66
LINEAS&'Terms of payment 'VBDKA-ZTERM_TX1&
LINE/ &'
'VBDKA-ZTERM_TX2&
LINE/ &'
'VBDKA-ZTERM_TX3&
LINE/:ELSE
LINE/:INCLUDE &VBDKA-ZTERM& OBJECT TEXT ID SDTP PARAGRAPH L
LINE/:ENDIF
LINEAS&'Terms of delivery
'VBDKA-INCO1& &VBDKA-INCO2&,,
LINE/
LINEAS<k>Weights (gross/net) - Volume - Mark</>
LINE/=<PR>&'Gross weight 'VBDKA-BRGEW(13)' &VBDKA-GEWEI& '&</>
LINE= <PR>&'Net weight
'VBDKA-NTGEW(13)' &VBDKA-GEWEI& '&</>
LINE= <PR>&'Volume
'VBDKA-VOLUM(13)' &VBDKA-VOLEH& '&</>
LINE/
LINE/EHEADER_TEXT
LINE/:INCLUDE 'SD_RVADOR01' OBJECT TEXT ID SDVD PARAGRAPH HT
LINE/:INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0001 PARAGRAPH HT
LINE/EITEM_HEADER
LINEUL&ULINE(71)&
LINEIL<k>Item,,Material,,Description</>
LINEIP<k>,,,,Qty,,,,Price,,Price unit,,,,,,Value</>
LINEUL&ULINE(71)&
LINE/
LINE/EITEM_LINE
LINEIL&VBDPA-POSNR&,,&VBDPA-MATNR&,,&VBDPA-ARKTX&
LINE/*,,&'Customer mat. no. 'VBDPA-IDNKD&&'Item 'VBDPA-POSEX&
LINE/*,,&'Purch.ord.no. /Item 'VBDPA-BSTKD&&' /'VBDPA-POSEX&
LINE/*,,&'Purch.ord.no. GR/Item 'VBDPA-BSTKD_E&&' /'VBDPA-POSEX_E&
LINE/*,,&'Batch 'VBDPA-CHARG&
LINE/EITEM_LINE_PRICE_QUANTITY
LINEIP,,,,&VBDPA-KWMENG(I12)&,,&VBDPA-VRKME&,,&KOMVD-KBETR(I12)& ,,
LINE=
&KOMVD-KOEIN&,,&KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KWERT(I14)&
LINE/EITEM_LINE_PRICE_TEXT
LINEIP,,&KOMVD-VTEXT(17)&,,,,,,&KOMVD-KBETR(I12)&,,&KOMVD-KOEIN& ,,
LINE= &KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KWERT(I14)&
LINE/EITEM_TEXT
LINE/:INCLUDE &VBDPA-TDNAME& OBJECT VBBP ID 0001 PARAGRAPH IT
LINE/EITEM_TERMS_OF_PAYMENT
LINE/:PROTECT
LINE/:IF &VBDPA-ZTERM_TX1& NE &SPACE& OR &VBDPA-ZTERM_TX2& NE &SPACE& OR
&VBDP
LINEID&'Terms of payment
'VBDPA-ZTERM_TX1&
LINE/ &'
'VBDPA-ZTERM_TX2&
LINE/ &'
'VBDPA-ZTERM_TX3&
LINE/:ELSE
LINE/:INCLUDE &VBDPA-ZTERM& OBJECT TEXT ID SDTP PARAGRAPH ID
LINE/:ENDIF
LINE/:ENDPROTECT
LINE/EITEM_TERMS_OF_DELIVERY
LINEIDAlternative terms of delivery: &VBDPA-INCO1& &VBDPA-INCO2&
LINE/EITEM_REFERENCE_NO
LINE/:IF &VBDPA-VBTYP_VANG& = 'B'
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&
LINEIL,,Quotat. &VBDPA-VBELN_VANG&&'from 'VBDPA-AUDAT_VANG&
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
LINE/:ENDIF
LINE/:ENDIF
LINE/:IF &VBDKA-VBTYP_VANG& = 'F' OR &VBDKA-VBTYP_VANG& = 'G'
LINE/:IF &VBDKA-VBELN_VANG& NE &SPACE&
LINEIL,,Contract &VBDPA-VBELN_VANG&&'from 'VBDPA-AUDAT_VANG&
LINE/:ENDIF
LINE/:ENDIF
LINE/EITEM_DELIVERY_DATE
LINEIDDelivery date: &VBDPA-DATBEZ(C)& &VBDPA-LFDAT&
LINE/EITEM_DELIVERY_CONFIRMATION
LINEIDUnconfirmed delivery date
LINE/EITEM_AGREED_DELIVERY_TIME
LINEIDAgreed delivery time: &VBDPA-DELCO_BEZ&
LINE/EITEM_BILLING_SCHEDULE_PERIODIC
LINEIDInvoicing &FPLTDR-PETXT&
LINE/ ,,from &FPLTDR-BETXT& &FPLTDR-BEDAT&
LINE/ ,,to
&FPLTDR-ENTXT& &FPLTDR-ENDAT&
LINE/EITEM_BILLING_SCHEDULE_PERCENT_
LINEIDPartial invoices &FPLTDR-FPROZ& % at &FPLTDR-TMTXT&
LINE/EITEM_BILLING_SCHEDULE_PERCENT
LINEID
&FPLTDR-FPROZ& % at &FPLTDR-TMTXT&
LINE/EITEM_BILLING_SCHEDULE_VALUE_HE
LINEIDPartial invoices &FPLTDR-FAKWR& &FPLTDR-WAERS& at &FPLTDR-TMTXT&
LINE/EITEM_BILLING_SCHEDULE_VALUE
LINEID
&FPLTDR-FAKWR& &FPLTDR-WAERS& at &FPLTDR-TMTXT&
LINE/EALTERNATIVE_ITEM
LINEIDAlternative item for item &VBDPA-GRPOS&
LINE/EONE_SUBITEM
LINE/:IF &VBDPAU-UEPVW& = 'B' OR &VBDPAU-UEPVW& = 'C'
LINEIDWith this item, we deliver sub-item &VBDPAU-UPOSV& free-of-charge.
LINE/:ELSE
LINEIDSub-item &VBDPAU-UPOSV& belongs to this item.
LINE/:ENDIF
LINE/ESEVERAL_SUBITEMS
LINEIDSub-items &VBDPAU-UPOSV& to &VBDPAU-UPOSB& belong to item
LINE/EITEM_LINE_CONFIGURATION_HEADER
LINEIC,,With the following configuration:
LINE/ ,,&CONF_OUT-ATBEZ&,,&CONF_OUT-ATWTB&
LINE/EITEM_LINE_CONFIGURATION
LINEIC,,&CONF_OUT-ATBEZ&,,&CONF_OUT-ATWTB&
LINE/EITEM_REJECTED
LINEID*** The item has been rejected ***
LINE/EITEM_CONSIGNEE
LINEIDShip-to party
LINE/:ADDRESS PARAGRAPH ID LINES 4 DELIVERY
LINE/: ADDRESSNUMBER &VBDPA-ADRNR_WE(K)&
LINE/:ENDADDRESS
LINE/
LINE/EITEM_SCHEDULE_HEADER
LINEISSplit the overall quantity over the following delivery dates:
LINE/ ,,Qty,,Unit,,Delivery date
LINE/EITEM_SCHEDULE_PRINT
LINEIS,,&VBDPA-BMENG(I15)&,,&VBDPA-VRKME&,,&'&VBDPA-DATBEZ&
'VBDPA-LFDAT&
Technical Note
67
Sample Programs
Sample layout set YRVORDER01 (Example 1)
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
68
LINE/EITEM_SUM
LINEUL&ULINE(71)&
LINESUItems total,,,,,,,,,,,,,,,,&KOMK-SUPOS(I13)&
LINE/ESUM_LINE
LINESU&KOMVD-VTEXT(15)&,,,,,,&KOMVD-KBETR(I12)&,,&KOMVD-KOEIN& ,,
LINE= &KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KAWRT(I12)&,,
LINE &KOMVD-KWERT(I13)&
LINE/ETAX_LINE
LINESU&KOMVD-VTEXT(15)&,,,,,,&KOMVD-KBETR(12)&,,&KOMVD-KOEIN& ,,
LINE= &KOMVD-KPEIN(I)&,,&KOMVD-KMEIN&,,&KOMVD-KAWRT(I12)&
,,&KOMVD-KWERT(13)&
LINE/EEND_VALUES
LINESUFinal amount,,,,,,,,,,,,,,,,&KOMK-FKWRT(I13)&
LINE/
LINE/ESUPPLEMENT_TEXT
LINE/:INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0010 PARAGRAPH HT
LINE/EITEM_TERMS_OF_NOTTXT
LINE/
LINEIN,,,,Deviating terms of cancellation:
LINE/
LINE/EITEM_TERMS_OF_NOTICE
LINEIN,,,,,,- &vedpn-bezei_d1(60)&
LINE/:IF &VEDPN-BEZEI_D2& NE &SPACE&
LINEIN,,,,,, &vedpn-bezei_d2(60)&
LINE/:ENDIF
LINE/EHEADER_TERMS_OF_NOTTXT
LINEINThe following terms of cancellation apply to the contract:
LINE/
LINE/EHEADER_TERMS_OF_NOTICE
LINEIN,,- &vedkn-bezei_d1(60)&
LINE/:IF &VEDKN-BEZEI_D2& NE &SPACE&
LINEIN,, &vedkn-bezei_d2(60)&
LINEIN
LINE/:ENDIF
LINE/EHEADER_TERMS_OF_TXTEND
LINEINIf different terms apply to individual items, they will be listed
LINE separately in the iten.
LINE/
LINE/EEMPTY_LINE
LINE/
LINE/EITEM_LINE_SERIAL_HEADER
LINEIM,,Serial no.:,,&komser-snrln(50)&
LINE/EITEM_LINE_SERIAL
LINEIM,,,,&komser-snrln(50)&
LINE/EITEM_TERMS_OF_SERV1
LINEIM,,Validity period &vedpa-vbegdat& bis &vedpa-venddat&.
LINE/EITEM_TERMS_OF_SERV2
LINEIM,,Validity period on &vedpa-vbegdat&.
LINE/EITEM_TERMS_OF_SERV3
LINEINValidity start date: &vedpa-bezei_beg&.
LINE/EHEADER_TERMS_OF_SERV1
LINEINValidity start date &vedka-vbegdat& to &vedka-venddat&.
LINE/EHEADER_TERMS_OF_SERV2
LINEINValidity start date on &vedka-vbegdat&.
Technical Note
Sample Programs
Sample layout set YRVORDER01 (Example 1)
797: LINE/EHEADER_TERMS_OF_SERV3
798: LINEINValidity start date: &vedka-bezei_beg&.
799: LINE/ECORRECTION_TEXT_K
800: LINEAS<k>Credit memo request :
801: LINE/ECORRECTION_TEXT_L
802: LINEAS<k>Debit memo request :
803: LINE/EITEM_REFERENCE_BILLING
Invoice
&vbdpa-vgbel& / &vbdpa-vgpos&
804: LINEIP,,Ref:
805: LINE/EITEM_LINE_REBATE_IN_KIND
806: LINEIR,,,,&KOMVD-NRMNG(I12)&,,&KOMVD-KMEIN&,,&KOMVD-VTEXT(17)& ,,,,
807: LINE= &KOMVD-KWERT(I14)&
808: LINE*
809: LINE*
810: LINE*
811: LINE*
812: LINE*
813: LINE*
814: LINE*
815: LINE*
816: LINE*
817: LINE*
818: LINE*
819: LINE*
820: LINE*
821: LINE*
822: LINE*
823: LINE*
824: LINE*
825: LINE*
826: LINE*
827: LINE*
828: LINE*
829: LINE*
830: LINE*
831: LINE*
832: LINE*
833: LINE*
834: LINE*
835: LINE*
836: LINE*
837: LINE*
838: LINE*
839: LINE/WFOOTER
840: LINEFTDigital GlobalSoft Limited,
841: LINEFTElectronic City,
842: LINEFTDigital Park, Bangalore, India
843: LINEFTPhone : 555 5555 / 5555 Extn : 5555
844: LINE/WGRAPH1
845: LINE/:BITMAP HP1 OBJECT GRAPHICS ID BMAP TYPE BCOL
846: LINE/WGRAPH2
847: LINE/:BITMAP DIGITAL OBJECT GRAPHICS ID BMAP TYPE BCOL
848: END
849: ACTVSAP
850: E
Technical Note
69
Sample Programs
Sample program YHP_POFORM (Example 3)
Sample program YHP_POFORM (Example 3)
REPORT YHP_POFORM no standard page heading line-size 70 message-id m1.
***********************************************************************
* This program will generate the SAPScript Document and will sent to *
* the SAPConnect through Business Communication Interface (BCI)
*
*
*
* Created By : RBABU
*
* Dated
: 03.07.2003
*
***********************************************************************
TABLES: SOUD,
ekko,
ekpo,
makt,
lfa1,
adr6.
* Makros für Zugriff aufs BOR
INCLUDE <CNTN01>.
* Datendeklaration
* * (BOR)
DATA: SENDER_ID
LIKE SWOTOBJID,
APPL_OBJECT_ID LIKE SWOTOBJID,
RECIPIENT_ID
LIKE SWOTOBJID,
RECIPIENT
TYPE SWC_OBJECT,
SENDER
TYPE SWC_OBJECT,
RECIPIENT_TAB TYPE SWC_OBJECT OCCURS 0 WITH HEADER LINE,
FOLDER
TYPE SWC_OBJECT,
BEGIN OF SOFMFOL_KEY,
FOLDERTYPE
LIKE SOFM-FOLTP,
FOLDERYEAR
LIKE SOFM-FOLYR,
FOLDERNUMBER LIKE SOFM-FOLNO,
TYPE
LIKE SOFM-DOCTP,
YEAR
LIKE SOFM-DOCYR,
NUMBER
LIKE SOFM-DOCNO,
FORWARDER
LIKE SOUB-USRNAM,
END OF SOFMFOL_KEY,
BOR_KEY
LIKE SWOTOBJID-OBJKEY,
ADDRESS_STRING LIKE SOXNA-FULLNAME.
* * (SAPscript)
DATA: HEADER LIKE THEAD,
RESULT LIKE ITCPP,
LINES LIKE TLINE OCCURS 0 WITH HEADER LINE,
OTFDATA LIKE ITCOO OCCURS 0,
OPTIONS LIKE ITCPO.
* Deklaration eines Containers
SWC_CONTAINER CONTAINER.
70
Technical Note
Sample Programs
Sample program YHP_POFORM (Example 3)
DATA: BEGIN OF potab OCCURS 0,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
netpr TYPE ekpo-netpr,
netwr TYPE ekpo-netwr,
maktx TYPE makt-maktx,
END OF potab.
data: begin of wa,
ebeln type ekKo-ebeln,
lifnr type ekKo-lifnr,
aedat type ekko-aedat,
end of wa.
Data: LAND
LIKE SOXFX-REC_STATE,
NUMBER LIKE SOXFX-REC_FAX.
* Selection-parameters
selection-screen begin of block b1 with frame.
parameter:
PONumber type ekko-ebeln.
selection-screen end of block b1.
selection-screen begin of block b3 with frame.
PARAMETERS: FAX radiobutton group rad.
PARAMETERS: INTERNET radiobutton group rad.
selection-screen end of block b3.
* Data selection for the purchase order
Start-of-selection.
select single ebeln lifnr aedat from ekko
into wa where ebeln = PONumber.
select
ekpo~ebelp ekpo~matnr ekpo~menge ekpo~netpr
ekpo~netwr from ekpo into table potab
where ekpo~ebelN = PONumber .
select single * from lfa1 where lifnr = wa-lifnr.
select single * from adr6 where ADDRNUMBER = lfa1-adrnr.
If internet = 'X' and sy-subrc ne 0 and adr6-smtp_addr is initial.
message e300 with
'E-mail address is not maintained in Vendor master!'.
endif.
if fax = 'X' and lfa1-TELFX is initial.
message e300 with
'Fax Number is not maintained in Vendor Master !'.
Technical Note
71
Sample Programs
Sample program YHP_POFORM (Example 3)
endif.
Land = lfa1-land1.
number = lfa1-telfx.
************************************************************************
*
Sender (BOR-Objekt-ID)
*
************************************************************************
* Creation of Receipent
SWC_CREATE_OBJECT SENDER 'RECIPIENT' SPACE.
* clear Container
SWC_CLEAR_CONTAINER CONTAINER.
* Address String
SWC_SET_ELEMENT CONTAINER 'AddressString' SY-UNAME.
* Adreßtyp (interner Benutzer)
SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.
SWC_CALL_METHOD SENDER 'FindAddress' CONTAINER.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
SWC_OBJECT_TO_PERSISTENT SENDER SENDER_ID.
************************************************************************
*
FAX
*
************************************************************************
IF FAX = 'X'.
* Receipent
SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.
* Container leeren
SWC_CLEAR_CONTAINER CONTAINER.
* Type Fax
SWC_SET_ELEMENT CONTAINER 'TypeId' 'F'.
* importing: FAX-Nummer
MOVE: LAND
TO ADDRESS_STRING,
NUMBER TO ADDRESS_STRING+3.
SWC_SET_ELEMENT CONTAINER 'AddressString' ADDRESS_STRING.
* Using recipient.CreateAddress
SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
Endif.
************************************************************************
*
Internet
*
************************************************************************
IF INTERNET = 'X'.
* Receipent
SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.
72
Technical Note
Sample Programs
Sample program YHP_POFORM (Example 3)
* Container leeren
SWC_CLEAR_CONTAINER CONTAINER.
* Type Fax
SWC_SET_ELEMENT CONTAINER 'TypeId' 'U'.
* importing: Internet-Nummer
MOVE: adr6-smtp_addr TO ADDRESS_STRING.
SWC_SET_ELEMENT CONTAINER 'AddressString' ADDRESS_STRING.
* Using recipient.CreateAddress
SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
Endif.
SWC_OBJECT_TO_PERSISTENT RECIPIENT RECIPIENT_ID.
************************************************************************
*
BOR Interface
*
************************************************************************
* get the id for the user.
SELECT * FROM SOUD WHERE SAPNAM LIKE SY-UNAME AND DELETED = ' '.
ENDSELECT.
IF SY-SUBRC NE 0.
* Aufrufer besitzt kein Office => wird angelegt
CALL FUNCTION 'SO_USER_AUTOMATIC_INSERT'
EXPORTING
SAPNAME
= SY-UNAME
EXCEPTIONS
NO_INSERT
= 1
SAP_NAME_EXIST = 2
X_ERROR
= 3
OTHERS
= 4.
IF SY-SUBRC NE 0.
*
Office konnte nicht angelegt werden: Inbox-ID = SPACE
CLEAR SOUD.
ELSE.
* * Neuer Versuch: Lesen der Eingangs-ID des Aufrufers
SELECT * FROM SOUD WHERE SAPNAM LIKE SY-UNAME AND DELETED = ' '.
ENDSELECT.
ENDIF.
ENDIF.
* Folder Creation
CLEAR SOFMFOL_KEY.
SOFMFOL_KEY-TYPE
= 'FOL'.
SOFMFOL_KEY-YEAR
= SOUD-INBYR.
SOFMFOL_KEY-NUMBER = SOUD-INBNO.
BOR_KEY = SOFMFOL_KEY.
IF NOT BOR_KEY IS INITIAL.
SWC_CREATE_OBJECT FOLDER 'SOFMFOL' BOR_KEY.
IF SY-SUBRC = 0.
* * Ermittlung der BOR-Objekt-ID
SWC_OBJECT_TO_PERSISTENT FOLDER APPL_OBJECT_ID.
Technical Note
73
Sample Programs
Sample program YHP_POFORM (Example 3)
IF SY-SUBRC NE 0.
CLEAR APPL_OBJECT_ID.
ENDIF.
ENDIF.
ELSE.
CLEAR APPL_OBJECT_ID.
ENDIF.
************************************************************************
*
Declaring the SAPSCript
*
************************************************************************
* Füllen des Text-Headers für SAPscript
CLEAR HEADER.
HEADER-TDOBJECT = 'FORM'.
If FAX = 'X'.
HEADER-TDNAME
= 'TestFax'.
endif.
IF INTERNET = 'X'.
HEADER-TDNAME
= 'TestMail'.
endif.
HEADER-TDID
= 'DEF'.
HEADER-TDSPRAS = SY-LANGU.
HEADER-TDFORM
= 'ZHP_POFORM'.
CLEAR OPTIONS.
CONCATENATE 'Sending through SAPscript' SY-DATUM SY-UZEIT
INTO OPTIONS-TDTITLE SEPARATED BY SPACE.
************************************************************************
*
Recipients for SAPscript
*
************************************************************************
SWC_CLEAR_CONTAINER CONTAINER.
REFRESH RECIPIENT_TAB.
SWC_CALL_METHOD RECIPIENT 'Expand' CONTAINER.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
SWC_GET_TABLE CONTAINER 'ResultTable' RECIPIENT_TAB.
IF SY-SUBRC NE 0.
REFRESH RECIPIENT_TAB.
ENDIF.
* For each recipient it will send a mail.
LOOP AT RECIPIENT_TAB.
SWC_OBJECT_TO_PERSISTENT RECIPIENT_TAB RECIPIENT_ID.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE
DIALOG
74
= 'MAIL'
= SPACE
Technical Note
Sample Programs
Sample program YHP_POFORM (Example 3)
FORM
= HEADER-TDFORM
LANGUAGE
= HEADER-TDSPRAS
OPTIONS
= OPTIONS
MAIL_SENDER
= SENDER_ID
MAIL_RECIPIENT
= RECIPIENT_ID
MAIL_APPL_OBJECT = APPL_OBJECT_ID
EXCEPTIONS
CANCELED
= 1
DEVICE
= 2
FORM
= 3
OPTIONS
= 4
UNCLOSED
= 5
MAIL_OPTIONS
= 6
OTHERS
= 7.
IF SY-SUBRC NE 0.
MESSAGE A634(SO) WITH 'OPEN_FORM' SY-SUBRC.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT
= 'BORDERS'
WINDOW
= 'MAIN'
EXCEPTIONS
ELEMENT
= 1
FUNCTION
= 2
TYPE
= 3
UNOPENED
= 4
UNSTARTED
= 5
WINDOW
= 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR
= 8
OTHERS
= 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT
= 'HEAD'
WINDOW
= 'MAIN'
EXCEPTIONS
ELEMENT
= 1
FUNCTION
= 2
TYPE
= 3
UNOPENED
= 4
UNSTARTED
= 5
WINDOW
= 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR
= 8
OTHERS
= 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Technical Note
75
Sample Programs
Sample program YHP_POFORM (Example 3)
LOOP AT potab.
select single * from makt where matnr = potab-matnr.
potab-maktx = makt-maktx.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT
= 'ITEM'
WINDOW
= 'MAIN'
EXCEPTIONS
ELEMENT
= 1
FUNCTION
= 2
TYPE
= 3
UNOPENED
= 4
UNSTARTED
= 5
WINDOW
= 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR
= 8
OTHERS
= 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endloop.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = RESULT
TABLES
OTFDATA = OTFDATA
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
MESSAGE A634(SO) WITH 'CLOSE_FORM' SY-SUBRC.
ENDIF.
* Commit work
COMMIT WORK.
WRITE:
WRITE:
write:
WRITE:
write:
WRITE:
/'Document successfully into the transmission queues posed.'.
/ 'If for kind of communication FAX or INTERNET a'.
' transmission process is not '.
/ 'regularly taken into account,'.
'please transmission process in'.
/ 'SAPconnect (TA SCOT) by hand start'.
ENDLOOP.
76
Technical Note
Sample Programs
Sample layout set ZHP_POFORM (Example 3)
Sample layout set ZHP_POFORM (Example 3)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
SFORMZHP_POFORM
HFORMZHP_POFORM
OLANE
HEADFORM
ZHP_POFORM
SAP
DEF EFor Demo Purpose
ZHP_POFORM
00105DEVELOP
46C 20030627153956DEVELOPER
620 2003070703470713200026
E0
800
LINE/:FORM CPI 10; LPI 6; TAB-STOP 1 CM; START-PAGE PAGE1; PARAGRAPH P1;
RDI;
LINE/:FORM RDIDEV;
LINE/:PARAGRAPH H1 LINE-SPACE 1 LN; FONT COURCYR; FONT-SIZE 12;
LINE/:PARAGRAPH HT LINE-SPACE 1 LN; FONT COURIER; FONT-SIZE 10; BOLD
OFF;
LINE/:PARAGRAPH I1 LINE-SPACE 1 LN; FONT COURCYR; FONT-SIZE 10;
LINE/:PARAGRAPH P1 LINE-SPACE 1 LN; FONT COURCYR; FONT-SIZE 14;
LINE/:PARAGRAPH P2 ALIGN CENTER; LINE-SPACE 1 LN; FONT HELVE; FONT-SIZE
8;
LINE/:PARAGRAPH P2 BOLD OFF;
LINE/:PARAGRAPH H1 TAB 1 9 CH LEFT; TAB 2 45 CH RIGHT; TAB 3 57 CH RIGHT;
LINE/:PARAGRAPH H1 TAB 4 73 CH RIGHT;
LINE/:PARAGRAPH I1 TAB 1 9 CH LEFT; TAB 2 45 CH RIGHT; TAB 3 57 CH RIGHT;
LINE/:PARAGRAPH I1 TAB 4 73 CH RIGHT;
LINE/:PARAGRAPH P1 TAB 1 8 CH LEFT; TAB 2 40 CH LEFT; TAB 3 50 CH LEFT;
LINE/:PARAGRAPH P1 TAB 4 58 CH LEFT;
LINE/:STRING C1 FONT COURIER; FONT-SIZE 14; BOLD ON;
LINE/:STRING C2 FONT COURIER; FONT-SIZE 16; BOLD ON; ITALIC ON;
LINE/:WINDOW BASE1 TYPE VAR;
LINE/:WINDOW GRAPH1 TYPE GRAPH;
LINE/:WINDOW GRAPH2 TYPE GRAPH;
LINE/:WINDOW MAIN
LINE/:WINDOW SEC1 TYPE VAR;
LINE/:PAGE PAGE1
LINE/:PAGE PAGE1 MAIN 0 1.97 CH 6 CM 74.80 CH 17 CM;
LINE/:PAGE PAGE1 WINDOW BASE1 1.97 CH 25.50 CM 19 CM 3 CM;
LINE/:PAGE PAGE1 WINDOW GRAPH1 0 MM 0 MM 19.05 MM 20.57 MM;
LINE/:PAGE PAGE1 WINDOW SEC1 11 CM 3.50 CM 8 CM 1.50 CM;
END
HEADFORM
ZHP_POFORM
SAP
TXT EFor Demo Purpose
ZHP_POFORM
00105DEVELOP
46C 20030627153956DEVELOPER
620 2003070703470713200043
E0
800
LINE/:FORM TEXT 'For Demo Purpose';
LINE/:PARAGRAPH H1 TEXT 'for default';
LINE/:PARAGRAPH HT TEXT 'Header';
LINE/:PARAGRAPH I1 TEXT 'for default';
LINE/:PARAGRAPH P1 TEXT 'for default';
LINE/:PARAGRAPH P2 TEXT 'FOR FOOTER';
LINE/:STRING C1 TEXT 'for standard';
LINE/:STRING C2 TEXT 'FOR FOOTER';
Technical Note
77
Sample Programs
Sample layout set ZHP_POFORM (Example 3)
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
78
LINE/:WINDOW BASE1 TEXT 'for Footer';
LINE/:WINDOW GRAPH1 TEXT 'New Graphic';
LINE/:WINDOW GRAPH2 TEXT 'DIGITAL LOGO';
LINE/:WINDOW MAIN TEXT 'Main window';
LINE/:WINDOW SEC1 TEXT 'For Header Info';
LINE/:PAGE PAGE1 TEXT 'Page for Display';
LINE/WGRAPH2
LINE/:BITMAP 'ZDIGITAL' OBJECT GRAPHICS ID BMAP TYPE BCOL DPI 150
LINE/WBASE1
LINEP2<C1> DIGITAL GLOBAL SOFT</>
LINEP2 39/40 ELECTRONICS CITY
LINEP2 HOSUR ROAD
LINEP2 BANGALORE-561229
LINE/WSEC1
LINEHTPURCHASE ORDER NO: &WA-EBELN&
LINEHTVENDOR A/C NO
: &WA-LIFNR&
LINEHTDATE PO CREATED : &WA-AEDAT&
LINE/WGRAPH1
LINE/:BITMAP 'IDES_LOGO' OBJECT GRAPHICS ID BMAP TYPE BCOL
LINE/WMAIN
LINE/EBORDERS
LINE/:BOX XPOS 0 CM YPOS -56 MM HEIGHT 65 LN WIDTH 75 CH FRAME 05 TW
LINE/*BOX XPOS 8 CH YPOS 0 CM WIDTH 0 CM HEIGHT 15 CM FRAME 05 TW
LINE/*BOX XPOS 40 CH YPOS 0 CM WIDTH 0 CM HEIGHT 15 CM FRAME 05 TW
LINE/*BOX XPOS 50 CH YPOS 0 CM WIDTH 0 CM HEIGHT 15 CM FRAME 05 TW
LINE/*BOX XPOS 58 CH YPOS 0 CM WIDTH 0 CM HEIGHT 15 CM FRAME 05 TW
LINE/:BOX XPOS 0 CM YPOS 0 CM WIDTH 75 CH HEIGHT 12 MM FRAME 05 TW
LINE/EHEAD
LINEH1 ITEM NO,,MATERIAL NO,,QUANTITY,,PRICE,,NET VALUE
LINE/ ,,MATERIAL DESCRIPTION
LINEH1
LINE/EITEM
LINEI1 &POTAB-EBELP&,,&POTAB-MATNR&,,&POTAB-MENGE&,,&POTAB-NETPR&,,
LINE= &POTAB-NETWR&
LINEI1,,&POTAB-MAKTX&
END
ACTVSAP
E
Technical Note
Sample Programs
Sample report program YSALES_SC (Example 4)
Sample report program YSALES_SC (Example 4)
report Ysales_sc no standard page heading
line-size 120
line-count 80(2)
message-id s1.
************************************************************************
* Title
: Sales order list to test Fax and Internet.
*
* Created by
: Ravindra Babu.I
*
* Changed on
: 07.07.2003
*
* Client
: HP
*
*
*
************************************************************************
* tables declaration
tables: vbap,
tsp01,
somlreci1.
* Data Declarations
data: i_vbap like vbap occurs 0 with header line.
data: w_spool like tsp01-rqident.
data: reclist
like somlreci1 occurs 0 with header line.
data: flag .
*Selection Screen parameters
selection-screen begin of block b1 with frame .
select-options: receiver for somlreci1-receiver.
parameters: mailtype like reclist-rec_type.
parameters: p1 as checkbox,
p2 as checkbox.
selection-screen end of block b1 .
at selection-screen.
if
( receiver is initial and p2 = 'X' ) or ( mailtype is initial
and p2 = 'X' ).
message e000 with 'Please fill the mail ID or Mail type'.
endif.
start-of-selection.
select * from vbap into table i_vbap up to 500 rows.
* It will print on screen and it will send fax or internet.
if p1 = 'X'.
perform print_screen.
Technical Note
79
Sample Programs
Sample report program YSALES_SC (Example 4)
endif.
* It will send only fax or internet without display
if p2 = 'X'.
perform print_spool.
endif.
end-of-page.
write:/2 sy-uline(120).
top-of-page.
write:/2 sy-uline(120).
write:/2 sy-vline, 5 'Digital Gloabl Soft Limited' color col_positive,
70 'Date:', sy-datum,'Time:',sy-uzeit, 120 sy-vline.
write:/2 sy-vline, 120 sy-vline .
write:/2 sy-vline, 5 'Title: Sales Order Item Details List',120
sy-vline.
write:/2 sy-vline, 120 sy-vline .
write:/2 sy-uline(120).
write:/2 sy-vline, 'Order No',13 sy-vline, 'Item No',22 sy-vline,
'Material', 44 sy-vline, 'Description',80 sy-vline,81 'Quantity' ,99
sy-vline, 120 sy-vline.
write:/2 sy-uline(120).
*&---------------------------------------------------------------------*
*&
Form print
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form print using value(p_spool).
* Structures for recipient addresses
data: begin of recipient_fax,
rec_fax
type so_recfax,
rec_title type so_rec_tit,
rec_name1 type so_fx_nam1,
rec_name2 type so_fx_nam2,
rec_dep
type so_fx_depm,
rec_po_box type so_fx_pbox,
rec_street type so_fx_str,
rec_town
type so_fx_town,
send_cover type so_fx_cov,
send_nam
type so_fx_snam,
send_dep
type so_fx_sdep,
send_tel
type so_fx_stel,
send_fax
type so_fx_sfax,
send_date type so_fx_sdat,
80
Technical Note
Sample Programs
Sample report program YSALES_SC (Example 4)
send_time type so_fx_stim,
send_night type so_fx_snit,
send_immi type so_fx_simm,
rec_state type so_fx_sate,
rec_pers
type so_fx_co,
rec_adrnr type adrnr,
send_sched type so_sched,
fax_form
type so_faxform,
form_langu type so_formlan,
send_titel type so_fx_stit,
send_comp type so_fx_scom,
send_comp2 type so_fx_sco2,
send_anred type so_fx_sanr,
send_stret type so_fx_sstr,
send_pstl type so_fx_spst,
send_ort
type so_fx_stwn,
send_c_tel type so_fx_sctl,
send_c_fax type so_fx_scfx,
rec_stades type so_fx_ldes,
end of recipient_fax.
data: recipient_int like sadrud.
data: recipient_rml like sadr7d.
* Structures and internal tables for the
data: objpack
like sopcklsti1 occurs
data: objhead
like solisti1
occurs
data: objbin
like solisti1
occurs
data: objtxt
like solisti1
occurs
send data
0 with header
1 with header
0 with header
0 with header
line.
line.
line.
line.
data: doc_chng like sodocchgi1.
data: tab_lines like sy-tabix.
* Data for the status output after sending
data: user_address like sousradri1 occurs 1 with header line.
data: sent_to_all like sonv-flag.
* For delete spool
data : spool_rec like tsp01sys.
data : spool_stat like sy-subrc.
* no of lines
data : noofln type i.
data: compressed_list like soli occurs 0.
***Move list to MAIL table objbin
refresh : compressed_list, objbin.
*** Read from Spool and Delete spool after read
refresh compressed_list.
call function 'RSPO_RETURN_SPOOLJOB'
exporting
rqident
= p_spool
tables
Technical Note
81
Sample Programs
Sample report program YSALES_SC (Example 4)
buffer
exceptions
no_such_job
job_contains_no_data
selection_empty
no_permission
can_not_access
read_error
type_no_match
others
= compressed_list
=
=
=
=
=
=
=
=
1
2
3
4
5
6
7
8.
check not compressed_list[] is initial.
move compressed_list[] to objbin[].
*** Delete Spool after read.
clear spool_rec.
move p_spool to spool_rec-rqident.
call function 'RSPO_IDELETE_SPOOLREQ'
exporting
spoolreq = spool_rec
importing
status
= spool_stat.
commit work and wait.
** Create the document which is to be sent
doc_chng-obj_name = 'REPORT'.
doc_chng-obj_descr = 'Sales Order Item Details'.
write : sy-datum to doc_chng-obj_descr+35.
describe table objtxt lines tab_lines.
read table objtxt index tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
* Fill the fields of the packing_list for the main document:
* It is a text document
clear objpack-transf_bin.
* The document needs no header (head_num = 0)
objpack-head_start = 1.
objpack-head_num
= 0.
* but it has a body
objpack-body_start = 1.
objpack-body_num
= tab_lines.
* of type RAW
objpack-doc_type = 'RAW'.
append objpack.
** Create the attachment (the list itself)
describe table objbin lines tab_lines.
** Fill the fields of the packing_list for the attachment:
** It is binary document
objpack-transf_bin = 'X'.
82
Technical Note
Sample Programs
Sample report program YSALES_SC (Example 4)
** we need no header
objpack-head_start = 1.
objpack-head_num
= 0.
** but a body
objpack-body_start = 1.
objpack-body_num
= tab_lines.
** of type ALI
objpack-doc_type = 'ALI'.
objpack-obj_name = 'Attachment'.
objpack-obj_descr = 'Sales Order Item Details '.
write : sy-datum to objpack-obj_descr+33.
objpack-doc_size = tab_lines * 255.
append objpack.
refresh : reclist.
if p2 = 'X' and mailtype = 'U'.
loop at receiver.
recipient_int = receiver-low.
reclist-receiver = recipient_int. "'i.ravindrababu@digital.com'.
reclist-rec_type = mailtype . "U
append reclist.
endloop.
elseif p2 = 'X' and mailtype = 'F'.
loop at receiver.
recipient_fax-rec_fax = receiver-low.
recipient_fax-rec_state = 'US'.
recipient_fax-rec_title = 'Ms.'.
recipient_fax-rec_name1 = 'Ann Recipient'.
recipient_fax-send_nam = 'Tom Sender'.
recipient_fax-send_comp = 'SAP AG'.
* Additional text should appear on the cover and not on a 2nd page
recipient_fax-send_cover = 'X'.
reclist-receiver = recipient_fax.
*
recipient_fax = receiver-low.
*
reclist-receiver = recipient_fax. "'i.ravindrababu@digital.com'.
reclist-rec_type = mailtype . "U
append reclist.
endloop.
.
else.
message e000 with 'Invalid Mail Type, only Fax or Internet'.
endif.
check not reclist[] is initial.
**********************************************************************
** Send the document by calling the SAPoffice API1 module
** for sending documents with attachments
**********************************************************************
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data
= doc_chng
Technical Note
83
Sample Programs
Sample report program YSALES_SC (Example 4)
put_in_outbox
= 'X'
commit_work
= 'X'
tables
packing_list
= objpack
object_header
= objhead
contents_bin
= objbin
contents_txt
= objtxt
receivers
= reclist
exceptions
too_many_receivers
= 1
document_not_sent
= 2
operation_no_authorization = 4
others
= 99.
endform.
" print
*&---------------------------------------------------------------------*
*&
Form print_screen
*&---------------------------------------------------------------------*
form print_screen.
loop at i_vbap.
on change of i_vbap-vbeln.
write:/2 sy-vline, i_vbap-vbeln,13 sy-vline,14 i_vbap-posnr,
22 sy-vline,23 i_vbap-matnr,44 sy-vline,45 i_vbap-arktx(34),
80 sy-vline, 81 i_vbap-kwmeng, 99 sy-vline, 100 i_vbap-netwr, 120
sy-vline..
flag = 'X'.
endon.
if flag ne 'X'.
write:/2 sy-vline, 13 sy-vline,14 i_vbap-posnr,
22 sy-vline,23 i_vbap-matnr,44 sy-vline,45 i_vbap-arktx(34),
80 sy-vline, 81 i_vbap-kwmeng, 99 sy-vline, 100 i_vbap-netwr, 120
sy-vline..
endif.
clear flag.
endloop.
write:/2 sy-uline(120).
endform.
" print_screen
*&---------------------------------------------------------------------*
*&
Form print_spool
*&---------------------------------------------------------------------*
form print_spool.
data:
params
data: valid.
like pri_params.
call function 'GET_PRINT_PARAMETERS'
exporting
list_name
= 'TEST'
list_text
= 'Fixed Deposit List'
immediately
= ' '
84
Technical Note
Sample Programs
Sample report program YSALES_SC (Example 4)
release
= 'X'
new_list_id
= 'X'
line_size
= 120
line_count
= 80
layout
= 'X_90_120'
no_dialog
= 'X'
importing
out_parameters = params
valid
= valid.
if valid <> space and p2 = 'X'.
new-page print on parameters params no dialog.
loop at i_vbap.
on change of i_vbap-vbeln.
write:/2 sy-vline, i_vbap-vbeln,13 sy-vline,14 i_vbap-posnr,
22 sy-vline,23 i_vbap-matnr,44 sy-vline,45 i_vbap-arktx(34),
80 sy-vline, 81 i_vbap-kwmeng, 99 sy-vline, 100 i_vbap-netwr, 120
sy-vline..
flag = 'X'.
endon.
if flag ne 'X'.
write:/2 sy-vline, 13 sy-vline,14 i_vbap-posnr,
22 sy-vline,23 i_vbap-matnr,44 sy-vline,45 i_vbap-arktx(34),
80 sy-vline, 81 i_vbap-kwmeng, 99 sy-vline, 100 i_vbap-netwr, 120
sy-vline..
endif.
clear flag.
endloop.
write:/2 sy-uline(120).
endif.
new-page print off.
w_spool = sy-spono.
perform print using w_spool.
.
if sy-subrc eq 0.
write:/2 'Spool Number-',w_spool, ' is forwarded to SAPConnect'.
endif.
endform.
Technical Note
" print_spool
85
Sample Programs
Sample report program YSALES_SC (Example 4)
86
Technical Note
Download