Hi All,
Im quite new to scripts and Im working using subroutines.
I need to display invoice number date and amount in the form. To calculate the amount Im calling this subroutine in the main window of the form and defined this subroutine in the driver program.
Ive done like this:
/: DEFINE &TOT_PRICE&:= ' '
/: PERFORM GET_TOT IN PROGRAM YCHEQUE
/: USING &GS_REGUH-LIFNR&
/: USING &GS_REGUH-VBLNR&
/: CHANGING &TOT_PRICE&
/: <B> Total: &OUT_TAB-VALUE&
/: <B> TOTAL: &TOT_PRICE& </>
/: ENDPERFORM
Ive tried printing these values outside the subroutine as well but of no use, the value &OUT_TAB-VALUE& or &TOT_PRICE& are not getting printed.
/: <B> Total: &OUT_TAB-VALUE&
/: <B> TOTAL: &TOT_PRICE& </>
In my driver program(YCHEQUE) the subroutine is defined as follows:
FORM get_tot TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.
"CHANGING tot_price TYPE RBETR."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.
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
vblnr = lv_var1 BINARY SEARCH.
IF sy-subrc EQ 0.
tot_price = gs_reguh1-rbetr.
lv_var2 = tot_price.
out_tab-value = lv_var2.
MODIFY out_tab INDEX 1.
ENDIF.
ENDFORM. "get_tot
During debugging I can see that the desired values are getting updated to the fields out_tab-value & tot_price, but they are not getting displayed in the form.
Can you please let me know where Im going wrong in this.
Thanks in advance!!
Regards,
Narendra.