Skip to Content
author's profile photo Former Member
Former Member

captch real value from select-option field while executing program

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Sep 24, 2014 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 24, 2014 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 24, 2014 at 06: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 ).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2014 at 06:50 AM

    Thanks all.Its working now.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.