on 03-23-2010 8:49 AM
Hi Experts,
I need to print on document ORIGINAL on first time print and from second time onwards DUPLICATE. This is FI correspondence type ZFI. so these entries will not store in NAST table. Please give me table name where this document number will get stored like in NAST table or any logic.
Hi,
Create a Ztable in which u create a field that holds the Number of the Doc (Number Range maintained in SNRO Transaction) and the Key Fields also icluded like A/C Doc No, Comp Code, Doc Type etc... in the Ztable .
Create a Report in which in the selection Screen Declare two radio buttons
PARAMETER : RB_ORG RADIOBUTTON GROUP GP1 , " For Original Invoice Printing
RB_DUP RADIOBUTTON GROUP GP1 . " For Duplicate Invoice Printing
Write the Code for Displaying the List of Doc that are to be Taken Print .
and follow the below code for Displaying the Original and Duplicate entries
*---Read table IT_SF_ZINVOICE to get the Doc Number
READ TABLE IT_SF_ZINVOICE WITH KEY BELNR = IT_ZINVOICE-BELNR.
IF SY-SUBRC = 0.
WA_ZINVOICE-INV_NO = IT_SF_ZINVOICE-INV_NO .
ENDIF.
*---When original Radibutton is clicked
IF V_ORG = 'X'.
IF IT_SF_ZINVOICE-INV_NO = ' '.
FLAG = 'X'.
*--- Function Module to get the next Invoice Number
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'ZFI_IN'
QUANTITY = '00000000000000000001'
IMPORTING
NUMBER = ZINVNO
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE:/'NUMBER RANGE FALIURE', WA_ZINVOICE-INV_NO.
ENDIF.
ENDIF.
* IF V_BELNR <> WA_ZINVOICE-BELNR .
IF WA_ZINVOICE-INV_NO = ' '.
*--- get the invoice number generated
WA_ZINVOICE-INV_NO = ZINVNO.
ENDIF.
*--- Read table IT_BKPF comparing Doc Number
READ TABLE IT_BKPF WITH KEY BELNR = IT_ZINVOICE-BELNR.
*--- Get the details of the list displayed
IF SY-SUBRC = 0.
WA_ZINVOICE-BELNR = IT_BKPF-BELNR.
WA_ZINVOICE-BUKRS = IT_BKPF-BUKRS.
WA_ZINVOICE-BLART = IT_BKPF-BLART.
WA_BKPF-BUDAT = IT_BKPF-BUDAT.
WA_BKPF-BKTXT = IT_BKPF-BKTXT.
ENDIF.
*---Read table IT_BSID comparing Doc Number
READ TABLE IT_BSID WITH KEY BELNR = IT_ZINVOICE-BELNR.
*--- Get the details of Customer
IF SY-SUBRC = 0.
WA_ZINVOICE-KUNNR = IT_BSID-KUNNR.
WA_BSID-DMBTR = IT_BSID-DMBTR.
ENDIF.
*---Insert the values into ZINVOICE table
IF FLAG = 'X'.
INSERT ZINVOICE FROM WA_ZINVOICE.
ENDIF.
ENDIF.
*--For Counting Pages
VAR = VAR + 1. This is for Original Copy
*---Read table IT_SF_ZINVOICE to get the Doc Number
READ TABLE IT_SF_ZINVOICE WITH KEY BELNR = IT_ZINVOICE-BELNR.
WA_ZINVOICE-INV_NO = IT_SF_ZINVOICE-INV_NO .
*--- Read table IT_BKPF comparing Doc Number
READ TABLE IT_BKPF WITH KEY BELNR = IT_ZINVOICE-BELNR.
*--- Get the details of the list displayed
IF SY-SUBRC = 0.
WA_ZINVOICE-BELNR = IT_BKPF-BELNR.
WA_ZINVOICE-BUKRS = IT_BKPF-BUKRS.
WA_ZINVOICE-BLART = IT_BKPF-BLART.
WA_BKPF-BUDAT = IT_BKPF-BUDAT.
WA_BKPF-BKTXT = IT_BKPF-BKTXT.
ENDIF.
*---Read table IT_BSAD comparing Doc Number
READ TABLE IT_BSID WITH KEY BELNR = IT_ZINVOICE-BELNR.
*--- Get the details of Customer
IF SY-SUBRC = 0.
WA_ZINVOICE-KUNNR = IT_BSID-KUNNR.
WA_BSID-DMBTR = IT_BSID-DMBTR.
ENDIF.
*--For Counting Pages
VAR = VAR + 1. This is for Duplicate
Regards,
Vijaya Lakshmi.T
Edited by: Vijaya Lakshmi on Mar 23, 2010 10:26 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.