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

Prob in Select stmt

I have wrote the following select query

Already my final Internal table contains Material number

SELECT matnr

FROM ekpo

INTO TABLE t_ekpo

FOR ALL ENTRIES IN t_final

WHERE konnr IN s_konnr

AND matnr EQ t_final-number

AND matkl IN s_matkl

AND meins IN s_meins

AND bstyp = c_k.

IF sy-subrc EQ 0.

SORT t_ekpo BY matnr.

ENDIF.

In select option i have entered a valid Konnr which have material number(in t_final) I am not getting any Material numbers.

Sy-subrc =4

Can anyone tell me where is the problem?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Jul 23, 2008 at 06:27 AM

    Madan,

    just modify your query like this:

    SELECT matnr
    FROM ekpo
    INTO TABLE t_ekpo
    FOR ALL ENTRIES IN t_final
    WHERE konnr IN s_konnr
    AND matnr EQ t_final-number
    AND matkl IN s_matkl
    AND meins IN s_meins
    AND bstyp = 'C_K'."should be in caps
    IF sy-subrc EQ 0.
    SORT t_ekpo BY matnr.
    ENDIF.

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 06:28 AM

    hi,

    Since you say u have matching konnr for the s_konnr you enter :

    Check if you have any matnr from ekpo matching the values in t_final-number. If there is no matching matnr in ekpo when compared to the matnr in internal table then there is a possibility of select to have sy-subrc = 4.

    regards,

    madhu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 06:29 AM

    hiiii

    check before this select statement that t_final is initial or not then use this select query..also check with the table taht wether that particular data exist with the same data you are entering on selection screen..check with following code

    SELECT matnr                         " Material Number
        FROM mara
        INTO TABLE t_final
       WHERE matnr IN s_matnr.
    
      IF t_final[] IS NOT INITIAL.
        SELECT matnr
    FROM ekpo
    INTO TABLE t_ekpo
    FOR ALL ENTRIES IN t_final
    WHERE matnr EQ t_final-number
    AND matkl IN s_matkl
    AND konnr IN s_konnr
    AND meins IN s_meins
    AND bstyp = c_k.
    ENDIF.
    
    IF sy-subrc EQ 0.
    SORT t_ekpo BY matnr.
    ENDIF.
    
      ENDIF.

    regards

    twinkal

    Edited by: twinkal patel on Jul 23, 2008 8:29 AM

    Edited by: twinkal patel on Jul 23, 2008 8:30 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Twinkel,

      thanks for replying and giving time to SDNers.

      but i would suggest you that pls once you sure than only put your thoughts in forum you wrote:

      check before this select statement that t_final is initial or not then use this select query

      if the internal table is blank on which you are using for all entries than no data is suppose to fetch or all data will be fetch pls confirm than reply.

      because in future from this thread some other person may also can take help so pls donot create misleads.

      hope you dont hurt.

      Amit.

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 06:31 AM

    Hi,

    when you are using for all entries in select statement.. either select fields should contain all the key fields or in where clause it should contain all the key fields where as u r select query on table EKPO either in select clause or in where clause u have not mentioned any key fields rectify it.

    regards,

    Sunil Kumar Mutyala

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi,

    you have to mention bstyp in CAPSLOCK.

    any Types i.e., Document type ,Material type ,BOM type has to be mentioned in CAPSLOCK.

    Hope this will solve your problem.

    Regards,

    sharmishta.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 23, 2008 at 06:32 AM

    Hi,

    Please check wether c_k = 'K'. - Capital K. If you see domain BSTYP, there will be value ranges which are A,B,F,I,K,L,Q,W.

    Regards,

    Sukhbold

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi Madan,

    i think the problem is with ekpo just check whether the same Konnr is availble in ekpo also or not. ithink c_k is constant so no need to have it in capital only pretty printer will do it for u if necessary. also check the Matkl, meins and Bstyp = c_k are their in ekpo corresponds to Konnr you are entering in the screen.

    hope this will help

    Thanks

    Ankur

    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.