Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Upload Data

Former Member
0 Likes
950

I want to upload more than lakh records from legacy to SAP using LSMW so any one can tell me standard BAPI's or Direct Input programs/methods available for these...

1) Material Master

2) Supplier Quotations

Regards,

Vimal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
916

hi vimal,

The direct input program for material master is RMDATIND.

The bapi for material creation is BAPI_RETAILMATERIAL_CREATE.

Regards...

Arun.

Reward points if useful.

8 REPLIES 8
Read only

Former Member
0 Likes
917

hi vimal,

The direct input program for material master is RMDATIND.

The bapi for material creation is BAPI_RETAILMATERIAL_CREATE.

Regards...

Arun.

Reward points if useful.

Read only

0 Likes
916

hi,

Thanks for ur ans.

here i want to upload data to all the views, how can we do it.

is it possible in DI or BAPI.

Regards,

Vimal

Read only

0 Likes
916

you can use this FM to load all views - BAPI_MATERIAL_SAVEDATA

See the example code :

report z8_bapi.

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

  • STRUCTURE DECLARATIONS *

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

tables: bapimathead, "Headerdata

bapi_mara, "Clientdata

bapi_marax, "Clientdatax

bapi_marc, "Plantdata

bapi_marcx, "Plantdatax

bapi_makt, "Material description

bapiret2. "Return messages

data:v_file type string.

data:

begin of lsmw_material_master,

matnr(018) type c, "Material number

mtart(004) type c, "Material type

mbrsh(001) type c, "Industry sector

werks(004) type c, "Plant

maktx(040) type c, "Material description

dismm(002) type c, "Extra Field Added In the Program as itsrequired

meins(003) type c, "Base unit of measure

matkl(009) type c, "Material group

spart(002) type c, "Division

labor(003) type c, "Lab/office

prdha(018) type c, "Product hierarchy

mstae(002) type c, "X-plant matl status

mtpos_mara(004) type c, "Gen item cat group

brgew(017) type c, "Gross weight

gewei(003) type c, "Weight unit

ntgew(017) type c, "Net weight

groes(032) type c, "Size/Dimensions

magrv(004) type c, "Matl grp pack matls

bismt(018) type c, "Old material number

wrkst(048) type c, "Basic material

profl(003) type c, "DG indicator profile

kzumw(001) type c, "Environmentally rlvt

bstme(003) type c, "Order unit

vabme(001) type c,

ekgrp(003) type c, "Purchasing group

xchpf(001) type c, "Batch management

ekwsl(004) type c, "Purchasing key value

webaz(003) type c, "GR processing time

mfrpn(040) type c, "Manufacturer part number

mfrnr(010) type c, "Manufacturer number

vprsv(001) type c, "Price control indicator

stprs(015) type c, "Standard price

bwprh(014) type c, "Commercial price1

bklas(004) type c, "Valuation class

end of lsmw_material_master.

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

  • INTERNAL TABLE DECLARATIONS *

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

*to store the input data

data:

begin of it_matmaster occurs 0.

include structure lsmw_material_master.

data:

end of it_matmaster.

*for material description

data:begin of it_materialdesc occurs 0.

include structure bapi_makt .

data:end of it_materialdesc.

*to return messages

data:begin of it_return occurs 0.

include structure bapiret2.

data:end of it_return.

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

  • SELECTION SCREEN

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

selection-screen begin of block b1 with frame title text-002.

parameters:p_file like rlgrap-filename obligatory.

selection-screen end of block b1 .

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

  • AT SELECTION SCREEN

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

at selection-screen on value-request for p_file.

call function 'F4_FILENAME'

exporting

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = 'P_FILE'

importing

file_name = p_file.

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

  • TO UPLOAD THE DATA *

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

start-of-selection.

v_file = p_file.

call function 'GUI_UPLOAD'

exporting

filename = v_file

filetype = 'ASC'

has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = it_matmaster

exceptions

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

others = 17

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

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

  • DATA POPULATIONS *

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

loop at it_matmaster.

bapimathead-material = it_matmaster-matnr.

bapimathead-ind_sector = it_matmaster-mbrsh.

bapimathead-matl_type = it_matmaster-mtart.

bapimathead-basic_view = 'X'.

bapimathead-purchase_view = 'X'.

bapimathead-account_view = 'X'.

bapi_mara-matl_group = it_matmaster-matkl.

bapi_mara-old_mat_no = it_matmaster-bismt.

bapi_mara-base_uom = it_matmaster-meins.

bapi_mara-basic_matl = it_matmaster-wrkst.

bapi_mara-mfr_no = it_matmaster-mfrnr.

bapi_marax-matl_group = 'X'.

bapi_marax-old_mat_no = 'X'.

bapi_marax-base_uom = 'X'.

bapi_marax-basic_matl = 'X'.

bapi_marax-mfr_no = 'X'.

bapi_marc-plant = it_matmaster-werks.

bapi_marc-pur_group = it_matmaster-ekgrp.

bapi_marcx-plant = it_matmaster-werks.

bapi_marcx-pur_group = 'X'.

it_materialdesc-langu = 'EN'.

it_materialdesc-matl_desc = it_matmaster-maktx.

append it_materialdesc.

call function 'BAPI_MATERIAL_SAVEDATA'

exporting

headdata = bapimathead

clientdata = bapi_mara

clientdatax = bapi_marax

plantdata = bapi_marc

plantdatax = bapi_marcx

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

  • FLAG_ONLINE = ' '

  • FLAG_CAD_CALL = ' '

importing

return = it_return

tables

materialdescription = it_materialdesc

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

  • RETURNMESSAGES =

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

write:/ it_return-type,

2 it_return-id,

22 it_return-number,

25 it_return-message.

  • IT_RETURN-LOG_NO,

  • IT_RETURN-LOG_MSG_NO,

  • IT_RETURN-MESSAGE_V1,

  • IT_RETURN-MESSAGE_V2,

  • IT_RETURN-MESSAGE_V3,

  • IT_RETURN-MESSAGE_V4,

  • IT_RETURN-PARAMETER,

  • IT_RETURN-ROW,

  • IT_RETURN-FIELD,

  • IT_RETURN-SYSTEM.

endloop.

Thanks

Seshu

Read only

0 Likes
916

Thanks for ur ans.

You said using this BAPI_MATERIAL_SAVEDATA ( FM) we can upload all views.

is it possible to upload thru LSMW directly without writing code...

Regards,

Vimal

Read only

0 Likes
916

Hello Vimal,

Yes it is possible and it is very easy.

select standard batch/direct input

Object: 0020

Method : 0000

Program name : RMDATIND

Program type : D(Direct Input)

I have done LSMW Material master upload and it is very easy.

Good luck.

Thanks

Seshu

Read only

0 Likes
916

Thanks all for ur answers.

Regards,

Vimal

Read only

varma_narayana
Active Contributor
0 Likes
916

Hi Vimal..

For Material Master

1. Direct input program: RMDATIND

2. bapi : BAPI_MATERIAL_SAVEDATA

Read only

Former Member
0 Likes
916

1) Material Master : BAPI_MATERIAL_SAVEDATA' -> you can use this BAPI for creating material as well changing the material

2) Supplier Quotations - BAPI_QUOTATION_CREATEFROMDATA2

Thanks

Seshu