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
Explain the differences between at selection-screen and at selection-screen output?
Mention what is alv programming in abap?
How do you use tab sets in layout sets?
How to create report in SD open sales order which covers all Organization, delivery status, shipping details and partner function details. plz mention the detail coding Tahnks, Rahul
What is the different between template and a table?
What is the maximum number of match code id's that can be defined for one match code object ?
B -Credit Note report Selection Screen Ranges: Creation date Sales Org Sold to Party Selection condition: Document Category – VBTYP should be ‘O’ Table to be used: VBRK, VBRP,VBPA,ADRC List the CR order types or credit billing type by customer number (or selected customer) and displays the: - Billing Document date (FKDAT) - Customer number (KUNRG) - Name of the reseller (on top of the SAP No) (NAME1) - Billing document number,(VBELN) - order reason (AUGRU_AUFT) - Amount (NETWR) - Currency (WAERK) Group Currency wise, billing type wise sum of Net value. When user double click on field ‘Billing Document #’ , display the document in VF03 Do this using OO ABAP.
While sorting field groups we cannot use more than one key field. State true or false. : abap modularization
What are system variable in abap?
What is the lock object?
Explain how to Handle the internal tables in ABAP?
What is the structure of the bdc table? : abap bdc
What is the differences between structure and table in data dictionary in abap?
What are logical data bases used in hr module? : abap hr
What is transparent table?