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

Shall I use SELECT SINGLE??

Iu2019ve retrieved MSEG-MATNR for the condition mseg-mblnr = material doc no. and mseg-mjahr = mat doc year and mseg-zeile = mat doc item.

And my retrieved data mseg data in i_mseg is like below:

Mblnru2026u2026u2026..mjahru2026..zeilen.u2026u2026.matnr

0049000242....1995......0003........YY-110

0049000242u2026.1995u2026u20260004u2026u2026.YY-120

0049000248....1995u2026u20260001u2026u2026..40-110C

0049000248u2026.1995u2026u20260002........40-200C

0049000248u2026.1995u2026u20260003........40-210

0049000248u2026.1995u2026u20260004........L-40C

Now Iu2019ll have to fetch:

MAKT-MAKTX for the condition MAKT-MATNR=MSEG-MATNR and MAKT-SPRAS = u2018ENu2019.

Shall I use select single or normal select queries for makt-maktx retrieval?

If select single, then why and if not, then why?

Can anyone please guide?

Regards.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2009 at 02:29 PM

    You can retrive material texts for all the materials retreived in your table by using Select..for all entries....

    Please let me knwo if this helps!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2009 at 02:57 PM

    Hi,

    It depends of how many records you expect to read. If you have a reduced amount of records I would expect for the join statement to underperform, even if the access to the data bank is faster.

    But at a considerable amount of data the join might be a lot faster. Use the tc SM30 to test your code.

    This is a test script (for development system):

    TABLES: mseg, makt.
    
    SELECT-OPTIONS: s_mblnr FOR mseg-mblnr,
                    s_mjahr FOR mseg-mjahr,
                    s_zeile FOR mseg-zeile.
    PARAMETERS p_join AS CHECKBOX.
    
    DATA: BEGIN OF l_mseg,
            mblnr LIKE mseg-mblnr,
            maktx LIKE makt-maktx,
          END OF l_mseg.
    
    START-OF-SELECTION.
      DO 10000 TIMES.
        IF p_join IS INITIAL.
          SELECT mblnr INTO l_mseg-mblnr FROM mseg WHERE mblnr IN s_mblnr 
                                AND mjahr IN s_mjahr AND zeile IN s_zeile.
            SELECT SINGLE maktx INTO l_mseg-maktx FROM makt 
                                       WHERE matnr EQ mseg-matnr AND spras = sy-langu.
          ENDSELECT.
        ELSE.
          SELECT mblnr maktx INTO l_mseg
                   FROM mseg JOIN makt ON makt~matnr = mseg~matnr
                   WHERE mblnr IN s_mblnr AND mjahr IN s_mjahr AND zeile IN s_zeile
                   AND spras = sy-langu.
          ENDSELECT.
        ENDIF.
      ENDDO.
    

    regards,

    Edgar

    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.