| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
Insert data into the database table using ClassesBy Vikram Chellappa, Mouri Tech Solutions Go to Class Builder and create a new class
Provide the method name.
Go to parameters and provide the attributes.
Go back to methods. And provide the logic by double click on the method name.
Then save it, check it, activate it and execute it.
Press F8. The data is stored in database. To verify, go to VBAK table (SE16) and check whether the data is stored or not.
Now we will create a program using the above class for inserting the data into the database table. Go to SE38 and create a program.
Select create button. After that provide the following logic. *&---------------------------------------------------------------------* *& Report ZPG_INSERTINTODB * *& * *&---------------------------------------------------------------------* *& * *& * *&---------------------------------------------------------------------* REPORT ZPG_INSERTINTODB.
*provide the object for the class
DATA: OBJ_INSERT TYPE REF TO ZCL_INSERTDB.
*provide parameters
PARAMETERS: V_VBELN TYPE VBELN,
V_ERDAT TYPE ERDAT,
V_ERZET TYPE ERZET.
*provide work area
DATA: WA TYPE VBAK.
*create the object
START-OF-SELECTION.
CREATE OBJECT OBJ_INSERT.
*provide insert method
CALL METHOD OBJ_INSERT->INSERT_DATA
*provide exporting parameters
EXPORTING
P_VBELN = V_VBELN
P_ERDAT = V_ERDAT
P_ERZET = V_ERZET
*provide import parameters
IMPORTING
WA_VBAK = WA.
*display the data.
WRITE:/ WA-VBELN,
WA-ERDAT,
WA-ERZET.
Save it , activate it, execute it . The screen is like this.
Provide values.
Execute it.
Following is the sample output of the same:
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||