09-24-2014 6:52 AM
Hello all,
I am working on a simple report but facing an problem in it.
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS : M_NO for MSEG-MATNR,
M_YEAR FOR MSEG-MJAHR.
SELECTION-SCREEN END OF BLOCK B1.
DATA : LEN TYPE I.
LEN = STRLEN( M_NO ).
WRITE: LEN.
when I select record for eg. if i select value 18 in m_no then LEN should display value 2.bute its showing 21.I have debuge the program M_NO taking the value 'AEQ000000000000000018'.can anyone please help me with this problem.
Thanks in advance.
09-24-2014 7:02 AM
Hi sam ,
As you have declared M_NO as matnr , hence its length will be 18 by default.
and you have to get value you need to use M_NO-LOW for it .
Try this code
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS : M_NO for MSEG-MATNR,
M_YEAR FOR MSEG-MJAHR.
SELECTION-SCREEN END OF BLOCK B1.
DATA : LEN TYPE I.
shift M_NO-low LEFT DELETING LEADING '0' .
LEN = STRLEN( M_NO-low ).
WRITE: LEN.
Regards
Yogendra Bhaskar
09-24-2014 7:02 AM
Hi sam ,
As you have declared M_NO as matnr , hence its length will be 18 by default.
and you have to get value you need to use M_NO-LOW for it .
Try this code
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS : M_NO for MSEG-MATNR,
M_YEAR FOR MSEG-MJAHR.
SELECTION-SCREEN END OF BLOCK B1.
DATA : LEN TYPE I.
shift M_NO-low LEFT DELETING LEADING '0' .
LEN = STRLEN( M_NO-low ).
WRITE: LEN.
Regards
Yogendra Bhaskar
09-24-2014 7:06 AM
The field MATNR carry a CONVERSION-EXIT,
External format (what you see/input) differs from internal value (field value in program, database)
So check domain MATNR to get correct conversion-exit (it is not always ALPHA, and there is at least one available customer exit available...) and use the associated FM to get external value (e.g. CONVERSION_EXIT_MATN1_OUTPUT, CONVERSION_EXIT_ALPHA) or a simple WRITE INTO statement to get back external value.
Also records of a RANGE/SELECT OPTIONS have a generic structure :
SIGN (Inclide/Exclude) OPTION (EQ, BT, etc.) LOW and HIGH, here you could check LOW value for EQ and LOW and HIGH for BT.
Why do you require this information, curiosity ?
Regards,
Raymond
09-24-2014 7:19 AM
Hi,
You can use
CONVERSION_EXIT_ALPHA_OUTPUT
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = M_NO-low
IMPORTING
OUTPUT = M_NO-low.
and then
LEN = STRLEN( M_NO-low ).
09-24-2014 7:50 AM