cancel
Showing results for 
Search instead for 
Did you mean: 

Sales order migration from legacy system

Former Member
0 Kudos

Hi,

What are the strategies/precautions/steps to be followed for migrating sales orders or quotations from legacy system to SAP?

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You can use custom program using BAPI/BDC to upload sales order data. However, BAPI would be much faster than BDC.

You could also you LSMW tool.

The precautions that you should take is to ensure that you are getting all the required data from legacy system. If not you would need to use constant values or some logic in the program so that you could get all the required data so that you could process the data.

You may need to generate a proper log (error or success as per your requirement) to analysis purposes.

BDC/BAPI Steps:

1. Fetch Data (Download/Read Dataset/Select from Tables)

3. Massage data as per SAP format.

3. Validation Check

4. Pass valid data to BDC (Call Transaction/Session) or BAPI

5. In case of session method - session log is generated. In case of Call transaction you can use an internal table with structure BDCMSGCOLL to get messages. In case of BAPI the messages will be returned in return table (strcutre BAPIRET2/BAPIRETTAB).

Visit the following link:

Where you would find more information about BDC and LSMW.

BDC:

http://help.sap.com/saphelp_erp2005/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm

For information regarding LSMW steps visit the following link:

/people/hema.rao/blog/2006/09/14/lsmw--step-by-step

http://help.sap.com/bp_blv1500/BL_US/html/dataconv_lsmw.htm

Regards,

Naveen.

jiteshmehta
Active Contributor
0 Kudos

Hi AKK

You can use LSMW, searching it in forums you will get complete documentation

you will get all the information at www.service.sap.com/lsmw

There is also Data Transfer Workbench for sales order

http://help.sap.com/saphelp_46c/helpdata/EN/0d/414538bc0fe927e10000009b38f8cf/frameset.htm

I would suggest Direct Input Method, as it is predesigned, you can feed data for Header and Item

Regards

Jitesh

former_member183879
Active Contributor
0 Kudos

Stratgies/Steps

1. Classify the sales orders into open orders / delivered orders / invoiced orders etc

2. Now prepare the loader sheets separately for open orders, orders which are delivered and their corresponding deliveries, orders and their corresponding invoices.

3. Now write an LSMW/BDC/CATT/IDOC etc to upload open orders in tables like VBAP, VBAK, VBEP etc, delivered orders in VBAK, VBAP, VBEP, LIKP, LIPS,VBFA etc and for invoiced orders in VBAP, VBAK,VBEP, LIKP, LIPS, VBFA, VBRK, VBRP, etc

While migrating, IDOCs is not advisable as it is highly time consuming.

Precautions:

1. Make sure the organisational settings in SAP and in the loader sheets are same. We had a huge problem when the sales organisation in SAP was DK01 and in loader sheet was 1271. This can lead to complete failure of order upload as the sales org 1271 will not be there in SAP.

2.Make sure that all the outputs for orders are kept at batch mode and not at immediate mode.

These are some of the things in migration. If you need some specific information, please let me know.

Reward point if it helps.

Former Member
0 Kudos

Hi IImnava,

Thanks for the response.

can you mail me any template/format for the data to be captured for migrating Sales orders/quotations to SAP. I wanted to understand and see what all fields normally we should capture.

My id is sap.akk@gmail.com.

Thanks in advance.

rgds

Former Member
0 Kudos

Hi,

Sample Code for Sales Order (VA01):

Input File Layout:

Sales Document Type, Sales Organisation, Distribution Channel, Division, Sold To Party, Ship To Party, Customer purchase order number, Customer purchase order date, Payment Terms(custom field), incoterms1, incoterms2, Order reason (reason for the business transaction), Material, Cumulative order quantity in sales units,.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA : w_auart(4) TYPE c,

w_vkorg(4) TYPE c,

w_vtweg(2) TYPE c,

w_spart(2) TYPE c,

w_kunnr(10) TYPE c,

w_kunrg(10) TYPE c,

w_bstkd(35) TYPE c,

w_bstdk(10) TYPE c,

w_kwmeng(18) TYPE c,

w_zterm(4) TYPE c,

w_inco1(3) TYPE c,

w_inco2(28) TYPE c,

w_augru(3) TYPE c.

DATA : var1 TYPE string,

var2 TYPE c VALUE '(',

var3 TYPE c VALUE ')',

num(2) TYPE c,

flag(1) TYPE c.

DATA : BEGIN OF it_order, " Internal table Structure

auart(4) TYPE c, " Sales Order Type

vkorg(4) TYPE c, " Sales Organization

vtweg(2) TYPE c, " Distribution Channel

spart(2) TYPE c, " Division

kunnr(10) TYPE c, " Sold-to-Party

kunrg(10) TYPE c, " Ship-to-Party

bstkd(35) TYPE c, " Purchase Order No

bstdk(10) TYPE c, " Purchase Order Date

zterm(4) TYPE c, " Payment Terms

inco1(3) TYPE c, " Inco Terms1

inco2(20) TYPE c, " Inco Terms2

augru(3) TYPE c, " Order Reason

mabnr(18) TYPE c, " Material No

kwmeng(18) TYPE c, " Quantity

END OF it_order,

itab LIKE STANDARD TABLE OF it_order WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETER filename LIKE rlgrap-filename.

PARAMETER session LIKE apqi-groupid.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

************************************************************************

  • Get the file path

************************************************************************

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = filename

def_path = ' '

mask = ',.,..'

mode = 'O'

title = 'Select File'

IMPORTING

filename = filename

EXCEPTIONS

selection_cancel = 1.

CHECK sy-subrc = 0.

START-OF-SELECTION.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

codepage = ' '

filename = filename

filetype = 'ASC'

headlen = ' '

line_exit = ' '

trunclen = ' '

user_form = ' '

user_prog = ' '

dat_d_format = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

OTHERS = 10.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

PERFORM open_group.

LOOP AT itab.

CLEAR : w_auart,w_vkorg,w_vtweg,w_spart,w_kunnr,w_kunrg,

w_bstkd,w_bstdk,w_zterm,w_inco1,w_inco2,w_augru.

w_auart = itab-auart.

w_vkorg = itab-vkorg.

w_vtweg = itab-vtweg.

w_spart = itab-spart.

w_kunnr = itab-kunnr.

w_kunrg = itab-kunrg.

w_bstkd = itab-bstkd.

w_bstdk = itab-bstdk.

w_zterm = itab-zterm.

w_inco1 = itab-inco1.

w_inco2 = itab-inco2.

w_augru = itab-augru.

ON CHANGE OF itab-kunnr OR itab-kunrg OR itab-bstkd .

flag = 0.

num = 1.

PERFORM bdc_dynpro USING 'SAPMV45A' '0101'.

PERFORM bdc_field USING 'BDC_CURSOR'

'VBAK-AUART'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'VBAK-AUART' " Order Type

itab-auart.

PERFORM bdc_field USING 'VBAK-VKORG' " Sales Organization

itab-vkorg.

PERFORM bdc_field USING 'VBAK-VTWEG' " Distribution Channel

itab-vtweg.

PERFORM bdc_field USING 'VBAK-SPART' " Division

itab-spart.

PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'VBKD-BSTKD' " PO Number

itab-bstkd.

PERFORM bdc_field USING 'VBKD-BSTDK' " PO Date

itab-bstdk.

PERFORM bdc_field USING 'KUAGV-KUNNR' " Sold to Party

itab-kunnr.

PERFORM bdc_field USING 'KUWEV-KUNNR' " Ship to Party

itab-kunrg.

PERFORM bdc_field USING 'VBKD-ZTERM' " Payment Terms

itab-zterm.

PERFORM bdc_field USING 'VBKD-INCO1' " Inco Terms1

itab-inco1.

PERFORM bdc_field USING 'VBKD-INCO2' " Inco Terms2

itab-inco2.

PERFORM bdc_field USING 'VBAK-AUGRU' " Order Reason

itab-augru.

ENDON.

IF flag = 0.

LOOP AT itab WHERE bstkd = itab-bstkd AND kunnr = itab-kunnr .

var1 = 'RV45A-MABNR'.

CONCATENATE var1 var2 num var3 INTO var1.

PERFORM bdc_field USING var1

itab-mabnr.

var1 = 'RV45A-KWMENG'.

CONCATENATE var1 var2 num var3 INTO var1.

PERFORM bdc_field USING var1

itab-kwmeng.

PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

num = 2.

ENDLOOP.

ELSE.

CONTINUE.

ENDIF.

flag = 1.

PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=SICH'.

PERFORM bdc_transaction USING 'VA01'.

ENDLOOP.

PERFORM close_group.

WRITE : / 'Session',session, 'was Created'.

FORM open_group.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = session

user = sy-uname

keep = 'X'.

ENDFORM.

FORM close_group.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDFORM.

FORM bdc_transaction USING tcode.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = tcode

TABLES

dynprotab = bdcdata.

ENDFORM.

FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM.

FORM bdc_field USING fnam fval.

IF fval <> ' '.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDIF.

ENDFORM.

Regards,

Naveen.