SAP ABAP

Archive for May 31st, 2007

Learn Object Oriented ABAP online and Download Object Oriented ABAP Tutorial

http://www.savefile.com/files/768258

SAP SD Transaction codes List
I found a way to know hidden customizing Tcodes.

Before executing customizing task you desire, point it and go to Edit-Display IMG Activity. Then mark activity.

Go to T.Code se16 and type in CUS_IMGACH table.
Execute.
Paste IMG Activity and run.
You will see Tcode that belongs to IMG Activity.

SAP SD Tips by: Javier

The most frequently used transaction codes are as follows:
1. VS00 – Master data
2. VC00 – Sales Support
3. VA00 – Sales
4. VL00 – Shipping
5. VT00 – Transportation
6. VF00 – Billing

Others as follows:
At Configuration:
1. VOV8 – Define Sales documents type (header)
2. OVAZ – Assigning Sales area to sales documents type
3. OVAU – Order reasons
4. VOV4 – Assign Item categoreies(Item cat determination)
5. VOV6 – Scedule line categories
6. OVAL – To assign blocks to relevant sales documents type
7. OVLK – Define delivery types
8. V/06 – Pricing
9. V/08 – Maintain pricing procedure
10.OVKP – Pricing proc determination
11.V/07 – Access sequence

Enduser:
1. Customer Master Creation-VD01 and XD01 (for full inclu company code)
VD02 – Change Customer
VD03 – Display Customer
VD04 – Customer Account Changes
VD06 – Flag for Deletion Customer
XD01 – Create Customer
XD02 – Modify Customer
XD03 – Display Customer
2. Create Other material —-MM00
3. VB11- To create material determination condition record
4. CO09- Material availability Overview
5. VL01 – Create outbound delivery with ref sales order
6. VL04 – Collective processing of delivery
7. VA11 – Create Inquiry
VA12 – Change Inquiry
VA13 – Display Inquiry

Sales & Distribution
Sales order / Quote / Sched Agreement / Contract
· VA01 – Create Order
· VA02 – Change Order
· VA03 – Display Order
· VA02 – Sales order change
· VA05 – List of sales orders
· VA32 – Scheduling agreement change
· VA42 – Contract change
· VA21 – Create Quotation
· VA22 – Change Quotation
· VA23 – Display Quotation

Billing
· VF02 – Change billing document
· VF11 – Cancel Billing document
· VF04 – Billing due list
· FBL5N – Display Customer invoices by line
· FBL1N – Display Vendor invoices by line

Delivery
· VL02N – Change delivery document
· VL04 – Delivery due list
· VKM5 – List of deliveries
· VL06G – List of outbound deliveries for goods issue
· VL06P – List of outbound deliveries for picking
· VL09 – Cancel goods issue
· VT02N – Change shipment
· VT70 – Output for shipments

General
· VKM3, VKM4 – List of sales documents
· VKM1 – List of blocked SD documents
· VD52 – Material Determination

*&———————————————————————*
*& Report ZSPOOLTOPDF *
*& *
*&———————————————————————*
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& *
*& Execution *
*& ——— *
*& This program can be run in background or online and a spool request *
*& will still be created *
*&———————————————————————*
REPORT zspooltopdf.

PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT ‘mavsar@gmail.com’,
p_sender LIKE somlreci1-receiver
DEFAULT ‘mavsar@gmail.com’,
p_delspl AS CHECKBOX,
p_online no-display.

*DATA DECLARATION
DATA: gd_recsize TYPE i.

* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.

* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.

DATA: w_recsize TYPE i,
w_spool_nr like sy-spono.
* %_print LIKE pri_params.

DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.

* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.

* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.

CONSTANTS: c_dev LIKE sy-sysid VALUE ‘DEV’,
c_no(1) TYPE c VALUE ‘ ‘,
c_device(4) TYPE c VALUE ‘LOCL’.

************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE ‘Hello World’.
new-page.
commit work.
new-page print off.

If p_online = ‘X’.
* Processing performed when program calls itself when run online
gd_spool_nr = sy-spono.
EXPORT gd_spool_nr TO MEMORY ID ‘SPOOLTOPDF’.
EXIT.
endif.

IF sy-batch EQ ‘X’.
PERFORM get_job_details.
PERFORM obtain_spool_id.
ELSE.
gd_spool_nr = sy-spono.

************************************
* If executed online, it submits a program to perform the write
* statements
* instructing it to create a spool request, this could be another
* program
* which just performs the write statements and then exports sy-spono
* to memory. But in this example it calls itself passing X to parameter
* p_online, which takes it down an alternative procesing path.
submit ZSPOOLTOPDF
with p_online = ‘X’
to sap-spool
spool parameters %_print
* archive parameters %_print
without spool dynpro
and return.
************************************
ENDIF.

* Get spool id from program called above
IMPORT gd_spool_nr FROM MEMORY ID ‘SPOOLTOPDF’.

PERFORM convert_spool_to_pdf.
PERFORM process_email.

if p_delspl EQ ‘X’.
PERFORM delete_spool.
endif.

IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = ‘INT’
WITH output = ‘X’
AND RETURN.
ENDIF.

*———————————————————————*
* FORM obtain_spool_id *
*———————————————————————*
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).

SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident ‘0000000000′
ORDER BY jobname
jobcount
stepcount.

READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.

*———————————————————————*
* FORM get_job_details *
*———————————————————————*
FORM get_job_details.
* Get current job details
CALL FUNCTION ‘GET_JOB_RUNTIME_INFO’
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.

*———————————————————————*
* FORM convert_spool_to_pdf *
*———————————————————————*
FORM convert_spool_to_pdf.

CALL FUNCTION ‘CONVERT_ABAPSPOOLJOB_2_PDF’
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.

CHECK sy-subrc = 0.

* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ‘ ~’.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.

TRANSLATE gd_buffer USING ‘~ ‘.

DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.

*———————————————————————*
* FORM process_email *
*———————————————————————*
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM.

*———————————————————————*
* FORM send_email *
*———————————————————————*
* –> p_email *
*———————————————————————*
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).

REFRESH it_mess_bod.

* Default subject matter
gd_subject = ‘Subject’.
gd_attachment_desc = ‘Attachname’.
* CONCATENATE ‘attach_name’ ‘ ‘ INTO gd_attachment_name.
it_mess_bod = ‘Message Body text, line 1′.
APPEND it_mess_bod.
it_mess_bod = ‘Message Body text, line 2…’.
APPEND it_mess_bod.

* If no sender specified – default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = ‘INT’.
ENDIF.

* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
‘Example .xls documnet attachment’
‘PDF’
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.

*———————————————————————*
* FORM delete_spool *
*———————————————————————*
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.

ld_spool_nr = gd_spool_nr.

CHECK p_delspl c_no.
CALL FUNCTION ‘RSPO_R_RDELETE_SPOOLREQ’
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.

*&———————————————————————*
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
*&———————————————————————*
* Send email
*———————————————————————-*
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.

DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.

data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.

ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.

* Fill the document data.
w_doc_data-doc_size = 1.

* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = ‘SAPRPT’.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = ‘F’.

* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt – 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = ‘SAPRPT’.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = ‘F’.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].

* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = ‘RAW’.
APPEND t_packing_list.

* Create attachment notification
t_packing_list-transf_bin = ‘X’.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.

DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.

* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = ‘U’.
t_receivers-com_type = ‘INT’.
t_receivers-notif_del = ‘X’.
t_receivers-notif_ndel = ‘X’.
APPEND t_receivers.

CALL FUNCTION ‘SO_DOCUMENT_SEND_API1′
EXPORTING
document_data = w_doc_data
put_in_outbox = ‘X’
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = ‘X’
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.

* Populate zerror return code
ld_error = sy-subrc.

* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.

Step-by-Step Guide for Using LSMW to Update Customer Master Records

by Mitresh Kundalia,
SAP Practice Manager, Quality Systems & Software (QSandS.com)

Business Case:

As a part of reorganization and to better serve the customer needs, you are regrouping many of the customers. In SAP terms, you are changing the Sales Office, Sales Group and Customer Groups for specific Customer Master Records. Typically, you would maintain customer records with transaction XD02 to update ‘Sales View’. You would enter Customer Key (Customer No, Sales Organization, Distribution Channel, and Division) and update relevant fields on Sales View screen.

This document contains Step-by-step instructions to use LSMW to update Customer Master Records. It has two demonstration examples – one using Batch Recording and another using standard SAP Object.

Note! The screenprints in this article are from IDES Release 4.6. They may differ slightly in other versions.

Demo Example 1
LSMW to Update Customer Master Records with Transaction Recording

Call Legacy System Migration Workbench by entering transaction code LSMW. Every conversion task is grouped together as Project / Subproject / Object structure. Create a Project called LSMW_DEMO and a Subproject as CUSTOMERS and Object as
CUST_obj .

The main screen of LSMW provides wizard-like step-by-step tasks, as shown in Figure 2. To complete your data conversion, you need to execute these steps in sequence. Once a step is executed, the cursor is automatically positioned to the next step.

Note that these steps may look different depending upon your Personal menu settings. You could make step numbers visible by ‘Numbers on’ icon or hidden by ‘Numbers off’ icon. You can execute a step by double-clicking on the row. Toggle icon ‘Doubleclick=Display’ or ‘Doubleclick=Edit’, makes the step in ‘display’ mode or ‘change’ mode.

Step 1: Maintain Object attributes

In this example, you will be updating the customer master records with the help of recording a transaction (XD02). Choose radio button Batch Input Recording and click on the recording overview icon to record the R/3 transaction. Enter the Recording name as XD02_REC, the description as Customer Master Updates Recording, and the transaction code as XD02.

Object type ‘Transaction Recording’

The system calls the transaction code XD02 and prompts you to complete the Change
Customer transaction, as shown in Figure 4. Enter the key customer information (I entered customer number 1000, sales organization 1000, distribution channel 01, and division 00) and choose ‘Sales’ view within ‘Sales area data’. Make changes to these three fields (I entered, sales office 1010, sales group 110, and customer group 01) and save the transaction.

Transaction recording for Transaction Code ‘XD02’

Once the transaction is completed, R/3 records the flow of screens and fields and saves the information.

Transaction recording overview

Note that the fields are populated with default values. The values you entered when you recorded the transaction are set by default.

Note that if you have more fields in the recording than needed, you can remove them by clicking ‘Remove Screen field’ icon.

Observe that the transaction-recording process stores field names in a technical format. By pressing the F1 key on individual screen fields and then pressing the F9 key, the system displays technical names. You then can replace the technical names with
descriptive names. Double-click on the field RF02D-KUNNR and enter the name as KUNNR and the description as Customer Account Number and remove the default value.

Field attributes

Similarly, double-click on all other fields with default values and make appropriate changes. Once you have made changes, the recording overview screen looks like what you see in Figure 7.
Transaction Recording Overview – with screen field attributes

Save your changes. When you go back to the initial screen, you will see that the initial screen steps have changed. Since you want to import data via the BDC method, the Direct Input and IDoc-related steps are hidden, as they are not relevant.

Step 2. Maintain Source Structures

Give a name and a description to the source structure .

Source Structure

Step 3. Maintain Source Fields
In this step, you need to list what fields are present in the source structure. The easiest way is to click on ‘Table Maintenance’ icon
to enter Fieldname, Type and Length for each field as shown in Figure 9.

Source fields of source Structure

Note that your input file will have four fields as key fields and you need to update three fields in the system.

Step 4: Maintain Structure Relations
Execute a step to ‘Maintain Structure Relations’. (See Figure 10.) Since, there is only one Source and Target Structure, the relationship is defaulted automatically.

Structure Relation

Step 5: Maintain field mapping and conversion rules

Field RF02D-D0310 represents that you chose ‘Sales view’ for the customer Master screen accordingly its value should be set to X. Keep your cursor on field RF02D-D0310 and click on Constant rule icon to choose the constant value of ‘X’.

If your source file already has the field value, you choose rule ‘Source Field’.

Keep cursor on field ‘KUNNR’ and click on ‘Assign Source field’ icon to choose source field CUSTOMER from structure XD02S .

Assign source fields

Similarly, assign ‘Source Field’ rules to the remaining fields. Once all the fields are mapped, you should have an overview screen.

Field mapping and Conversion rules overview

Step 6: Maintain fixed values, translations, user-defined routines
You can also maintain re-usable translations and user-defined routines, which can be used across conversion tasks. In this case, that step is not required.

Step 7: Specify files
In this step, we define how the layout of the input file is. The input file is a [Tab] delimited with the first row as field names. It is present on my PC (local drive) as C:\XD02.txt.

File attributes

Create an Excel file (Figure 14) with your data and save it as a Tab-delimited text file on your local drive (C:\) and name it XD02. txt.

Source data in Excel file (saved as Tab delimited file)

Step 8: Assign files
Execute step ‘Assign Files’ (Figure 15) and the system automatically defaults the filename to the source structure.

Assign file to Source Structure

Step 9: Read data
In this step, LSMW reads the data (Figure 16) from the source file (from your PC’s local drive). You have the option to read only selected rows and convert data values to Internal format.

Read Data

Step 10: Display read data
This step (Figure 17) is optional. If required, you can review the field contents for the rows of data read.

Display Read Data

Step 11: Convert data
This is the step that actually converts the source data (in source format) to a target format. Based on the conversion rules defined, source fields are mapped to target fields.

Step 12: Display Converted data
Again this is an optional step to view how the source data is converted to internal SAP format

Display Converted Data

Step 13: Create batch input session
Once the source data is converted in an internal format, you can create a batch session to process updates.

Create Batch Input Session

Step 14: Run Batch Input Session
You can execute the BDC session by Run Batch input session. Executing a batch input session is a standard SM35 transaction for managing BDC sessions. Once you have successfully executed the batch input session, the customer master records are updated in
the system. You can confirm this by viewing the customer master records (XD03).

Note! Browsing thru these 14 steps, you may get a feeling that this is a very lengthy and time-consuming activity. However, for
the purposes of demonstration, I have made it detailed. Although it looks lengthy, actually it takes hardly few hours from start-to-
finish! After playing around with few simple LSMW scripts, you will find it so easy to change and create more complex ones.

Demo Example 2
LSMW to Update Customer Master Records with Standard Object

As an alternative to using ‘Transaction Recording’, you could also use a standard SAP object to update Customer Master Records.
Business Object ‘0050’ is already pre-defined in the system with standard Batch Input Interface Program ‘RFBIDE00’.

Create an Object CUST_OBJ within Project as LSMW_DEMO and Subproject as CUSTOMERS .

LSMW Object with Standard SAP Object

Note! For the Demo example 2, I will list only those steps that are different from the first demo example.

Step 1: Maintain Object attributes
You will be updating the customer master records with the help of Standard Batch Input; therefore, choose radio-button Standard Batch/Direct Input as shown in Figure 21. Enter Object ‘0050’ for Customer Master records and default method ‘0000’ and click
on Save.

Standard Batch/Direct Input Object Attributes

Step 4: Maintain Structure Relations

Sales view of Customer Master is stored in table KNVV. Accordingly, you need to update structure BKNVV. However, in addition, the Standard Object ‘0050’ also requires updates to BGR00, BKN00 and BKNA1 structures. (If you do not maintain Structure
relations for mandatory entries, you might get a message such as ‘Target structure BKNA1 needs a relation to a source structure’.)

Even though you don’t want to update any fields in these structures, you need to create a relationship with source structures. In
all, you need to create relationship for four target structures.

Create relationship between source structures XD02S with these target structures with icon ‘Create Relationship’ .

Keep Cursor on these four target structures and click on icon ‘Create Relation’ and structure relations are maintained .

Structure Relation

Step 5: Maintain field mapping and conversion rules

– Keep your cursor on ‘TCODE’ field and click on ‘Insert Rule’ icon

LSMW Conversion Rules

Choose radio button ‘Constant’ to enter value ‘XD02’ transaction code.

– Keep your cursor on field ‘KUNNR’ and click on ‘Assign source field’ icon

Choose source field ‘Customer’ from source structure ‘XD02S’. (See Figure 24.)

Assign Source fields

– Similarly, choose source fields for Sales Organization, Distribution Channel, and Division.

-Field Mapping and Conversion Rules

– Scroll down to structure BKNVV fields and assign source fields to three fields Sales Office, Sales Group, and Customer Group .

Field Mapping and Conversion Rules

Save and go back to main screen.

Step 12: Display Converted data
When you convert data, LSMW automatically converts into the appropriate structure layouts, as required by Standard program
(RFBIDE00).

Converted data into multiple structures

Note that if you had only one record in source file, the converted file has four records.

Earlier, creating this input file, so that the standard interface program can read it, was a big nightmare, the primary reason being
that it could have multiple record layouts. Even for a simple conversion with one input record, you would have to create this
complex file with many record layouts. The advantage of LSMW is that it prepares these multi-layout files automatically.

Step 13: Create batch input session
Once source data is converted in internal format, you can create a BDC session to process the updates .

Create BDC Session

BDC Session ‘CUST_OBJ’ created

Summary
Once BDC session is processed successfully, SAP updates the customer master records with relevant changes. Review these
specific customers (transaction code XD03) and confirm that the changes are correctly reflected in the master records.

Mitresh Kundalia heads SAP practice division at Quality Systems & Software (www.QSandS.com). QS&S helps companies achieve world-class performance by realizing their latent business and technological potential with emphasis on SAP systems. QS&S uses
Industry-wide best-practices and proven implementation tools to integrate complex business processes with the SAP system. With an MBA degree in finance, Mitresh implements Financial and Logistics applications with specialization in Management reporting,
Profitability Analysis, Information systems and Business Information Warehouse.

*———————————————————————*
* Report Name : YGECICI
*———————————————————————*
* Author : Amit Khari
* Location :ABAPcode site
* Date / Time : 05 may 2007
* Subject : Upload Data From MS Accsess Into an Internal Table
*———————————————————————*
REPORT YGECICI MESSAGE-ID 00
No Standard Page Heading
Line-Size 200
Line-Count 65.

INCLUDE Ole2incl.

DATA: Con TYPE Ole2_Object,
Rec TYPE Ole2_Object.

DATA SQL(1023).

DATA: BEGIN OF SPL OCCURS 0,
VAL(1023),
END OF SPL.

DATA: BEGIN OF I1 OCCURS 0,
F1 TYPE I ,
F2(10),
F3(10),
END OF I1.

IF Con-Header IS INITIAL OR Con-Handle = -1.
CREATE OBJECT Con ‘ADODB.Connection’.
IF NOT Sy-Subrc = 0.
EXIT.
ENDIF.

CREATE OBJECT REC ‘ADODB.Recordset’.
IF NOT Sy-Subrc = 0.
EXIT.
ENDIF.

ENDIF.

* MDB Connetion Infomations ….
CONCATENATE ‘Provider=’ ”’Microsoft.Jet.OLEDB.4.0”’ ‘;’
INTO SQL.
CONCATENATE SQL ‘Password=’ ””” ‘;’
INTO SQL.
CONCATENATE SQL ‘User ID=’ ”’Admin”’ ‘;’
INTO SQL.
CONCATENATE SQL ‘Data Source=’ ”’C:\Mm.Mdb”’ ‘;’
INTO SQL.
CONCATENATE SQL ‘Mode=’ ”’Share Deny None”’
INTO SQL.

* MDB Connection …
CALL METHOD OF CON ‘Open’
EXPORTING #1 = SQL.
*

* Query (Insert) Statement …
SQL = ‘Insert Into [Test] Values(’.
CONCATENATE SQL ”’A”’ ‘,’ ”’1”’ ‘)’ INTO SQL.

* Query Run …
CALL METHOD OF REC ‘Open’
EXPORTING #1 = SQL
#2 = CON
#3 = ‘1′.

* Query (Select) Statement …
SQL = ‘Select * From[Test]’.

* Query Run …
CALL METHOD OF REC ‘Open’
EXPORTING #1 = SQL
#2 = CON
#3 = ‘1′.

* Selecting MDB Record Into SAP Internal Table …
DO.
CALL METHOD OF REC ‘Getstring’ = SQL
EXPORTING #1 = ‘2′ “Do Not Modify!
#2 = 1 “Do Not Modify!
#3 = ‘|’ “Do Not Modify!
#4 = ‘|’. “Do Not Modify!

IF Sy-SUBRC EQ 0.
REFRESH SPL. CLEAR SPL.
SPLIT SQL AT ‘|’ INTO TABLE SPL.
LOOP AT SPL.
CASE SY-TABIX.
WHEN 1.
I1-F1 = SPL-VAL.
When 2.
I1-F2 = SPL-VAL.
WHEN OTHERS.
I1-F3 = SPL-VAL.
ENDCASE.
ENDLOOP.
APPEND I1. CLEAR I1.
ELSE.
EXIT.
ENDIF.

ENDDO.

* Result Writing …
LOOP AT I1.
WRITE: AT /1(10) I1-F1,
AT (10) I1-F2, AT (20) I1-F3.
ENDLOOP.

* Connetion Close & Destroy
FREE OBJECT Con.
FREE OBJECT Rec.

Copy All file in your SE38 Editor and Run Report ZSDCX_DEA_ADVANCE_NOTICE_CHK

DownLoad File http://www.savefile.com/files/767894

The Debugger is a programming tool that you can use to execute ABAP programs, by line or by section. With this tool, you can display data objects and check the flow logic of programs.
Two types of debugging are currently possible: Debugging with the classic Debugger for release levels up to and including 6.40 or debugging with the new Debugger, which is available for all releases after 6.40. The main differences between the classic and the new ABAP Debuggers are described below:

· The Classic ABAP Debugger runs in the same roll area as the application to be analyzed (debuggee). It is therefore displayed in the same window as the application. However, this technology also has some restrictions. For example, some ABAP programs (such as conversion exist) cannot be analyzed in debug mode for technical reasons. However, the most significant restriction is that no ABAP technology can be used for designing the Debugger interface and it is therefore not possible to create a modern user interface.

The New ABAP Debugger, on the other hand, is executed in a separate external session (Debugger), while the application to be analyzed (debuggee) uses a second external session. With this technology, the user interface of the Debugger can be designed freely by ABAP means.
The new Debugger provides the user with a flexible interface that can be configured as required and has more than eight desktops. Here it is possible to place and arrange up to four tools – depending on the user’s selection. For example, it is possible to display source texts or structures. In this way, the user can design the Debugger interface according to his own individual requirements.

As of Release 6.40, you can select the debugging type as you wish by choosing the classic Debugger or the new Debugger in the ABAP Editor from the path Utilities ® Settings. It is also possible to switch the Debugger at any time during a session under the menu option Debugging.
As of Release 7.00, the new ABAP Debugger is the default.

Other Related Links :


Read Whole Site there

http://abapcode.info

Topic Wise Content

blog content

May 2007
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  

Blog Stats

  • 550,555 hits