ABAP - Payment Advice Sent through mail Via PDF Attachment
Skip to end of metadata
Created by Former Member on Jun 27, 2013
Go to start of metadata
Author: Kaleemullah
Submitted: 4/12/2007
The Code basically generates Payment Advice (F110), and sends through mail to the vender as PDF attachment.
Post an Open Item through F-43.
Run F110 (Auto Payment Run) Partially till the Proposals are created.
Then Run the Below Program in order to Post the Open Items Cross Company wise, and Generate the Payment Advices.
The Program Logic does the following things.
Deletes the Proposal (Kill Run ID) Fromm F110.
Updates the Custom Table ZREGUH, and ZREGUP.
Runs the Transaction F-53 to Post the respective open item.
Calls the transaction FBZ5 to Generate the Spool for the Posted Entry.
FBZ5 in turn generates number.
Capture the Time Stamp for the each spool generated.
The Converts the spool(Payment Advice) to PDF Format.
Sends the Payment Advice in PDF Format as an attachment to the Vendors vial Mail.
FBZP Screen Where Configuration needs to be done in all Tab Buttons.
The Corresponding Configuration settings for F110 needs to be checked out in FBZP Transaction, Assignment of Payment methods, forms and Print Programs.
RFFOEDI01 - Use to Configure to send via EDI as well through mail.
But the Given Code specifically works in Cross company Posting scenario, which Standard SAP doesn't provide.
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
REPORT zfpbccp_ihk NO STANDARD PAGE HEADINGLINE-COUNT 65 LINE-SIZE 255.
INCLUDE zbbdclib. "Added for ITHTABLES:t100,
reguh, "Settlement data from payment program
regup, "Processed items from payment program
regus, "Vendor locking table during payment run
t042i, "Bank information for payement method
payr, bseg, bkpf, lfa1,
zregup, zreguh, "Added for ITH to store info as in REGUH/P
somlreci1. "kaleem
*bkaleem
TYPES: BEGIN OF t_tbtcp.INCLUDE STRUCTURE tbtcp.TYPES: END OF t_tbtcp.BEGIN OF t_t042i,
zbukr TYPE t042i-zbukr, "paying company code
hbkid TYPE t042i-hbkid, "short KEY for a house bank
zlsch TYPE t042i-zlsch, "payment method
waers TYPE t042i-waers, "currency KEY
hktid TYPE t042i-hktid, "id for account details
ukont TYPE t042i-ukont, "g/l account to be posted
END OF t_t042i,BEGIN OF t_reguh,
laufd TYPE reguh-laufd, "Date program is to be run
laufi TYPE reguh-laufi, "Additional identification
xvorl TYPE reguh-xvorl, "Indicator: Only Proposal Run?
zbukr TYPE reguh-zbukr, "Paying company code
lifnr TYPE reguh-lifnr, "Acc num of vendor or creditor
kunnr TYPE reguh-kunnr, "Customer number
empfg TYPE reguh-empfg, "Payee code
vblnr TYPE reguh-vblnr, "Doc Num Payment Document
END OF t_reguh,BEGIN OF t_tstamp,
rqclient TYPE tsp01-rqclient, "Client
rqowner TYPE tsp01-rqowner, "Spool request: Name
rqcretime TYPE tsp01-rqcretime, "Time of spool request
rqdoctype TYPE tsp01-rqdoctype, "Spool: document type
END OF t_tstamp,BEGIN OF t_tsp01,
rqident TYPE tsp01-rqident, "Spool request number
rqclient TYPE tsp01-rqclient, "Client
rqowner TYPE tsp01-rqowner, "Spool request: Name
rqcretime TYPE tsp01-rqcretime, "Time of spool request
rqdoctype TYPE tsp01-rqdoctype, "Spool: document type
END OF t_tsp01,BEGIN OF t_buffer,
buffer LIKE soli,
END OF t_buffer.*Tables Declaration
DATA:i_t042i TYPE STANDARD TABLE OF t_t042i,
i_reguh TYPE STANDARD TABLE OF t_reguh,
i_tstamp TYPE STANDARD TABLE OF t_tstamp,
i_tsp01 TYPE STANDARD TABLE OF t_tsp01,
• i_buffer TYPE STANDARD TABLE OF t_buffer,
• i_bufff TYPE STANDARD TABLE OF t_buffer,
*Work Area Declaration
• wa_buffer LIKE LINE OF i_buffer,
wa_tsp01 LIKE LINE OF i_tsp01,
wa_tstamp LIKE LINE OF i_tstamp,
wa_reguh LIKE LINE OF i_reguh,
wa_t042i LIKE LINE OF i_t042i.
DATA:it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
*Job Runtime Parameters
DATA:gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc,
w_recsize TYPE i.
DATA:gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_mess_bodf LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_mess_attf LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_recieve LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
*Spool to PDF conversions
DATA: gd_bytecount LIKE tst01-dsize,gd_buffer TYPE string.
• Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.INCLUDE STRUCTURE tline.DATA: END OF it_pdf_output.*ekaleem
DATA:invoiceno(13) TYPE c,
invoicedate(11) TYPE c,
invoice-date LIKE sy-datum,
• INVOICE-DATE(10) TYPE C,
invoiceamt(16) TYPE c,
num-invoiceamt(13) TYPE n,
dec-invoiceamt(13) TYPE p DECIMALS 5,
ourrefno(13) TYPE c,
flength TYPE i,
item_count TYPE i,
cr(02) TYPE x VALUE '0D0A',
ccode(03) TYPE c VALUE 'ITH',
vendorkey(11) TYPE c,
*Begin of SR#15676 with DEVK951083
• HSEBANK(03) TYPE C,
hsebank(05) TYPE c,
*End of SR#15676 with DEVK951083
bankacct(05) TYPE c,
pattern1(01) VALUE '.',
rep-str1(01) VALUE ',',
lead-zero1(16) VALUE '0000000000000000',
char-wrbtr(16) TYPE c,
char-transamt(16) TYPE c,
num-transamt(16) TYPE n,
lead-zero2(08) VALUE '00000000',
lead-zero3(15) VALUE '000000000000000',
lead-zero4(05) VALUE '00000',
lead-zero5(03) VALUE '000',
char-itemcnt(05) TYPE c,
char-totrec(06) TYPE c,
char-refno(03) TYPE c,
newrun(01) TYPE c,
a TYPE i,
b TYPE i,
cmsg(15) TYPE c,
dmsg(10) TYPE c,
a01 VALUE '`',
a02 VALUE '~',
a03 VALUE '!',
a04 VALUE '@',
a05 VALUE '#',
a06 VALUE '$',
a07 VALUE '%',
a08 VALUE '^',
a09 VALUE '&',
a10 VALUE '*',
a11 VALUE '+',
a12 VALUE '_',
a13 VALUE '=',
a14 VALUE '|',
a15 VALUE '\',
a16 VALUE '[',
a17 VALUE ']',
a18 VALUE '{',
a19 VALUE '}',
a20 VALUE ';',
a21 VALUE ':',
a22 VALUE '''',
a23 VALUE '"',
a24 VALUE '<',
a25 VALUE '?',
sdata(35) TYPE c,
errcnt TYPE i.
*----------- TO SET FOR ITH OR IHK DECISION ---
DATA : BEGIN OF messtab OCCURS 100.
INCLUDE STRUCTURE bdcmsgcoll.DATA : END OF messtab.
DATA : BEGIN OF it_reguh OCCURS 100.
INCLUDE STRUCTURE reguh.DATA : END OF it_reguh.
DATA : BEGIN OF it_regup OCCURS 100.
INCLUDE STRUCTURE regup.DATA : END OF it_regup.
• Begin of SR#15676 with DEVK951403
DATA: v_bukrs LIKE t001-bukrs.*End of SR#15676 with DEVK951403
DATA:ws_prop VALUE 'X',
paycurr(4),
• DEVK912327
• W_PAYMETH TYPE N, "PM J for ACH in EG
w_paymeth TYPE c,
• DEVK912327
payacct(10),
wf_fail_trans VALUE 'Y',
ws_text(100),
ws_paydoc(10),
ws_payco(3).
*bkaleem
*Data Declarations
DATA:gd_recsize TYPE i,
v_pmail TYPE somlreci1-receiver,
v_smail TYPE somlreci1-receiver.
CONSTANTS:c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL',
c_sender(21) TYPE c VALUE 'Asia_AP@Celestica.com',
c_pdf(3) TYPE c VALUE 'PDF'.
SELECTION-SCREEN BEGIN OF BLOCK a0 WITH FRAME TITLE text-002.PARAMETERS: p_zbukr LIKE t042i-zbukr DEFAULT 'IHK' NO-DISPLAY.PARAMETERS: p_hbkid LIKE t042i-hbkid DEFAULT 'BOA' NO-DISPLAY.*PARAMETERS: p_waers LIKE t042i-waers OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a0.*ekaleem
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE c_co1.*Begin of SR#15676 with DEVK951403
*PARAMETERS: payforco LIKE bkpf-bukrs.
PARAMETERS: payforco LIKE bkpf-bukrs OBLIGATORY.*End of SR#15676 with DEVK951403
PARAMETERS: paymeth DEFAULT '1'. "kaleemPARAMETERS: paym TYPE num1 DEFAULT '1' NO-DISPLAY.SELECTION-SCREEN END OF BLOCK b1.SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE c_co2.PARAMETERS:effdate LIKE sy-datum DEFAULT sy-datum,
checklot LIKE pcec-stapl DEFAULT 1,
print_to LIKE tsp03-padest DEFAULT 'CKHK'.
SELECTION-SCREEN BEGIN OF LINE.SELECTION-SCREEN COMMENT 01(31) c_print.SELECTION-SCREEN POSITION POS_LOW.PARAMETERS printnow AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN END OF BLOCK b3.SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.PARAMETERS: payrdate LIKE sy-datum DEFAULT sy-datum,"'19990525',payriden LIKE reguh-laufi. " DEFAULT 'DLU02'.
• p_delspl AS CHECKBOX. "bkaleem
SELECTION-SCREEN END OF BLOCK b2.INITIALIZATION.
c_co1 = 'PAY FOR COMPANY'.
c_co2 = 'PAYING COMPANY'.
c_print = 'PRINT NOW'.
AT SELECTION-SCREEN.
MESSAGE e000.
*Begin of SR#15676 with DEVK951403
AT SELECTION-SCREEN ON payforco.
PERFORM check_bukrs.
*bkaleem
AT SELECTION-SCREEN ON p_zbukr.
IF p_zbukr NE 'IHK'.WRITE:/ 'Paying Company Code should always be IHK'(k34). "kaleemMESSAGE e039(z1) WITH 'Paying Company code is IHK'(004).
ENDIF.*ekaleem
*---------------------------------------------------------------------
*& Form check_bukrs
...