on 07-28-2010 11:37 AM
I want to declare a variable in sapscript. I want it's value to be calculated from the program. Here is what I am doing.
Code in SAPScript:
DEFINE &LV_LEN& = ' '
PERFORM SUB_ALIGN IN PROGRAM ZCSVM_DEL_NOTE_JP
USING &W_HEADER-SHIP_TO_NAME4&
CHANGING &LV_LEN&
ENDPERFORM
IF &LV_LEN& = '3'
...........
...........
ENDIF
Code in Program ZCSVM_DEL_NOTE_JP:
FORM SUB_ALIGN TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA: LV_SHIP_TO_NAME4 TYPE c,
LV_LEN TYPE i.
READ TABLE in_tab INDEX 1.
WRITE in_tab-value TO LV_SHIP_TO_NAME4.
READ TABLE out_tab INDEX 1.
DESCRIBE FIELD LV_SHIP_TO_NAME4 LENGTH LV_LEN IN CHARACTER MODE.
out_tab-value = LV_LEN.
MODIFY out_tab INDEX 1.
ENDFORM.
The value of the field &W_HEADER-SHIP_TO_NAME4& is 500. So I want that LV_LEN will return 3. But it is not working. Maybe there is some declaration problem.
Can anybody please help me to solve this out?
Hi,
The declared varaible for name4 in subroutine LV_SHIP_TO_NAME4 is having only one character. define it LV_SHIP_TO_NAME4(4) type c.
Regards,
Chandra Kavali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for your suggestions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, what are you trying to obtain, actually,with this?
DESCRIBE FIELD LV_SHIP_TO_NAME4 LENGTH LV_LEN IN CHARACTER MODE.
That describes attributes of the data element, not the length of the data string. Is that you're trying to figure out? Do you want to know if the the number of digits in the length is 3?
if so:
data: data_length type i.
data_length = strlen( LV_SHIP_TO_NAME4 ).
if data_length ge 100.
lv_len = 3.
elseif data_length ge 10.
lv_lven = 2.
else.
lv_len = 1.
endif.
Is that what you're trying to do?
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.