Application Development 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: 

data upload QS21:Create Master Inspection Characheristics

Former Member
0 Kudos

I want to upload data from excel into tcode QS21:Create Master Inspection Characheristics

Which method I should use, LSMW, or BDC or BAPI

Can anybody suggest me with coding

Thanks

naresh

1 REPLY 1

Former Member
0 Kudos

Hi,

here a sample code using Bapi that could help you.

Regards.

David

report z_qm_00_0390010 .

data : it_mstcharplnt

like bapiqpmk_mstcharplnt occurs 0 with header line.

data : st_mstcharplnt like bapiqpmk_mstcharplnt.

data : it_return like bapiret2 occurs 0 with header line.

data : it_return2 like bapiret2 occurs 0 with header line.

data : it_bapiqpmk like bapiqpmk_qpmk occurs 0 with header line,

it_bapiqpmt like bapiqpmk_qpmt occurs 0 with header line,

it_bapilongtext like bapiqpmk_longtext

occurs 0 with header line,

it_bapismpl_ltxt like bapiqpmk_smpl_ltxt

occurs 0 with header line,

it_bapiqpmz like bapiqpmk_qpmz occurs 0 with header line.

start-of-selection.

check sy-sysid ne 'GPR'.

call function 'ZBAPI_QPMK_GETLIST' destination 'GPRCLNT710'

tables

mstcharplnt = it_mstcharplnt

.

loop at it_mstcharplnt.

clear : it_bapiqpmk,

it_bapiqpmt,

it_bapilongtext,

it_bapismpl_ltxt,

it_bapiqpmz.

free : it_bapiqpmk,

it_bapiqpmt,

it_bapilongtext,

it_bapismpl_ltxt,

it_bapiqpmz.

st_mstcharplnt = it_mstcharplnt.

call function 'ZBAPI_QPMK_EXTRACT' destination 'GPRCLNT710'

exporting

mstcharplnt = st_mstcharplnt

tables

  • RECIPIENTS =

return = it_return

  • EXTENSION1 =

zbapiqpmk_qpmk = it_bapiqpmk

zbapiqpmk_qpmt = it_bapiqpmt

zbapiqpmk_longtext = it_bapilongtext

zbapiqpmk_smpl_ltxt = it_bapismpl_ltxt

zbapiqpmk_qpmz = it_bapiqpmz

.

call function 'BAPI_QPMK_SAVEREPLICA'

tables

mstcha = it_bapiqpmk

mstcha_insp_meth = it_bapiqpmz

mstcha_text = it_bapiqpmt

mstcha_longtext = it_bapilongtext

mstcha_smpl_ltxt = it_bapismpl_ltxt

return = it_return2

  • EXTENSION1 =

.

commit work .

endloop.