Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Ranges, Field groups

Former Member
0 Likes
955

Hi all,

Here i have some doubts, Please clarify these....

1. What are ranges? What are number ranges?

2. What is the "component idx of structure" clause with field groups?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
930

Hi,

Check this link for details about ranges and FieldGroups.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
930

Ranges are like select-options on the selection screen. The function the same way without the selection screen. You can use the IN statement with ranges as you can with select-options. Number ranges are pre-defined ranges of numbers setup to be assigned to certain documents in the system. For example. SD Documents have a specific number range set up that when an order is created, it assigns that next available number in the range to the SD document. You can see these via transaction SNRO.

compoent idx of structure is used with field symbols for accessing certain parts or components of something else. More used when you are dealing with dynamic tables and structures.

Regards,

Rich Heilman

Read only

0 Likes
930

Hi, Rich Heilman.

This question <u>Have you used "component idx of structure" clause with field groups? </u> puzzles me. After reading your answer, I think this question should be '<b>with field symbols</b>'. Am I right?

Regards,

feng.

Message was edited by:

feng zhang

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
931

Hi,

Check this link for details about ranges and FieldGroups.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm

Read only

andreas_mann3
Active Contributor
0 Likes
930

Hi ,

use assign component for big structures like bseg

(e.g. for that transfer)


 LOOP AT itab.
  clear str.    
  DO. 
  ASSIGN COMPONENT sy-index OF STRUCTURE itab TO <fw>. 
  IF sy-subrc <> 0.        EXIT.      ENDIF.     
   CONCATENATE str <fw> INTO str SEPARATED BY space.    
  ENDDO.   
 transfer str to file. 
 ENDLOOP.

Read only

Former Member
0 Likes
930

Hi,

A hint on Number Ranges:

Tcode SNRO us used for maintaining number ranges.

The 'NUMBER_GET_NEXT' FM Gets the next unique number in a number range.

While Range is:

RANGES sel FOR f.

Which is similar to:

DATA: BEGIN OF sel OCCURS 10,
         SIGN(1),
         OPTION(2),
         LOW  LIKE f,
         HIGH LIKE f,
      END   OF sel.

Regards,

Anjali

Read only

Manohar2u
Active Contributor
0 Likes
930

Deleted

Message was edited by: Manohar Reddy

Read only

Former Member
0 Likes
930

Hai Surya

Check the following Document

Basic form

RANGES sel FOR f.

Effect

Defines an internal table similar to a selection criterion sel defined using the SELECT-OPTIONS sel FOR f statement.

The above statement is identical to:

DATA: BEGIN OF sel OCCURS 10,

SIGN(1),

OPTION(2),

LOW LIKE f,

HIGH LIKE f,

END OF sel.

Note

If you use the IN operator in conjunction with SUBMIT , CHECK , IF , WHILE or SELECT , always define the associated internal table using SELECT-OPTIONS or RANGES (never directly).

Addition

... OCCURS occ

Effect

Changes the OCCURS value 10 to the value of occ .

Field Groups

Basic form

FIELD-GROUPS fg.

Effect

Defines a field group.

A field group combines several existing fields together under one name. You use the INSERT statement to determine which fields belong to a field group at runtime.

Example

FIELD-GROUPS: HEADER, ORDER, PRODUCT.

Note

Neither defining a field group (statically) using FIELD-GROUPS nor filling a field group (dynamically) with INSERT generates more memory. Rather, there exists for each field group element a pointer to an (existing) field.

Example

LOOP AT itab.

clear str.

DO.

ASSIGN COMPONENT sy-index OF STRUCTURE itab TO <fw>.

IF sy-subrc <> 0. EXIT. ENDIF.

CONCATENATE str <fw> INTO str SEPARATED BY space.

ENDDO.

transfer str to file.

ENDLOOP.

Thanks & regards

Sreenivasulu P