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

for all entries.

Hi all,

My requirement is to fetch data from MSEG which is not present in Z table.

I think i should use for all entries.

common fields for these tables are mblnr and mjahr.

But its not clear with exact code ...

can u please help me with the same.

Points will be rewarded.

Regards,

Siddhi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:24 AM

    Hi Siddi,

    You said the requirement is to fetch data from MSEG which is not present in Z table. Can you be more clear on this?

    Regards,

    Swapna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:24 AM

    Hi,

    You Can Select the data from MSEG Like

    First Select the records from ztable into intrernal table itab1.

    After -

    Select * from MSEG

    into table itab2

    for all entries in itab1

    where mblnr = itab1-mblnr

    and mjahr = itab1-mjahr.

    Hop it will solve your problem.

    Regards,

    Sujit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:25 AM

    Fetch the Data from Ztable.

    Fetch the data from MSEG.

    Loop on MSEG Itable and Read the Ztable.

    If sy-subrc = 0.

    delete the entry from MSEG ITAB.

    end if.

    The For all entries could be used if you want data from MSEG for all matching emtries in ZTABLE.

    But yorus is the reverse case.

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:26 AM

    Hi Siddhi,

    Be Clear with your question.

    Regards,

    Chandra Sekhar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:26 AM

    hi,

    If you have to pick data which is not present in Z_table then i think For All Entries is not a good idea.

    For All Entries Pick the entries for the Records which are Present in eithe rof the table but which are not present in one table.

    Please try other option or use Simple Select Query and Check the record is present in Z_table or not.

    Hope this will Help.

    Reward if Useful.

    Sumit Agarwal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:26 AM

    Hi,

    select * from mseg into table t_mseg where mblnr = p_mblnr .

    if t_mseg[] is not initial.

    *select * from mseg*

    into table ztable for all entires in

    t_mseg where mblnr = t_mesg-mblnr and mjahr = t_mseg-mjahr.

    endif.

    Reward if helpful.

    Best Wishes,

    Chandralekha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:30 AM

    Hello dost,

    First of all i want to tell you about For all entires:

    We use this to take all the corresponding data from the database table in comparision of some internal table which is allready filed with some fields.

    That means you require more field in corresponding of your allready filed fields.

    data itab type table of mseg.

    IF itab1 is not initial.

    SELECT * from MSEG

    into table itab

    for all entries in itab1

    where mblnr = itab1-mblnr

    and mjahr = itab1-mjahr.

    endif.

    ****itab1 should not be empty.

    I think this is more clear for you.

    please rewards if think this fine.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:33 AM

    Hi,

    When you want to get records related to ZTABLE from MSEG then we can use FOR ALL ENTRIES of Ztable. But here you want is records that are not present in Ztable.

    First you SELECT data from both tables.

    Select  mblnr
               mjahr
       from  ztab 
        into  table t_ztab.
    
    
    select mblnr
              mjahr
              zeile
             bwart 
      from mseg
      into  table t_mseg.
    
    
    Loop at t_ztable.
      read table t_mseg with key mblnr = t_ztable-mblnr
                                              mjahr = t_ztable-mjahr.
      if sy-subrc eq 0.
        delete t_mseg.
      endif.
    endloop.
    
    loop at t_mseg.
      write : / mblnr,
                  mjahr,
                 zeile,
                 bwart.
    endloop.

    noe the records which are not ther in t_ztable will be displayed .

    Regards,

    Rajitha.

    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.