on 01-14-2008 1:46 AM
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.
Hi Naren,
You should read the internal table 'out_tab' with the field that is used in CHANGING statement in the script.
In your case it will be
READ TABLE out_tab WITH KEY 'TOT_PRICE'.
After read statement is successful then you should assign the desired value to the out_tab-value and modify then.
In your case it will be
out_tab-value = lv_var2.
MODIFY out_tab INDEX 1.
It will be displayed on script once you do this.
Regards,
Anil
Please reward if helpful!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mr. Narendra,
Always remember that parameters that you use in the driver program like in_tab and out_tab of type itcsy are not at all recognized by the form since they are local to the driver programs.
You directly attempted to use them in your form which technically incorrect like :
/: Total: &OUT_TAB-VALUE& "this is local to the program
apart from this since you are passing only one parameter to the changing from your form so you do not even have to read your out_tab table.
just do it like this:
out_tab-value = lv_var2.
modify out_tab index 1.
and in the form use your &tot_price& to print the value of the amount.
Thanks,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks guyz!! itz solved.
I have done as Anil Kumar has suggested and it worked.!!
Mark.. I have also tried your suggestion but that is the same what I have done, I was reading another table and modifying out_tab.
Srikanth..As I've told you I have used both the options, niwz now it is fine....
Thank you all,
Narendra.
HI Narendra ,
then try like this
**********IT SHOULD BE DONE LIKE THIS***
/: DEFINE &TOT_PRICE&:= ' '
/: PERFORM GET_TOT IN PROGRAM YCHEQUE
/: USING &GS_REGUH-LIFNR&
/: USING &GS_REGUH-VBLNR&
/: CHANGING &TOT_PRICE&
/: ENDPERFORM
TOTAL: &TOT_PRICE&
************************************************
ithink you want to print only totals
REGARDS,
SREE..
REWARD POINTS IF HELP FULL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Narendra ,
YOU HAVE DONE A SMALL MISTAKE IN WRITING THE FORM IN SCRIPT.
**********YOU HAVE DONE LIKE THIS***
/: DEFINE &TOT_PRICE&:= ' '
/: PERFORM GET_TOT IN PROGRAM YCHEQUE
/: USING &GS_REGUH-LIFNR&
/: USING &GS_REGUH-VBLNR&
/: CHANGING &TOT_PRICE&
/: Total: &OUT_TAB-VALUE&
*/: TOTAL: &TOT_PRICE& *
/: ENDPERFORM
************************************************
**********IT SHOULD BE DONE LIKE THIS***
/: DEFINE &TOT_PRICE&:= ' '
/: PERFORM GET_TOT IN PROGRAM YCHEQUE
/: USING &GS_REGUH-LIFNR&
/: USING &GS_REGUH-VBLNR&
/: CHANGING &TOT_PRICE&
/: ENDPERFORM
Total: &OUT_TAB-VALUE&*
TOTAL: &TOT_PRICE& *
************************************************
REGARDS,
SREE..
REWARD POINTS IF HELP FULL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.