Skip to Content
1
Former Member
Jul 23, 2007 at 12:18 PM

Error in perform used in Sap script

32 Views

Using following perform in Sap script

PERFORM 'BANK_DETAILS' IN PROGRAM 'ZFI_PRN_BANK'

USING &BKPF-BELNR&

USING &BKPF-BUKRS&

USING &BKPF-GJAHR&

CHANGING &SAPSCRIPT-COUNTER_0&

CHANGING &SAPSCRIPT-COUNTER_1&

ENDPERFORM

Printing

&SAPSCRIPT-COUNTER_0&

&SAPSCRIPT-COUNTER_1&

The programs is written as

*----


REPORT ZFI_PRN_BANK .

TABLES : ITCSY.

TYPES : BEGIN OF F_TABLE ,

T_NAM LIKE ITCSY-NAME,

T_VAL LIKE ITCSY-VALUE,

END OF F_TABLE.

DATA : O_TABLE TYPE F_TABLE OCCURS 0 WITH HEADER LINE,

I_TABLE TYPE F_TABLE OCCURS 0 WITH HEADER LINE.

----


  • FORM BANK_DETAILS *

----


  • ........ *

----


  • --> INPUT_TABLE *

  • --> OUTPUT_TABLE *

----


FORM BANK_DETAILS TABLES INPUT_TABLE LIKE I_TABLE[]

OUTPUT_TABLE LIKE O_TABLE[].

TABLES: BSEG,LFBK,BNKA.

DATA : DOC_NUM LIKE BSEG-BELNR,

COM_CODE LIKE BSEG-BUKRS,

F_YEAR LIKE BSEG-GJAHR,

T_NUM LIKE BSEG-BELNR,

T_VEN LIKE BSEG-LIFNR,

BANK_NAME LIKE BNKA-BANKA,

BNK_ACC LIKE LFBK-BANKN.

DATA : POS TYPE I.

DOC_NUM = '0000000000'.

READ TABLE INPUT_TABLE INDEX 1.

T_NUM = INPUT_TABLE-T_VAL.

POS = STRLEN( T_NUM ).

POS = 10 - POS.

MOVE T_NUM TO DOC_NUM+POS.

READ TABLE INPUT_TABLE INDEX 2.

COM_CODE = INPUT_TABLE-T_VAL.

READ TABLE INPUT_TABLE INDEX 3.

F_YEAR = INPUT_TABLE-T_VAL.

CLEAR T_NUM.

SELECT * FROM BSEG WHERE BELNR = DOC_NUM AND BUKRS = COM_CODE

AND GJAHR = F_YEAR.

CHECK SY-SUBRC = 0.

T_VEN = BSEG-LIFNR.

ENDSELECT.

REFRESH OUTPUT_TABLE.

SELECT SINGLE * FROM LFBK WHERE LIFNR = T_VEN

AND BANKS = 'IN'.

  • and bankl = bnk_code.

CHECK SY-SUBRC = 0.

BNK_ACC = LFBK-BANKN.

SELECT SINGLE * FROM BNKA WHERE BANKS = 'IN'

AND BANKL = LFBK-BANKL.

BANK_NAME = BNKA-BANKA.

MOVE 'SAPSCRIPT-COUNTER_0' TO OUTPUT_TABLE-T_NAM.

CONDENSE BANK_NAME.

POS = STRLEN( BANK_NAME ).

POS = POS - 1.

MOVE BANK_NAME TO OUTPUT_TABLE-T_VAL.

APPEND OUTPUT_TABLE.

CLEAR OUTPUT_TABLE.

MOVE 'SAPSCRIPT-COUNTER_1' TO OUTPUT_TABLE-T_NAM.

CONDENSE BNK_ACC.

POS = STRLEN( BNK_ACC ).

POS = POS - 1.

MOVE BNK_ACC(POS) TO OUTPUT_TABLE-T_VAL.

APPEND OUTPUT_TABLE.

CLEAR OUTPUT_TABLE.

ENDFORM. "get_bank

-


The value of SAPSCRIPT-COUNTER_0,SAPSCRIPT-COUNTER_1 is printing as 0, 0.

what could be the reason. Kindly help.

Thanks

anu