Hi,
I have 100 records in a table, how to read every 7Th record
each in that...
Answer Posted / vamshi reddy chaduvu
Try this sample code..........
REPORT ZHGSL__TEST.
DATA: IT_KNA1 TYPE STANDARD TABLE OF KNA1,
IT_KNA2 TYPE STANDARD TABLE OF KNA1,
WA_KNA1 LIKE LINE OF IT_KNA1.
DATA: T TYPE I.
SELECT * FROM KNA1 INTO TABLE IT_KNA1 UP TO 100 ROWS.
DO .
T = SY-INDEX * 7.
READ TABLE IT_KNA1 INTO WA_KNA1 INDEX T .
IF SY-SUBRC EQ 0.
APPEND WA_KNA1 TO IT_KNA2.
ELSE.
EXIT.
ENDIF.
ENDDO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_STRUCTURE_NAME = 'KNA1'
TABLES
T_OUTTAB = IT_KNA2
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
| Is This Answer Correct ? | 37 Yes | 1 No |
Post New Answer View All Answers
What are the advantages of logical databases?
What is For-period and In-period
What data is contained? : abap data dictionary
What are the types of records that are transferred to sap r/3 and used by interfaces? : abap bdc
What is Field group?
What are two methods of modifying sap standard tables?
What does a lock object involve?
What is the function module for INDIAN PAYROLL to read table cluster for given cluster table and sequence number?
What are secondary indexes. How can we know which index is being used in a select query?
Can we control the sequence in which multiple implementations of a multiple use BADI are called? If yes, how?
A function module can be called from a transaction screen outside an abap/4 program. State true or false. : abap modularization
Explain the difference between open_form and close_form?
What are the two ways of producing a list within a transaction?
Which type of tables used this buffer?
Can we create a gui status in a program from the object browser?