Select statements

select * from mara 
        where spart = 'PA'
          and not ( zatacd = space ) 
        order by matnr.

Gets information from Confirmed schedule file (EKES)

Illustrates the usage of group by:

  
   select ebeln eindt vbeln
            into (po_ebeln, po_eindt, po_vbeln)
            from ekes
            where ebeln = wa_vbfa-vbeln
            group by ebeln eindt vbeln.

Joining the vendor files (LFA1 and LFB1)
This outputs the fields into a table named TAB
 select a1~sortl a1~name1 a1~name2
a1~pstlz a1~ort01 a1~regio a1~pfach
a1~land1 a1~lifnr a1~stras
from lfa1 as a1 join lfb1 as b1
on a1~lifnr = b1~lifnr
into tab
where a1~lifnr in s_lifnr
and a1~loevm <> 'X'
and b1~bukrs in s_bukrs
and b1~loevm <> 'X'. Joining MARA and MBEW the material master and the accounting view by plant (gets plant cost for an item) s_werks for mvke-dwerk obligatory. " Plant select marc~matnr marc~werks marc~disgr mbew~salk3 into table t_marc from marc join mbew on ( mbew~bwkey = marc~werks and mbew~matnr = marc~matnr ) where werks in s_werks.

Joining VBAP and VBUP

This produces a list of open line items

loop at itab_vbak.
 select
  vbap~vbeln vbap~posnr vbap~matnr vbap~kwmeng vbap~werks vbap~arktx
  into bolines
  from vbap join vbup
  on ( vbap~vbeln = vbup~vbeln and vbap~posnr = vbup~posnr )
  where vbap~vbeln = itab_vbak-vbeln
  and lfsta = 'C'.
 endselect.
Table ITAB_VBAK contains a list of open orders.



Return to ABAP help


[Our portfolio] [A history of Computers and Networks]
[Perl help] [ABAP help] [MySQL help]
[TCP/IP troubleshooting] [HTML help] [Feedback] [Humor]
Advertise on Golden Ink's Georgia Network


In Association with Amazon.com