Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

How to Create a Custom Print program with Smartforms for Payment Instruments(like Cheque,Payorder e.t.c) in SAP FI(Financials)(Transactions = F-58,FBZ5,FBZP)?

$
0
0

How to Create a Custom Print program with Smartforms for Payment Instruments(like Cheque,Payorder e.t.c) in SAP FI(Financials)(Transactions = F-58,FBZ5,FBZP)?

 

There are various payment instruments available in SAP FI,each of which is denoted technically in sap by the term 'Payment method'. Some of these instruments include 'Cheque Payment','Cash Payment','Payment Order','Bank Transfer PLS','Bank Transfer Current' e.t.c. Cheque and Payorder are the most commonly used instruments. Of course the FI consultant can create custom payment methods and map them to a country,by going to the following menu path in IMG(Customizing):

Financial Accounting(New) > Accounts Receivable and Accounts Payable > Business Transactions > Incoming Payments > Automatic Incoming Payments > Payment Method/Bank Selection for Payment Program > Set Up Payment Methods per Country for Payment Transactions

The name of the Standard Print Program for these Payment Instruments is 'RFFOUS_C'. If you look closely at this program,you will find an include named 'RFFORI01',this include program will contain SAP Scrip statements such as 'OPEN_FORM','WRITE_FORM' and 'CLOSE_FORM' e.t.c.,which can easily be opened in SAP Script Form transaction of 'SE71'. For example the default SAP Script attached to a cheque Payment instrument is 'F110_PRENUM_CHCK'. The standard print program 'RFFOUS_S' already contains pre-populated Payment instrument data in the form of structures,that can be added to a custom structure or internal table and passed to a smartform or an SAP Script.

 

Standard Structures pre-populated with data in the Standard Print Program:

The standard Structures that will be helpful for passing in data,include the following:

 

(01)REGUH(Settlement data from payment program):

This structure includes information related to the payment instrument such as:

(A)Vendor or Payee Number(reguh-empfg+1(10),reguh-lifnr)

(B)Vendor or Payee Name(reguh-znme1,reguh-znme2)

(C)Cheque Date(reguh-laufd)

(D)Cheque Amount in Number(reguh-rbetr)[Note: you can use the function module 'SPELL_AMOUNT' for converting the given cheque amount into words]

(E)Bank Document Number(reguh-belnr)

(F)Bank Document Date(reguh-laufd)

(G)Vendor or Payee Address Line(reguh-stras)

(H)Vendor or Payee City(reguh-ort01)

 

(02)REGUD(Form print transfer data):

This structure includes information related to the payment instrument such as:

(A)Cheque Number(reguh-chect)[This is basically is the lot number for the payment instrument which is defined as a series by the FI functional Consultant]

 

(03)PAYR(Payment Medium File):

This structure includes fields such as:

(A)short key for House Bank(payr-HBKID)(This can be used for determining the Payment Instrument being currently used)

(B)Cheque number(payr-CHECT)

(C)Currency key(payr-WAERS)

(D)Print User(payr-PRIUS)

(E)Bank number of the payee's bank(payr-ZBNKL)

(F)Name of the payee(payr-ZNME1)

(G)Title of the payee(payr-ZANRE)

(H)Fiscal Year(payr-GJAHR)

(I)Paying company code(payr-ZBUKR)

 

[Note]: To see all the fields in these structures,you can enter them in the Data Dictionary Transaction(SE11),to see a list of all the fields.

 

> The Print Program for these Payment instruments can be invoked in 2 ways:

(01)By posting a document for the given payment methods,you will be prompted to print that,using the Transaction 'F-58'(Payment with Printout:Header Data).

(02)By printing documents that have already been printed using the transaction 'FBZ5'(Print Form for Payment Document).

 

Procedure for attaching the Smartform in place of the standard Print Program(RFFOUS_C):

In order to attach the smartform,you need to create a replica of the Standard Print Program(RFFOUS_C) in customer namespace e.g: 'ZRFFOUS_C'.Next you will need to attach this replica in place of the standard program,by going to the Transaction 'FBZP'(Maintain Payment Program) and then click the 'Pmnt methods in country' button,in the position button enter in the 'country code',in our case it is PK(Pakistan) and the 'payment method' lets say 'C'(Cheque payment) Just Double click the payment method for which you want to attach the program. Now in the 'Payment medium' section,copy the name of your custom replica program within the 'Payment medium program' input field,just below the 'Use classic payment medium programs(RFFO)*' radio button and then click the save button to save this. This attaches your custom print program instead of the standard print program.

 

You can attach the same custom replica program on all payment methods and use conditional constructs to launch the relevant smarforms for each of the payment instruments. you can use a field such as 'short key for House Bank'(reguh-HBKID) to select whether the Payment method is 'NBPC'(custom created for the NBP project) cheque or Payorder 'NBPP'((custom created for the NBP project)) [OR] you can use the 'Payment Method for This Payment' field(reguh-RZAWE) to check for the payment method 'C'(For Cheque) and 'E'(For Payorder).

 

Figure 01(A) : Attaching Print Program in FBZP 'paymnt methods in country'

01_a_Attaching_Print_program_in_FBZP_paymnt_methods_in_country.png

 

Figure 01(B) : Position button country code to seek out payment methods

01_b_position_button_country_code_to_seek_out_payment_methods.png

 

Figure 01(C) : Select the Payment Method Row and click details button in  ApplicationToolbar

01_c_Select_the_payment_method_row_and_click_details_button_in_APPTB.png

 

Figure 01(D) : Attaching Print Program in FBZP and Click Save button to assign

01_d_Attaching_Print_program_in_FBZP_and_click_save_button_to_assign.png

 

Sample Source Code:

  IF reguh-RZAWE EQ 'C'."A - Load Smartform for a Cheque [Payment Method = C(Cheque)]

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
       EXPORTING
         formname = 'ZFJ_FI_VENDOR_CHEQUE'
       IMPORTING
         fm_name  = fname.

    CALL FUNCTION fname
       EXPORTING
         header_data = header_data"Header Data
       TABLES
         item_data   = item_data."Item Data

    IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
     ENDIF.

elseIF reguh-RZAWE EQ 'E'."B - Load Smartform for a Payorder [Payment Method = E(Payorder)]

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
       EXPORTING
         formname = 'ZFJ_FI_VENDOR_PAYORDER'
       IMPORTING
         fm_name  = fname.

    CALL FUNCTION fname
       EXPORTING
         header_data = header_data
       TABLES
         item_data   = item_data.

    IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
     ENDIF.

  ENDIF.

 

Testing the Final Cheque or Payorder:

In order to test the newly attached replica of Payment Instrument Print program,you have the following 2 ways:

(A) At the Time of posting the document at runtime using transaction F-58:

> When you post a document via the F-58 transaction,you will be prompted to print the payment instrument then and there. In case you have skipped that step,you can use the second method to print it.

(B)Using the Transaction FBZ5 for printing Payment Instruments based on already posted documents,incase the user did not print them while posting them:

> You can print Already posted documents in Transaction FBZ5(Print form for Payment Document). You need to provide in details such as document number,company code,Fiscal year,payment method e.t.c. Just make sure that you have checked the 'Print Immediately' checkbox. Now go the following menu path:

                          Check > Print > Old Check

This will trigger you custom program and select the smartform based on the selection provided in the Payment Method field. You can even set a breakpoint in your custom program to check whether its working or not. You can then print the payment instrument like cheque or payorder,or seek out a Print Preview of the smartform.

 

 

Figure 02(A) : Checking Vendor Cheque(FBZ5)


02_a_checking_vendor_cheque(FBZ5).png

 

 

 

Figure 02(B) : Checking Vendor Payorder(FBZ5)


02_b_checking_vendor_payorder(FBZ5).png

 

 

 

 

Figure 03(A) : Final Cheque Smartform Output

03_a_Final_Cheque_Smartform_Output.png

 

 

Figure 03(A) : Final Payorder Smartform Output

03_b_Final_Payorder_Smartform_Output.png

 

 

[Tip]:You can seek out all documents already posted by looking into a Transparent table named 'PAYR' (Payment Medium File). Its also populated as a structure when the Standard Print program or your custom replica of it is invoked. Details from this table can be used for printing these payment instruments in the FBZ5 Transaction.

 

> In case the data is not fetched from the Standard Structures,you will need to write alternate code for fetching it for example vendor details can be fetched from the Vendor Master data table named 'LFA1'(Vendor Master) or from Customer Master data based in the table named 'KNA1'(Customer Master).

 

Legal

Fahad Javed's Copyrights

All Screen Shots taken,Fahad Javed's Logo are copyrights © 2010-2013 Fahad Javed. All Rights Reserved.

All the material written is a labour of hardwork carried out by the author. Kindly don't copy this material for commercial purposes. If a link is provided do provide the accredition to the author as follows:'© 2010-2013 Fahad Javed. All rights reserved.'.

All the terms used are copyrights of SAP AG  © 2013 SAP AG. All rights reserved. See the section 'SAP - Copyrights and Trademarks' for further details.

SAP - Copyrights and Trademarks

© 2013 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft Corporation.

IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10, z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER, PowerHA, pureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the United States and other countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems Incorporated in the United States and other countries.

Oracle and Java are registered trademarks of Oracle and its affiliates.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems Inc.

HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc.

IOS is a registered trademark of Cisco Systems Inc.

RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World are trademarks or registered trademarks of Research in Motion Limited.

Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice, Google Mail, Gmail, YouTube, Dalvik and Android are trademarks or registered trademarks of Google Inc.

INTERMEC is a registered trademark of Intermec Technologies Corporation.

Wi-Fi is a registered trademark of Wi-Fi Alliance.

Bluetooth is a registered trademark of Bluetooth SIG Inc.

Motorola is a registered trademark of Motorola Trademark Holdings LLC.

Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase is an SAP company.

Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks of Crossgate AG in Germany and other countries. Crossgate is  an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>