Você está na página 1de 4

*&---------------------------------------------------------------------*

*& Report ZSDR_CHEQUE_RECPT


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZSDR_CUST_RECPT NO STANDARD PAGE HEADING.


TABLES : BSIS .

TYPES: BEGIN OF TY_BSID,


KUNNR TYPE BSID-KUNNR,
BUKRS TYPE BSID-BUKRS ,
AUGDT TYPE BSID-AUGDT, "Clearing date
AUGBL TYPE BSID-AUGBL, "Clearing Document
ZUONR TYPE BSID-ZUONR, "Assignment
SGTXT TYPE BSID-SGTXT, "BANK Text
VBELN TYPE BSID-VBELN, "Billing Document
KIDNO TYPE BSID-KIDNO, "Payment reference
GJAHR TYPE BSID-GJAHR, "Fiscal Year
XREF1 TYPE BSID-XREF1,
BELNR TYPE BSID-BELNR, "Document Number
BUDAT TYPE BSID-BUDAT, "Posting Date
XBLNR TYPE BSID-XBLNR, "Reference
BLART TYPE BSID-BLART, "Document Type
GSBER TYPE BSID-GSBER, "Business Area
SHKZG TYPE BSID-SHKZG, "Debit/Credit Ind.
ZUMSK TYPE BSID-ZUMSK, "Trgt special G/L ind
DMBTR TYPE BSID-DMBTR, "Amount in LC.
REBZG TYPE BSID-REBZG,
END OF TY_BSID,

BEGIN OF TY_DOC,
VBELN TYPE BSID-VBELN,
KUNNR TYPE BSID-KUNNR,
BELNR TYPE BSID-BELNR,
GJAHR TYPE BSID-GJAHR,
BUKRS TYPE BSID-BUKRS ,
END OF TY_DOC.

DATA: IT_BSIS TYPE TABLE OF ZSDR_RECPT,


WA_BSIS TYPE ZSDR_RECPT,

IT_BSID TYPE TABLE OF TY_BSID,


WA_BSID TYPE TY_BSID,
IT_BSAD TYPE TABLE OF TY_BSID,
WA_BSAD TYPE TY_BSID,

IT_DOC TYPE TABLE OF TY_DOC,


WA_DOC TYPE TY_DOC.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.


PARAMETERS : P_BUKRS LIKE BSIS-BUKRS OBLIGATORY.
PARAMETERS : P_GJAHR LIKE BSIS-GJAHR OBLIGATORY.
SELECT-OPTIONS : S_BELNR FOR BSIS-BELNR OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.

DATA : FM_NAME TYPE RS38L_FNAM.


START-OF-SELECTION.
PERFORM SELECT.

END-OF-SELECTION.
PERFORM OUTPUT.
*&---------------------------------------------------------------------*
*& Form SELECT
*&---------------------------------------------------------------------*
FORM SELECT .
SELECT BUKRS GSBER BELNR XREF3 GJAHR FROM BSIS INTO CORRESPONDING FIELDS OF TABLE
IT_BSIS WHERE BUKRS = P_BUKRS AND GJAHR = P_GJAHR AND BELNR IN S_BELNR AND XREF3
<> ' '.

IF IT_BSIS[] IS NOT INITIAL.


SELECT * FROM BSID INTO CORRESPONDING FIELDS OF TABLE IT_BSID
FOR ALL ENTRIES IN IT_BSIS
WHERE BUKRS = P_BUKRS AND
GJAHR = P_GJAHR AND
BELNR = IT_BSIS-BELNR AND
GSBER = IT_BSIS-GSBER.

SELECT * FROM BSAD INTO CORRESPONDING FIELDS OF TABLE IT_BSAD


FOR ALL ENTRIES IN IT_BSIS
WHERE BUKRS = P_BUKRS AND
GJAHR = P_GJAHR AND
BELNR = IT_BSIS-BELNR AND
GSBER = IT_BSIS-GSBER.

ENDIF.

LOOP AT IT_BSID INTO WA_BSID.


WA_DOC-KUNNR = WA_BSID-KUNNR.
WA_DOC-BELNR = WA_BSID-BELNR.
WA_DOC-GJAHR = WA_BSID-GJAHR .
WA_DOC-BUKRS = WA_BSID-BUKRS.

IF WA_BSID-VBELN IS NOT INITIAL.


WA_DOC-VBELN = WA_BSID-VBELN.
ELSEIF WA_BSID-KIDNO IS NOT INITIAL.
WA_DOC-VBELN = WA_BSID-KIDNO.
ELSEIF WA_BSID-REBZG IS NOT INITIAL.
WA_DOC-VBELN = WA_BSID-REBZG .
ELSEIF WA_BSID-XREF1 IS NOT INITIAL.
WA_DOC-VBELN = WA_BSID-XREF1 .
ENDIF.

APPEND WA_DOC TO IT_DOC.


CLEAR:WA_BSID,WA_DOC.
ENDLOOP.
LOOP AT IT_BSAD INTO WA_BSAD.
WA_DOC-KUNNR = WA_BSAD-KUNNR.
WA_DOC-BELNR = WA_BSAD-BELNR.
WA_DOC-GJAHR = WA_BSAD-GJAHR .
WA_DOC-BUKRS = WA_BSAD-BUKRS.

IF WA_BSAD-VBELN IS NOT INITIAL.


WA_DOC-VBELN = WA_BSAD-VBELN.
ELSEIF WA_BSAD-KIDNO IS NOT INITIAL.
WA_DOC-VBELN = WA_BSAD-KIDNO.
ELSEIF WA_BSAD-REBZG IS NOT INITIAL.
WA_DOC-VBELN = WA_BSAD-REBZG .
ELSEIF WA_BSAD-XREF1 IS NOT INITIAL.
WA_DOC-VBELN = WA_BSAD-XREF1 .
ENDIF.

APPEND WA_DOC TO IT_DOC.


CLEAR:WA_BSAD,WA_DOC.
ENDLOOP.

SORT IT_DOC BY BELNR.

ENDFORM. " SELECT


*&---------------------------------------------------------------------*
*& Form OUTPUT
*&---------------------------------------------------------------------*
FORM OUTPUT .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'


EXPORTING
FORMNAME = 'YCUST_PAY_RECPT' "TATA RECEIPT
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

* LOOP AT IT_DOC INTO WA_DOC.


CALL FUNCTION FM_NAME "'/1BCDWB/SF00000021'
EXPORTING
* DOC_NO = WA_DOC-VBELN
* LV_BELNR = WA_DOC-BELNR
BUKRS = P_BUKRS
GJAHR = P_GJAHR
* P_GJAHR = P_GJAHR
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
IT_RECPT = IT_BSIS
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR WA_DOC.
* ENDLOOP.

* IF IT_KNA1[] IS NOT INITIAL..


* CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
* EXPORTING
* FORMNAME = 'ZWELCOME_NOTE_N'
* IMPORTING
* FM_NAME = FM_NAME
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3.
* 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 FM_NAME
* TABLES
* IT_CUST = IT_KNA1.
* 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.

ENDFORM. " OUTPUT