Skip to Content
avatar image
Former Member

Scripts Issue

Hi All,

Im working on scripts for cheque printing, Im displaying the items and their totals and below in the footer the amount in words.

Ive called 2 subroutines, one for total and one for amount in words and calling those in my main window and the footer window respectively.

But the problem here is the total is not getting displayed, the amount in words is fine.

Please guide me where Im going wrong or what needs to be done.

Thanks in advance.

Narendra.

In the main window this is how it is:

/E Total

/: Define &tot_price&:= ' '

/: PERFORM GET_TOT IN PROGRAM YCHEQUE

/: USING &GS_REGUH-LIFNR&

/: USING &GS_REGUH-VBLNR&

/: CHANGING &TOT_PRICE&

/: ENDPERFORM

IT <B> TOTAL: &TOT_PRICE& </>

The subroutine is as follows:

FORM get_tot TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.

DATA: tot_price TYPE rbetr,

lv_var TYPE char25,

lv_var1 TYPE char25,

lv_var2 TYPE char25.

SORT gt_reguh BY lifnr vblnr. "Table with line items.

SORT gt_reguh1 BY lifnr. "This table has the totals based on lifnr.

READ TABLE in_tab WITH KEY 'GS_REGUH-LIFNR'. "INDEX 1. " gs_reguh-lifnr

IF sy-subrc EQ 0.

lv_var = in_tab-value.

ENDIF.

READ TABLE in_tab WITH KEY 'GS_REGUH-VBLNR'. "INDEX 2 gs_reguh-vlbnr

IF sy-subrc EQ 0.

lv_var1 = in_tab-value.

ENDIF.

READ TABLE gt_reguh1 INTO gs_reguh1 WITH KEY lifnr = lv_var BINARY SEARCH.

IF sy-subrc EQ 0.

tot_price = gs_reguh1-rbetr.

lv_var2 = tot_price.

READ TABLE out_tab WITH KEY 'TOT_PRICE'.

IF sy-subrc EQ 0.

out_tab-value = lv_var2. "tot_price.

MODIFY out_tab INDEX 1.

ENDIF.

ENDIF.

ENDFORM. "get_tot

In my footer window this is written:

/E FOOTER1

/: DEFINE &AMT1&:= ' '

/: DEFINE &AMT2&:= ' '

/: PERFORM GET_WORDS IN PROGRAM YCHEQUE

/: USING &GS_REGUH-LIFNR&

/: CHANGING &AMT1&

/: CHANGING &AMT2&

/: ENDPERFORM

IT <B> &AMT1&

IT <B> &AMT2& </>

The subroutine is as follows:

DATA: amt1 TYPE in_words,

amt2 TYPE decword,

lv_var TYPE char25.

SORT gt_reguh1_words BY lifnr.

READ TABLE in_tab WITH KEY 'GS_REGUH-LIFNR'.

IF sy-subrc EQ 0.

lv_var = in_tab-value.

ENDIF.

READ TABLE gt_reguh1_words INTO gs_reguh1_words WITH KEY lifnr = lv_var BINARY SEARCH.

IF sy-subrc EQ 0.

READ TABLE out_tab WITH KEY 'AMT1'.

IF sy-subrc EQ 0.

amt1 = gs_reguh1_words-amt.

out_tab-value = gs_reguh1_words-amt.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

READ TABLE out_tab WITH KEY 'AMT2'.

IF sy-subrc EQ 0.

amt2 = gs_reguh1_words-decamt.

out_tab-value = gs_reguh1_words-decamt.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

ENDIF.

ENDFORM. "GET_WORDS

Im calling these as below:

LOOP AT gt_reguh INTO gs_reguh.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'ITEM_LINE'

window = 'MAIN'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'FOOTER1'

window = 'FOOTER'.

AT END OF lifnr.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

ENDAT.

ENDLOOP.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 22, 2008 at 03:15 AM

    Hi Narendra

    On a first glance, i see the parameters you are passing for subroutine GET_TOT in Form are different from the definition in program. Please check.

    Regards

    Eswar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Eswar,

      The subroutine is just fine, I can say this because I completed this and then started with the amount in words part. Previously this is just fine and after I incorporated the latter part the total is not getting displayed.

      Can you tell me where you find that the parameters havent been passed correctly?I mean the difference in the driver program compared to the form?

      Regards,

      Narendra

  • avatar image
    Former Member
    Jan 22, 2008 at 04:01 AM

    Hi all,

    Its solved!!

    Add comment
    10|10000 characters needed characters exceeded