Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select quiery

Former Member
0 Likes
924

Hi everybody

plz help in writing select quiery

in the spec it given as

<b>'qals-matnr selected based on the inspection lot number qals-prueflos in transaction qa32 the matnr material number will include dashes. for example 0398-0457-08-c1 MAT NO = MATNO 0398-0457--08-c1.'</b>

can u plz me how to write this select statement.

regards

siri

9 REPLIES 9
Read only

Former Member
0 Likes
884

someone plz help me friends

regards

siri

Read only

0 Likes
884

<b>This is about all I could get out of the "Horrible" spec that you were given.

</b>



report zrich_0001.

data: xmatnr type qals-matnr.

parameters: p_ps type qals-prueflos.

select Single matnr into xmatnr
              from qals
                   where prueflos = p_ps.

  write:/ xmatnr.

Regards,

Rich Heilman

Comment on horrible spec

Message was edited by: Rich Heilman

Read only

0 Likes
884

Can you clarify your answer?

Read only

0 Likes
884

Rich,

You are too fast for me... lol Once again great minds thinking alike (see my reply above).

One other thing I noticed is that table QALS has multiple fields with data element MATNR. Not sure if SELMATNR or MATNR is the correct field, but I'd guess that it is MATNR.

Cheers,

James

Read only

0 Likes
884

James, the MATNR field does exists in this table. I can't really tell which field will actually hold the correct data as we do not use this file in my system. Table Records = 0

REgards,

Rich Heilman

Read only

Former Member
0 Likes
884

If this is the spec you got, then it is horrible. It doesn't talk about what to select from what tables using what conditions. The information <b>'matnr material number will include dashes. for example 0398-0457-08-c1 MAT NO = MATNO 0398-0457--08-c1.'</b> doesn't tell why that is given.

Please go back to the person who wrote the spec and ask for some more details.

Read only

0 Likes
884

Yes, like Srinivas says, go back to the person who wrote the spec and ask for some more details (and hit him too).

Read only

0 Likes
884

LOL!!!! Peluka, thanks, I needed that laugh today. I busted up laughing really loud after reading that. People were looking at me funny.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
884

Hi,

Try this:

parameters: p_lotnum type qplos.

data: wa_matnr type matnr.

select single selmatnr from qals into wa_matnr
   where prueflos = p_lotnum.
if sy-subrc ne 0.
*  handle "not found" case
endif.

The material number is just a character field, so I don't see how the dashes come into play. If table QALS already stores the material number with the dashes, then the value you select into wa_matnr will also have the dashes.

Best Regards,

James