Select command-example ABAP code to demonstrate the SELECT command

Source: Internet
Author: User
Select command-example ABAP code to demonstrate the SELECT command

The SELECT command is the most fundamental function of writing ABAP programs allowing the retrieval of data from SAP database tables. Below are a few examples of the various ways of selecting data.

   * Code to demonstrate SELECT command * Code to demonstrate select into internal table commandtypes: Begin of t_bkpf, * include structure bkpf. bukrs like bkpf-bukrs, belnr like bkpf-belnr, gjahr like bkpf-gjahr, bldat like bkpf-bldat, Monat like bkpf-Monat, budat like bkpf-budat, xblnr like bkpf-xblnr, awtyp like bkpf-awtyp, awkey like bkpf-awkey, end of t_bkpf.data: it_bkpf type standard table of t_bkpf initial size 0, wa_bkpf type begin: Begin of t_bseg, * include structure bseg. bukrs like callback-bukrs, belnr like bseg-belnr, gjahr like bseg-gjahr, buzei like callback-buzei, mwskz like bseg-mwskz, "Tax Code umsks like bseg-umsks, "Special g/L transaction type prctr like bseg-prctr," Profit centre hkont like bseg-hkont, "g/L account xauto like bseg-xauto, koart like bseg-koart, dmbtr like bseg-dmbtr, msort like bseg-m133, hwbas like bseg-hwbas, aufnr like bseg-aufnr, projk like bseg-projk, shkzg like bseg-shkzg, kokrs like bseg-kokrs, end of t_bseg.data: it_bseg type standard table of t_bseg initial size 0, wa_bseg type t_bseg.* Select directly into an internal table Select bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart dmbtr m1_hwbas aufnr projk shkzg kokrs from bseg into Table it_bseg. * Select directly into an internal table where fields are in a * different order or not all fields are specified Select bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart dmbtr m1_hwbas aufnr projk shkzg kokrs from bseg into corresponding fields of table it_bseg. * Select... endselect command Select bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart dmbtr m1_hwbas aufnr projk shkzg kokrs from bseg into wa_bseg. append wa_bseg to expires.* Select for all entries command Select bukrs belnr gjahr bldat Monat budat xblnr awtyp awkey up to 100 rows from bkpf into Table it_bkpf.if sy-subrc EQ 0. * The for all entries Comand only retrieves data which matches * entries within a special internal table. select bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart dmbtr m1_hwbas aufnr projk limit from limit into table limit for all entries in limit where limit EQ it_bkpf-bukrs and belnr EQ it_bkpf-belnr and gjahr EQ it_bkpf-gjahr.ENDIF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.