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


Please Help Members By Posting Answers For Below Questions

What is the difference between synchronous and asynchronous update?

650


What are the page headers for secondary lists?

610


how 2 create the normal form by using functional module

2140


Explain the advantages of abap query tool?

530


What is the max no of match code id's that can be defined for one match code object? : abap data dictionary

654






Name the special commands of list?

616


What are the system table used in abap?

594


What is the client concept in sap?

558


WHAT ARE THE INPUT PARAMETERS TO BE PASSED FOR THE BAPIS 'BAPI_CUSTMATINFO_GETDETAILM' AND 'BAPI_CUSTMATINFO_GETLIST'

1775


What is the difference between getting and get late?

593


What is the use of at new statement ?

1360


What is the difference between a structure and a table? : abap data dictionary

616


Business scenarios related to your objects( In my case -Rulebook and Pricing work flow)

845


What does the ‘suppress dialog’ do?

872


Explain what is the significance of hide?

536