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

my code is not working tell me the answer

DATA: BEGIN OF ITAB OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MATKL LIKE MARA-MATKL,

UOM LIKE MARA-MEINS,

LAEDA LIKE MARA-LAEDA,

END OF ITAB.

DATA: WA_ITAB LIKE LINE OF ITAB.

SELECT MATKL FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'.

LOOP AT ITAB INTO WA_ITAB.

WRITE : WA_ITAB-MATKL.

ENDLOOP.

it is syntically correct but o/p is not coming

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

14 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:32 AM

    Hi Ansuman,

    Please check this

    MATNR = '000000000000521196'.

    Please check wheather the ITAB is getting populated or not.

    Best regards,

    raam

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:30 AM

    Write your select stmt this way.

    SELECT MATKL FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR = '521196'.

    REGARDS,

    aZAD.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:30 AM

    Hi,

    Write INTO CORRESPONDING FIELDS OF ITAB.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:32 AM

    HI,

    change the internal table structure to the retriving variables in SELECT conditon.

    DATA: BEGIN OF ITAB OCCURS 0,
    MATKL LIKE MARA-MATKL,
    END OF ITAB.

    or change the select condition

    SELECT MATNR 
               MTART
              MATKL
         UOM
          LAEDA
            FROM MARA 
       INTO TABLE ITAB 
    WHERE MATNR = '521196'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:32 AM

    Hi,

    The length of the matnr is 18 and the value you are passing is not equal to length of the matnr, add zeros infront of the matnr you passed or conversion exit.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 16, 2008 at 06:32 AM

    Hi,

    your code is ok make but requires some changes

    DATA: BEGIN OF ITAB OCCURS 0,
    MATNR LIKE MARA-MATNR,
    MTART LIKE MARA-MTART,
    MATKL LIKE MARA-MATKL,
    UOM LIKE MARA-MEINS,
    LAEDA LIKE MARA-LAEDA,
    END OF ITAB.
    
    
    DATA: WA_ITAB LIKE LINE OF ITAB.
    
    
    SELECT MATKL FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'.
    
    LOOP AT ITAB.
    WRITE : ITAB-MATKL.
    ENDLOOP.

    Either use the table with header line or with work area.

    Regards

    Adil

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:33 AM

    either use 'into corresponding fields of ' addition or write the query as follows....

    SELECT MATNR MTART MATKL MEINS LAEDA FROM MARA INTO TABLE ITAB WHERE MATNR = '521196'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:34 AM

    hi,

    Do like this.

    DATA: BEGIN OF ITAB OCCURS 0,

    MATNR LIKE MARA-MATNR,

    MTART LIKE MARA-MTART,

    MATKL LIKE MARA-MATKL,

    UOM LIKE MARA-MEINS,

    LAEDA LIKE MARA-LAEDA,

    END OF ITAB.

    DATA: WA_ITAB LIKE LINE OF ITAB.

    SELECT MATKL FROM MARA INTO CORRESPONDING FIELDS FOF TABLE ITAB WHERE MATNR = '521196'.

    IF SY-SUBRC = 0. // see whether subrc is 0 or not if it is 0 then ur select stmt is right , eventhough u r not getting data into internal table may be data is not available in table mara.LOOP AT ITAB INTO WA_ITAB.

    WRITE : WA_ITAB-MATKL.

    ENDLOOP.

    ENDIF.

    Rgds.

    subash

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:35 AM

    Before passing the value in to select condition,

    pass the value to FM: CONVERSION_EXIT_MATN1_INPUT and pass this value to Select.

    In select condition INTO CORRESPONDING FIELDS OF TABLE should be used instead of INTO TABLE.

    Regards

    Kannaiah

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 06:38 AM

    plz check whether in the database table there exist a value which you have given in the where clause.

    that is in the database it is not satisfying the where clause

    write this loop at itab into wa.

    dont give where clause fr the time being

    if value comes then give where clause with where clause and check...

    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.