ERP Database - The Unofficial ERP Knowledge Base

Facebook Twitter del.icio.us Digg it
ERP Database contains a huge collection of articles related to ERP System and Software. Many of the articles are specifically related to SAP. All these ERP/SAP articles are freely available to everyone.

If you would like to submit an article or share any document related to ERP or any specific ERP software. Please mail it to support@erpdb.info. Please make sure that the documents are not copyrighted.
Social Bookmarks:

FIELD-GROUPS: Abap keyword a day

Print This Post Email This Post Written by admin on May 11th, 2011 | Filed under: ABAP Keywords

FIELD-GROUPS creates a field group for an extract dataset.

FIELD-GROUPS:

This statement would define a field group and these also define the actual line structure of extract dataset.

Here is a sample program to understand better.

REPORT  y_field_group.
 
TABLES:spfli,scarr, sflight, sbook.
 
SELECT-OPTIONS: mycarrid FOR spfli-carrid.
 
FIELD-GROUPS: header, spfli_fg, sflight_fg, sbook_fg.
 
INSERT: spfli-carrid  spfli-connid sflight-fldate sbook-bookid INTO header,
        spfli-carrid  spfli-connid spfli-cityfrom spfli-airpfrom
        spfli-cityto  spfli-airpto spfli-deptime  scarr-carrname INTO spfli_fg,
        sflight-fldate sflight-seatsmax sflight-seatsocc sflight-price INTO sflight_fg,
        sbook-bookid   sbook-customid  sbook-custtype sbook-smoker INTO sbook_fg.
 
SELECT * FROM spfli WHERE carrid IN mycarrid.
  SELECT SINGLE * FROM scarr WHERE carrid = spfli-carrid.
  EXTRACT spfli_fg.
 
  SELECT * FROM sflight
   WHERE carrid = spfli-carrid AND  connid = spfli-connid.
    EXTRACT sflight_fg.
 
    SELECT * FROM sbook
           WHERE carrid = sflight-carrid AND
           connid = sflight-connid AND fldate = sflight-fldate.
      EXTRACT sbook_fg.
      CLEAR sbook.
    ENDSELECT.
    CLEAR sflight.
  ENDSELECT.
  CLEAR spfli.
ENDSELECT.
 
SORT.
LOOP.
  AT spfli_fg.
    FORMAT COLOR COL_HEADING.
    WRITE: / scarr-carrname,
             spfli-connid, spfli-cityfrom,
             spfli-airpfrom, spfli-cityto, spfli-airpto, spfli-deptime.
    FORMAT COLOR OFF.
  ENDAT.
 
  AT sflight_fg.
    WRITE: /15 sflight-fldate, sflight-price, sflight-seatsmax,
               sflight-seatsocc.
  ENDAT.
 
  AT sbook_fg.
    WRITE: /30 sbook-bookid, sbook-customid,
                 sbook-custtype, sbook-smoker.
  ENDAT.
ENDLOOP.

sample source take from theguruspeaksaboutsap

Share

If you like this post, you may as well like these too:

  1. FIELD-SYMBOLS: ABAP Keyword a day FIELD-SYMBOLS: <fs>. FIELD-SYMBOLS: <fs> TYPE t. FIELD-SYMBOLS: <fs> TYPE LINE OF t. FIELD-SYMBOLS: <fs> LIKE s. FIELD-SYMBOLS: <fs> LIKE LINE OF s. Field Symbols are placeholders or symbolic names for...
  2. AT : ABAP Keyword a day AT Events in lists- AT LINE-SELECTION.- AT USER-COMMAND.- AT PFn.Events on selection screens- AT SELECTION-SCREEN.Control break with extracts- AT NEW f.- AT END OF f.- AT FIRST.- AT LAST.- AT...
  3. GET: ABAP Keyword a day GET: Event keyword for defining event blocks for reporting events. GET <node> [FIELDS <fi> <f 2>...]. GET node LATE [FIELDS f1 f2 ...]. Only occurs in executable programs. When the...
  4. DO : ABAP Keyword a day DO Variants 1. DO. 2. DO n TIMES. Variant 1 DO. Addition … VARYING f FROM f1 NEXT f2 Effect Repeats the processing enclosed by the DO and ENDDO statements...
  5. ASSIGN: ABAP Keyword a day ASSIGN Variants:1. ASSIGN f TO .2. ASSIGN (f) TO .3. ASSIGN TABLE FIELD (f) TO .4. ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TO .5. ASSIGN COMPONENT idx OF...
  6. FORM: ABAP Keyword a day FORM: Defines a subroutine. Syntax FORM [USING ... [VALUE(][)] [TYPE |LIKE ]„. ] [CHANGING... [VALUE(][)] [TYPE |LIKE ]„. ]. Introduces a subroutine. The USING and CHANGING additions define the subroutine’s...
  7. FETCH : ABAP Keyword a day FETCH Basic form FETCH NEXT CURSOR c target. Effect Uses the cursor c to read the next line or lines from the dataset of a database table determined by OPEN...
  8. ENDCASE : ABAP Keyword a day ENDCASE Basic form ENDCASE. Effect The ENDCASE statement closes a case disinction introduced by CASE ....
  9. DELETE : ABAP Keyword a day DELETE Delete from a database table - DELETE FROM dbtab WHERE condition. - DELETE FROM (dbtabname) WHERE condition. - DELETE dbtab. - DELETE *dbtab. - DELETE (dbtabname) … . -...
  10. CONTINUE: ABAP Keyword a day CONTINUE Basic formCONTINUE.EffectWithin loop structures like * DO … ENDDO* WHILE … ENDWHILE* LOOP … ENDLOOP* SELECT … ENDSELECTCONTINUE terminates the current loop pass, returns the processing to the beginning...
  11. CONCATENATE : ABAP Keyword a day CONCATENATE Basic form CONCATENATE f1 … fn INTO g. Addition … SEPARATED BY h Effect Places the fields f1 to fn after g . With the fields fi (1 <=...
  12. COMPUTE: ABAP Keyword a day COMPUTEBasic formCOMPUTE n = arithexp.EffectEvaluates the arithmetic expression arithexp and places the result in the field n .Allows use of the four basic calculation types + , – , *...
  13. CNT : ABAP Keyword a day CNT Basic form… CNT(h) …EffectCNT(h) is not a statement, but a field which is automatically created and filled by the system if f is a sub-field of an extract dataset...
  14. CASE: ABAP Keyword a day CASE Basic formCASE f. Effect Case distinction.Depending on the current contents of a field, this statement executes one of several alternative processing branches. The field whose contents determine how the...
  15. GET PARAMETER: ABAP Keyword a day GET PARAMETER Gets an SPA/GPA parameters. Syntax GET PARAMETER ID <pid> FIELD <field_name>. Writes the value of the SPA/GPA parameter <pid> from the user-specific SAP memory into the variable <f>....



Leave a Reply