on 01-13-2009 12:51 PM
Hi all,
I am changing invoice script. My requirement is to select message depends on payment type.
I did check vbdkr structure, but couldn't find payment method type field ZLSCH.
I have to read this from table T052.
SELECT SINGLE FROM T052 WHERE ZTERM = VBDKR-ZTERM.
How can i use this statement in script?
Thanks
Sha
Hi
You cannot use the select statment directly in sapscrpit. You need to do the changes in the driver program .If the driver program is standard program then create a subproutine pool as below.
In the layout set use the code
/: DEFINE &V_TEXT& = ' '
/: perform payment_terms in program z_subroutine
/: using &VBDKR-ZTERM&
/: CHANGING &V_TEXT&
THEN DISPLAYE THE &V_TEXT&
In the subroutine pool wirte the below code.
Form payment_terms using it_input structure itcsy
changing it_output structure itcsy.
DATA : ZTERM TYPE ZTERM,
V_VALUE TYPE "DEFINE THE LENTH REQUIRED.
READ TABLE IT_INPUT INDEX 1.
ZTERM = IT_INPUT-VALUE.
SELECT SINGLE <FIELDNAME> FROM T052
INTO V_VLAUE.
WHERE ZTERM = VBDKR-ZTERM.
IF SY-SUBRC EQ 0.
READ TABLE IT_OUTPUT INDEX 1.
IT_OUTPUT-VALUE = V_VALUE.
MODIFY IT_OUTPUT.
ENDIF.
endform.
Hope the above pseudo code help you to resolve the issue.
Cheers
Joginder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Joginder, It would certainly solve my issue.
But, I have total 8 windows to use this logic...should i use this for all these windows?
I have found one field like VBDKR-DUMMY, I dont know what is the use of this...
Can I use this field in driver program? I mean i want to update this field to D if payment method is direct debit. So that i can use VBDKR-DUMMY in form simply.
Waiting for your response.
Regards
Sha
Hi
When you need a same value in the 8 windows it not is prefereable to use a subroutine pool one until unless you cannot edit your driver program ,The reason is you will read the select statment 8 times.
So when you have an option to edit the driver program ,best solution is to read from the driver program and fill the value in global variable or existing variable which is not being used.
Yes you can make use of this field if that field is not being used.Also try to include a comment when your filling the value ,so that in future if some one want to change or so ,they can come to know for what purpose you have used this field.
If not you can Create a new variable globally in driver progam and make use of it.
Cheers
Joginder
Edited by: Joginder on Jan 13, 2009 5:33 PM
Hi
If your using the bespoke driver program (Z program) then declare at the top as
data : v_text type (Use a data element from t052 table field).
Now
In the start of selection event where ever your fetching other data,at that place include selection of data ,ie after the vbdrk selection.
Then in the sapscript use the variable to display the same.
Hope this helps you to resolve the issue.
Cheers
Joginder
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.