Here is an ALV program that calls a ME21N via BDC. There is a LOT of code here you don't need (ex: the ability to run the ALV in background for huge amounts of data yet keep the ALV sort & mod abilities, the ability for different users to set their own sort combinations etc), but if you go to the CALL_CRYSTAL form, you will see I do another perform, called BUILD_BDC. This will show you how to use the CALL TRANSACTION, with a message table. I have a loop inside the message table after I return from ME21N to display an info message with the doc number. Using this loop, you can find your delivery numbers for your second BDC.
*--------------------------------------------------[START OF REPORT]---*
report zjmrp message-id zaberd no standard page heading
line-count 65(1) line-size 162.
*-----------------------------------------------------------[TABLES]---*
tables: mara, " General Material Data
marc, "
sscrfields. " Fields on selection screens
type-pools: slis.
*----------------------------------------------[INTERNAL WORK AREAS]---*
*------------------------ for MD_ABBL_REPORTING -----------------------*
data: i_crpes like crpes.
data begin of i_mdps occurs 100.
include structure mdps.
data end of i_mdps.
*--------------------------- SORTING TABLES ---------------------------*
data begin of i_sortord occurs 100.
include structure zsort_list.
data end of i_sortord.
data: fname(5).
data: f01(10),f02(10),f03(10),f04(10),f05(10),f06(10),f07(10),f08(10),
f09(10),f10(10),f11(10),f12(10),f13(10),f14(10),f15(10),f16(10),
f17(10),f18(10),f19(10),f20(10).
field-symbols <fs1>.
*-----------------------FILENAME DEFINITION----------------------------*
data: sap1filp(132) value '/usr/sap/interfaces/reports/zmrp21_'.
data: sap1fil(132),
getfil(132).
ranges s_wrkst for mara-wrkst.
ranges s_groes for mara-groes.
data: begin of disp_tab occurs 0, "Internal table for ALV data
ckbox(1) type c, " Selection Box (input)
matkl like mara-matkl, " Material Group
matnr like mara-matnr, " Material Number
maktx like makt-maktx, " Description
bismt like mara-bismt, " Old material
wrkst like mara-wrkst, " Basic material
groes like mara-groes, " Size/dimension
werks like marc-werks, " Plant
dispo like marc-dispo, " MRP controller
bstmi like marc-bstmi, " Min Run Length
lbkum like mbew-lbkum, " On Hand
eisbe like marc-eisbe, " Safety stock
idprq like mdps-mng01, " Independant Req
deprq like mdps-mng01, " Dependant Req
reqrq like mdps-mng01, " Requisitions
storq like mdps-mng01, " STO's
convert like mdps-mng01, " Qty to convert (input)
deldat like sy-datum, " Delivery date (input)
end of disp_tab.
data: begin of i_fldw, "Storage area for DISP_TAB data
ckbox(1) type c, " Selection Box (input)
matkl like mara-matkl, " Material Group
matnr like mara-matnr, " Material Number
maktx like makt-maktx, " Description
bismt like mara-bismt, " Old material
wrkst like mara-wrkst, " Basic material
groes like mara-groes, " Size/dimension
werks like marc-werks, " Plant
dispo like marc-dispo, " MRP controller
bstmi like marc-bstmi, " Min Run Length
lbkum like mbew-lbkum, " On Hand
eisbe like marc-eisbe, " Safety stock
idprq like mdps-mng01, " Independant Req
deprq like mdps-mng01, " Dependant Req
reqrq like mdps-mng01, " Requisitions
storq like mdps-mng01, " STO's
convert like mdps-mng01, " Qty to convert
deldat like sy-datum, " Delivery date (input)
end of i_fldw.
* data: begin of i_fcc occurs 100,
chkbox(1), " Checkbox
matkl(10), " Material Group
matnr(18), " Material Number
maktx(40), " Description
bismt(18), " Old material
wrkst(48), " Basic material
groes(32), " Size/dimension
werks(04), " Plant
dispo(03), " MRP controller
bstmi(13), " Min Run Length
lbkum(13), " On Hand
eisbe(13), " Safety stock
idprq(25), " Independant Req
deprq(25), " Dependant Req
reqrq(25), " Requisitions
storq(25), " STO's
convert(25), " Qty to convert
deldat(10), " Delivery date
end of i_fcc.
data begin of bdcdata occurs 20.
include structure bdcdata.
data end of bdcdata.
data begin of messtab occurs 10.
include structure bdcmsgcoll.
data end of messtab.
data: i_fieldcat_alv type slis_t_fieldcat_alv,
w_fieldcat_alv like line of i_fieldcat_alv,
wa_repid type sy-repid,
w_variant type disvariant,
wx_variant type disvariant,
w_callback_ucomm type slis_formname,
w_variant_save(1) type c,
w_exit(1) type c,
w_layout type slis_layout_alv,
lst_is_print type slis_print_alv,
lin type i.
************************************************************************
************************************************************************
************************************************************************
selection-screen: begin of block main with frame title text-008.
select-options: w_wrkst for mara-wrkst no intervals no-extension,
w_groes for mara-groes no intervals no-extension,
w_matnr for mara-matnr no intervals no-extension,
w_matkl for mara-matkl no intervals no-extension,
w_dispo for marc-dispo,
w_date for sy-datum no intervals no-extension.
parameter: p_modes type c default 'N' no-display.
parameter: w_ast as checkbox default 'X'.
selection-screen: begin of block immed with frame title text-001.
selection-screen: begin of line.
selection-screen: comment 1(29) text-002. "Output directly to printer?
parameters: pa_print as checkbox.
selection-screen: end of line.
selection-screen: end of block immed.
selection-screen: begin of block variant with frame title text-003.
parameters: p_vari type slis_vari.
selection-screen: end of block variant.
selection-screen begin of block sub2 with frame title text-007.
parameter: w_new radiobutton group rad1.
parameter: w_fil radiobutton group rad1.
parameter: w_save as checkbox.
parameter: sapfil(132) type c default '001.dat' lower case obligatory.
selection-screen end of block sub2.
selection-screen function key 1.
selection-screen function key 2.
selection-screen: end of block main.
*$*$-------------------------------------------------------------------*
*$*$ Initialization
*$*$-------------------------------------------------------------------*
initialization.
perform init_variant.
perform variant_default using p_vari.
perform added_inits.
*$*$-------------------------------------------------------------------*
*$*$ At Selection Screen
*$*$-------------------------------------------------------------------*
at selection-screen.
perform variant_fill.
perform added_functions.
*$*$-------------------------------------------------------------------*
*$*$ At Selection Screen Value Request
*$*$-------------------------------------------------------------------*
at selection-screen on value-request for p_vari.
perform variant_f4 using p_vari.
************************************************************************
************************************************************************
************************************************************************
start-of-selection.
perform get_data.
perform fieldcat_build.
perform layout_build.
perform save_list_order.
perform call_crystal.
end-of-selection.
*&---------------------------------------------------------------------*
*& Form init_variant
*&---------------------------------------------------------------------*
form init_variant.
clear: w_variant.
wa_repid = sy-repid.
w_variant-report = wa_repid.
w_variant-username = sy-uname.
w_variant_save = 'A'. "All types
endform.
*&---------------------------------------------------------------------*
*& Form variant_default
*&---------------------------------------------------------------------*
form variant_default using p_variant.
wx_variant = w_variant.
if not p_variant is initial.
wx_variant-variant = p_variant.
endif.
call function 'LVC_VARIANT_DEFAULT_GET'
exporting
i_save = w_variant_save
changing
cs_variant = wx_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
case sy-subrc.
when 0.
p_variant = wx_variant-variant.
when 2.
clear: p_variant.
endcase.
endform.
*&---------------------------------------------------------------------*
*& Form variant_fill
*&---------------------------------------------------------------------*
form variant_fill.
clear: w_variant.
if p_vari is initial.
w_variant-variant = 'STANDARD'.
w_variant-report = wa_repid.
else.
w_variant-variant = p_vari.
w_variant-report = wa_repid.
call function 'LVC_VARIANT_EXISTENCE_CHECK'
exporting
i_save = w_variant_save
changing
cs_variant = w_variant
exceptions
others = 01.
if sy-subrc ne 0.
message i005.
endif.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form variant_f4
*&---------------------------------------------------------------------*
form variant_f4 using p_variant.
call function 'LVC_VARIANT_F4'
exporting
is_variant = w_variant
i_save = w_variant_save
importing
e_exit = w_exit
es_variant = wx_variant
exceptions
not_found = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
message i006.
endif.
if w_exit is initial.
w_variant-variant = wx_variant-variant.
p_variant = wx_variant-variant.
endif.
endform.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form get_data.
concatenate sap1filp sapfil into sap1fil.
if w_new = 'X'.
clear disp_tab.
select matkl matnr bismt wrkst groes
into (disp_tab-matkl, disp_tab-matnr, disp_tab-bismt,
disp_tab-wrkst, disp_tab-groes)
from mara where matnr in w_matnr
and matkl in w_matkl
and groes in s_groes
and wrkst in s_wrkst
and mstae = ''.
i_fldw = disp_tab.
select matnr werks dispo eisbe
into (disp_tab-matnr, disp_tab-werks,
disp_tab-dispo, disp_tab-eisbe)
from marc where matnr = disp_tab-matnr
and werks eq '7000'
and dispo in w_dispo.
select single lbkum into disp_tab-lbkum from mbew
where matnr = disp_tab-matnr
and bwkey = disp_tab-werks.
refresh i_mdps.
call function 'MD_ABBL_REPORTING'
exporting
ematnr = disp_tab-matnr
ewerks = disp_tab-werks
ecrpes = i_crpes
tables
mdpsx = i_mdps
exceptions
error_matmaster = 1
others = 2.
if sy-subrc = 0.
if w_date[] is initial.
w_date-low = '99991231'.
w_date-sign = 'I'.
w_date-option = 'EQ'.
append w_date.
endif.
loop at i_mdps.
case i_mdps-delkz.
when 'U1'.
if i_mdps-dat00 le w_date-low.
disp_tab-deprq = disp_tab-deprq + i_mdps-mng01.
endif.
when 'VC'.
if i_mdps-dat00 le w_date-low.
disp_tab-idprq = disp_tab-idprq + i_mdps-mng01.
endif.
when 'BA'.
disp_tab-reqrq = disp_tab-reqrq + i_mdps-mng01.
when 'BE'.
disp_tab-storq = disp_tab-storq + i_mdps-mng01.
endcase.
endloop.
endif.
select single bstmi into disp_tab-bstmi from marc
where matnr = disp_tab-matnr
and werks = disp_tab-werks.
select single maktx into disp_tab-maktx from makt
where matnr = disp_tab-matnr
and spras = 'E'.
if disp_tab-lbkum > 0 or
disp_tab-idprq > 0 or
disp_tab-deprq > 0 or
disp_tab-reqrq > 0 or
disp_tab-storq > 0.
append disp_tab.
endif.
disp_tab = i_fldw.
endselect.
endselect.
else.
* Open the datainfil.
open dataset sap1fil in text mode.
if sy-subrc <> 0.
write:/ 'Upload File Not Found'.
exit.
endif.
refresh i_fcc.
* Loop At data set.
do.
read dataset sap1fil into i_fcc.
if sy-subrc <> 0. exit. endif.
move-corresponding i_fcc to disp_tab.
append disp_tab.
enddo.
* Close Dataset.
close dataset sap1fil.
endif.
endform. " get_data
*&---------------------------------------------------------------------*
*& Form fieldcat_build
*&---------------------------------------------------------------------*
* Build up the headers for the fields in the Grid Display, and set
* the key-fields for freeze while scrolling.
************************************************************************
form fieldcat_build.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = wa_repid
i_internal_tabname = 'DISP_TAB'
i_inclname = wa_repid
changing
ct_fieldcat = i_fieldcat_alv.
loop at i_fieldcat_alv into w_fieldcat_alv.
case w_fieldcat_alv-fieldname.
when 'CKBOX'.
w_fieldcat_alv-seltext_s = text-011.
w_fieldcat_alv-seltext_m = text-011.
w_fieldcat_alv-seltext_l = text-011.
w_fieldcat_alv-reptext_ddic = text-011.
w_fieldcat_alv-key = 'X'.
w_fieldcat_alv-edit = 'X'.
w_fieldcat_alv-checkbox = 'X'.
when 'MATKL'.
w_fieldcat_alv-key = 'X'.
when 'MATNR'.
w_fieldcat_alv-key = 'X'.
w_fieldcat_alv-hotspot = 'X'.
when 'WERKS'.
w_fieldcat_alv-key = ''.
when 'IDPRQ'.
w_fieldcat_alv-seltext_s = text-009.
w_fieldcat_alv-seltext_m = text-009.
w_fieldcat_alv-seltext_l = text-009.
w_fieldcat_alv-reptext_ddic = text-009.
w_fieldcat_alv-key = ''.
when 'DEPRQ'.
w_fieldcat_alv-seltext_s = text-004.
w_fieldcat_alv-seltext_m = text-004.
w_fieldcat_alv-seltext_l = text-004.
w_fieldcat_alv-reptext_ddic = text-004.
w_fieldcat_alv-key = ''.
when 'REQRQ'.
w_fieldcat_alv-seltext_s = text-005.
w_fieldcat_alv-seltext_m = text-005.
w_fieldcat_alv-seltext_l = text-005.
w_fieldcat_alv-reptext_ddic = text-005.
w_fieldcat_alv-key = ''.
when 'STORQ'.
w_fieldcat_alv-seltext_s = text-006.
w_fieldcat_alv-seltext_m = text-006.
w_fieldcat_alv-seltext_l = text-006.
w_fieldcat_alv-reptext_ddic = text-006.
w_fieldcat_alv-key = ''.
when 'CONVERT'.
w_fieldcat_alv-seltext_s = text-010.
w_fieldcat_alv-seltext_m = text-010.
w_fieldcat_alv-seltext_l = text-010.
w_fieldcat_alv-reptext_ddic = text-010.
w_fieldcat_alv-key = ''.
w_fieldcat_alv-edit = 'X'.
when 'DELDAT'.
w_fieldcat_alv-seltext_s = text-012.
w_fieldcat_alv-seltext_m = text-012.
w_fieldcat_alv-seltext_l = text-012.
w_fieldcat_alv-reptext_ddic = text-012.
w_fieldcat_alv-key = ''.
w_fieldcat_alv-edit = 'X'.
when others.
endcase.
modify i_fieldcat_alv from w_fieldcat_alv.
endloop.
endform.
*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
form layout_build.
w_layout-zebra = 'X'.
w_layout-no_vline = ''.
w_layout-colwidth_optimize = 'X'.
w_layout-detail_popup = 'X'.
w_layout-detail_initial_lines = 'X'.
endform.
*&---------------------------------------------------------------------
*& Form call_crystal
*&---------------------------------------------------------------------
* text
*----------------------------------------------------------------------
form call_crystal.
w_callback_ucomm = 'CALLBACK_UCOMM'.
* If Batch write to list for spool output availability
if sy-batch = 'X' or
pa_print = 'X'.
if pa_print = 'X'.
lst_is_print-print = 'X1'.
endif.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = wa_repid
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
is_print = lst_is_print
tables
t_outtab = disp_tab.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
else.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'SIWB_WALLPAPER'
i_callback_program = wa_repid
i_default = 'X'
i_save = 'A'
is_variant = w_variant
is_layout = w_layout
i_callback_user_command = w_callback_ucomm
it_fieldcat = i_fieldcat_alv
tables
t_outtab = disp_tab.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
loop at disp_tab
where ckbox = ' '.
delete disp_tab.
endloop.
describe table disp_tab lines lin.
if lin ne 0.
perform build_bdc.
endif.
endif.
endif.
endform. " call_crystal
*&---------------------------------------------------------------------*
*& Form added_functions
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form added_functions.
refresh:s_wrkst, s_groes.
loop at w_wrkst.
if w_ast = 'X'.
concatenate w_wrkst-low '*' into w_wrkst-low.
w_wrkst-option = 'CP'.
endif.
move-corresponding w_wrkst to s_wrkst.
translate s_wrkst-low to upper case.
append s_wrkst.
translate s_wrkst-low to lower case.
append s_wrkst.
endloop.
loop at w_groes.
if w_ast = 'X'.
concatenate '*' w_groes-low '*' into w_groes-low.
w_groes-option = 'CP'.
endif.
move-corresponding w_groes to s_groes.
translate s_groes-low to upper case.
append s_groes.
translate s_groes-low to lower case.
append s_groes.
endloop.
*
if sscrfields-ucomm = 'FC01'.
call function 'Z_POPUP_TO_LIST_SORT_ORDER'
exporting
t_title = 'Setup Sorting Order'
w_popup = 'X'
tables
sortlist = i_sortord.
endif.
if sscrfields-ucomm = 'FC02'.
call function 'Z_POPUP_TO_LIST_FILES'
exporting
t_title = 'Basic Material Search Files'
dir_name = '/usr/sap/interfaces/reports'
file_mask = 'zmrp21_*'
importing
selfilename = getfil.
if not getfil is initial.
sapfil = getfil.
endif.
endif.
endform. " added_functions
*&---------------------------------------------------------------------*
*& Form added_inits
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form added_inits.
move 'Setup Sorting Order ' to sscrfields-functxt_01.
move 'Display Files on Server' to sscrfields-functxt_02.
refresh i_sortord.
i_sortord-fieldname = 'matkl'.
i_sortord-ddtext = 'Material Group'.
append i_sortord.
i_sortord-fieldname = 'matnr'.
i_sortord-ddtext = 'Material Number'.
append i_sortord.
i_sortord-fieldname = 'maktx'.
i_sortord-ddtext = 'Material Description'.
append i_sortord.
i_sortord-fieldname = 'bismt'.
i_sortord-ddtext = 'Old material'.
append i_sortord.
i_sortord-fieldname = 'wrkst'.
i_sortord-ddtext = 'Basic material'.
append i_sortord.
i_sortord-fieldname = 'groes'.
i_sortord-ddtext = 'Size/dimension'.
append i_sortord.
i_sortord-fieldname = 'werks'.
i_sortord-ddtext = 'Plant'.
append i_sortord.
i_sortord-fieldname = 'dispo'.
i_sortord-ddtext = 'MRP controller'.
append i_sortord.
i_sortord-fieldname = 'bstmi'.
i_sortord-ddtext = 'Min lot size'.
append i_sortord.
i_sortord-fieldname = 'lbkum'.
i_sortord-ddtext = 'On Hand'.
append i_sortord.
i_sortord-fieldname = 'eisbe'.
i_sortord-ddtext = 'Safety stock'.
append i_sortord.
i_sortord-fieldname = 'idprq'.
i_sortord-ddtext = 'Independant Req'.
append i_sortord.
i_sortord-fieldname = 'deprq'.
i_sortord-ddtext = 'Dependant Req'.
append i_sortord.
i_sortord-fieldname = 'reqrq'.
i_sortord-ddtext = 'Requisitions'.
append i_sortord.
i_sortord-fieldname = 'storq'.
i_sortord-ddtext = 'STO''s'.
append i_sortord.
endform. " added_inits
*&---------------------------------------------------------------------*
*& Form save_list_order
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form save_list_order.
call function 'Z_POPUP_TO_LIST_SORT_ORDER'
exporting
t_title = 'Setup Sorting Order'
w_popup = ' '
tables
sortlist = i_sortord.
loop at i_sortord.
write sy-tabix to fname right-justified.
translate fname using ' 0'.
concatenate 'f' fname+2(2) into fname.
assign (fname) to <fs1>.
<fs1> = i_sortord-fieldname.
translate <fs1> to upper case.
endloop.
sort disp_tab ascending by
(f01) (f02) (f03) (f04) (f05) (f06) (f07) (f08) (f09) (f10) (f11)
(f12) (f13) (f14) (f15) (f16) (f17) (f18) (f19) (f20).
endform. " save_list_order
*---------------------------------------------------------------------*
* FORM user_command *
*---------------------------------------------------------------------*
form callback_ucomm using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
if rs_selfield-sel_tab_field = 'DISP_TAB-MATNR'.
set parameter id 'MAT' field rs_selfield-value.
set parameter id 'WRK' field '7000'.
set parameter id 'BERID' field ' '.
call transaction 'MD04'.
endif.
when others.
endcase.
endform.
*&---------------------------------------------------------------------*
*& Form build_bdc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form build_bdc.
data: lgpro like marc-lgpro,
first(1) type c,
wa_date like sy-datum.
* PREPARE BDC
refresh bdcdata.
clear bdcdata.
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'=MEDOCTYPE'.
perform bdcitem using 'MEPO_TOPLINE-BSART'
'UB'.
perform bdcitem using 'MEPO_TOPLINE-BEDAT'
sy-datum.
*
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'=MEV4000BUTTON'.
perform bdcitem using 'MEPO_TOPLINE-SUPERFIELD'
'5200'.
*
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'=TABHDT9'.
*
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'=MEV4001BUTTON'.
perform bdcitem using 'MEPO1222-EKORG'
'7000'.
perform bdcitem using 'MEPO1222-EKGRP'
'J10'.
perform bdcitem using 'MEPO1222-BUKRS'
'ABFI'.
*
first = 'Y'.
loop at disp_tab.
clear lgpro.
if not wa_date is initial and
disp_tab-deldat is initial.
disp_tab-deldat = wa_date.
endif.
select single lgpro into lgpro
from marc
where matnr = disp_tab-matnr and
werks = '7000'.
*
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'/00'.
perform bdcitem using 'MEPO1211-EMATN(01)'
disp_tab-matnr.
perform bdcitem using 'MEPO1211-MENGE(01)'
disp_tab-convert.
perform bdcitem using 'MEPO1211-EEIND(01)'
disp_tab-deldat.
perform bdcitem using 'MEPO1211-NAME1(01)'
'7000'.
perform bdcitem using 'MEPO1211-LGOBE(01)'
lgpro.
*
if first = 'Y'.
first = 'N'.
wa_date = disp_tab-deldat.
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'=MEPO1211EDITFILTER'.
*
perform bdchead using 'SAPLSKBH'
'1500'.
perform bdcitem using 'BDC_OKCODE'
'=DTC_WLSE'.
*
perform bdchead using 'SAPLSKBH'
'1500'.
perform bdcitem using 'BDC_OKCODE'
'=DTC_CONT'.
*
perform bdchead using 'SAPLSSEL'
'1104'.
perform bdcitem using 'BDC_OKCODE'
'=%00411050000197408'.
*
perform bdchead using 'SAPLALDB'
'3000'.
perform bdcitem using 'BDC_OKCODE'
'=NOINT'.
*
perform bdchead using 'SAPLALDB'
'3000'.
perform bdcitem using 'BDC_OKCODE'
'=ACPT'.
perform bdcitem using 'RSCSEL-ILOW_E(01)'
'1'.
perform bdcitem using 'RSCSEL-IHIGH_E(01)'
'99999'.
*
perform bdchead using 'SAPLSSEL'
'1104'.
perform bdcitem using 'BDC_OKCODE'
'=CRET'.
endif.
*
endloop.
*
perform bdchead using 'SAPLMEGUI'
'0014'.
perform bdcitem using 'BDC_OKCODE'
'=MESAVE'.
*
call transaction 'ME21N' using bdcdata
mode p_modes
update 'S' messages into messtab.
loop at messtab.
if messtab-msgv2+0(4) = '4500'.
message i001 with messtab-msgv1 messtab-msgv2 'created'.
endif.
endloop.
endform. " build_bdc
*&---------------------------------------------------------------------*
*& Form bdchead
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_1713 text
* -->P_1714 text
*----------------------------------------------------------------------*
form bdchead using p_program
p_dynpro.
clear bdcdata.
move : p_program to bdcdata-program,
p_dynpro to bdcdata-dynpro,
'X' to bdcdata-dynbegin.
append bdcdata.
endform. " bdchead
*&---------------------------------------------------------------------*
*& Form bdcitem
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_1718 text
* -->P_1719 text
*----------------------------------------------------------------------*
form bdcitem using p_fnam
p_fval.
clear bdcdata.
move p_fnam to bdcdata-fnam.
write p_fval to bdcdata-fval left-justified.
append bdcdata.
endform. " bdcitem