Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

bdc in object oriented

hello experts,

can any one give me the bdc in object oriented concept.

help is appriciated.

Regards:

Mahesh

Tags:
Former Member
Former Member replied

Hi,

Check the code below, but the thingis the classes are created as universal classes using se24. Check the code below which is for material master data upload using MM01 transaction.

report zm_bdcp_upld_material_1087

no standard page heading line-size 255.

----


  • DECLARATIONS

----


data: l_title type string value ' Select the appropriate file '.

types: begin of ty_data,

maktx type maktx,

meins type meins,

matkl type matkl,

end of ty_data.

data: it_data type table of ty_data,

wa_data type ty_data.

data : v_filename type string,

it_bdcdata type table of bdcdata.

data: it_file type filetable,

wa_file type file_table.

data obj_call_trans type ref to zcl_ram_mm01.

data: v_rc type i.

parameters : p_file type string obligatory.

at selection-screen on value-request for p_file.

call method cl_gui_frontend_services=>file_open_dialog

exporting

window_title = l_title

default_extension = 'p_file'

default_filename = p_file

changing

file_table = it_file

rc = v_rc.

read table it_file index 1 into wa_file.

p_file = wa_file-filename.

v_filename = p_file.

refresh it_data.

call method cl_gui_frontend_services=>gui_upload

exporting

filename = v_filename

has_field_separator = 'X'

changing

data_tab = it_data.

if sy-subrc <> 0.

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

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

endif.

start-of-selection.

create object obj_call_trans.

data: v_status type sy-subrc.

call method obj_call_trans->open_group

exporting

cl_client = sy-mandt

cl_group = 'RAMA'

cl_keep = 'X'

cl_user = sy-uname

changing

cl_status = v_status.

if v_status eq 0.

loop at it_data into wa_data.

refresh it_bdcdata.

call method obj_call_trans->fill_screen_details

exporting

im_program = 'SAPLMGMM'

im_dynpro = '0060'

im_dynbegin = 'X'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'BDC_CURSOR'

im_fval = 'RMMG1-MATNR'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'BDC_OKCODE'

im_fval = '=AUSW'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'RMMG1-MBRSH'

im_fval = 'C'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'RMMG1-MTART'

im_fval = 'WETT'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_screen_details

exporting

im_program = 'SAPLMGMM'

im_dynpro = '0070'

im_dynbegin = 'X'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'BDC_CURSOR'

im_fval = 'MSICHTAUSW-DYTXT(01)'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'BDC_OKCODE'

im_fval = '=ENTR'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'MSICHTAUSW-KZSEL(01)'

im_fval = 'X'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_screen_details

exporting

im_program = 'SAPLMGMM'

im_dynpro = '4004'

im_dynbegin = 'X'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'BDC_OKCODE'

im_fval = '=BU'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'MAKT-MAKTX'

im_fval = wa_data-maktx

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'BDC_CURSOR'

im_fval = 'MARA-MATKL'

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'MARA-MEINS'

im_fval = wa_data-meins

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->fill_field_details

exporting

im_fnam = 'MARA-MATKL'

im_fval = wa_data-matkl

changing

it_bdcdata = it_bdcdata.

call method obj_call_trans->insert_group

exporting

cl_tcode = 'MM01'

changing

cl_dynprotab = it_bdcdata.

endloop.

endif.

call method obj_call_trans->close_group.

*CALLING BATCH INPUT SESSHION OVERVIEW.

call transaction 'SM35' .

Hope this will help your cause,

With best wishes,

Murthy.

Edited by: pr murthy on Sep 11, 2008 6:44 AM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question