Brought to you by - Ajay Dated – 14-04-2009

Exercise-1 : a) create table ZAM_MARA1 with all 230 fields of MARA b) fetch first 5000 rows from MARA and put into ZAM_MARA1 + name and s ex. c) When rows are inserted into ZAM_MARA1, need pop up displaying ‘Inserted successfully!’ Steps to create ZAM_MARA1 table1. Navigate to SE11 TCODE to create table. Type the table to copy: MARA.

2. Use CTRL+ F5 to copy.

3. Provide the Custom Table as shown and press Enter.

4. Create the Object Directory Entry: $TMP

5. Now click on Display button.

6. Activate the newly created table.

7. Select your object name: ZAM_MARA1 and press ENTER.

8. The Language will be German. Click on change to change the language.

9. Click on Change orig. Language button as shown.

10. Click on Continue.

11. You may get the screen below. Simply hit Enter.

12. Activate the table again.

*&--------------------------------------------------------------------* *& Report ZAM_INSRMARA *& *&--------------------------------------------------------------------* *& Exercise-1 : *& a) create table ZAM_MARA1 with all 230 fields of MARA *& b) fetch first 5000 rows from MARA and put into ZAM_MARA1 + name and sex. *& c) When rows are inserted into ZAM_MARA1, need pop up displaying ‘Inserted successfully!’ *&--------------------------------------------------------------------* REPORT zam_insrmara NO STANDARD PAGE HEADING. *********************************************************************** * * D A T A D E C L A R A T I O N S * *********************************************************************** * *DATA: it_mara TYPE STANDARD TABLE OF mara, * wa_mara TYPE mara. DATA: it_mat TYPE STANDARD TABLE OF zam_mara1, wa_mat TYPE zam_mara1. DELETE FROM zam_mara1. IF SY-SUBRC = 0. WRITE: / 'DELETED'. ENDIF. SELECT * FROM mara INTO TABLE it_mat up to 5000 rows. " select first 5000 rows from MARA and store in internal table: IT_MAT if sy-subrc = 0. " If SELECT stmt returns success = 'O' then continue LOOP AT it_mat INTO wa_mat. * wa_mat = wa_mara. wa_mat-zzsex = 'M'. wa_mat-zzmy_name = 'Ajay Mukundan'. MODIFY it_mat FROM wa_mat. endloop. INSERT zam_mara1 FROM table it_mat . "Note syntax: INSERT target_tab F ROM TABLE source_tab, where source_tab is internal table if sy-subrc = 0. * Created Message class: zam_sucins MESSAGE i000(zam_sucins)." Rows Inserted Successfully!

ENDIF. endif.

OUTPUT:

Sign up to vote on this title
UsefulNot useful