Bdc using FBS1 & F.81
HI,
how can i create this programm using call transaction there is two tcodes are used in recording .
if it is done bu session method plz provide me codes for this.
thanks jayant
Hi,
PERFORM bdc_transaction USING 'FBS1'.
After calling 1st T-Code
Clear BDC data.
ie.
clear i_bdcdata[].
After clear itab continue as per yur way.
otherwise
use 1st T-Code itab i_bdcdata .
use 2st T-Code itab i_bdcdata_01.
Reward if usefull...
Thanks,
Durai.V
Similar Messages
-
Transfer data through bdc using as01 tr. code
hi gurus,
please tell me transfer data through bdc using as01 tr. code.please guide me through coading how to i will proceed.i am using call tr. through recording.
thanks
subhasisSubhasis,
Best way to Convert data to AS01 is to Use BAPI BAPI_FIXEDASSET_CREATE.
Trouble free and easy conversion.
Hope this helps.
Vinodh Balakrishnan -
Can we create multiple session in BDC using Call session?
Hi Experts,
Can we create multiple sessions in BDC using Call Session?
Scenario:
Program has to upload 1 million records,so can we programmatically create multiple sessions such that after every 50thousand records we create a different session.
For moment due to large number of records BDC DYNPRO and BDC Field are unable to hold the large number of records,due to which we get a Out of memory error.
Thanks in advance.
ShilpaHi
If ITAB is your table with the data to be transfered:
Open the first session:
CALL FUNCTION 'BDC_OPEN_GROUP'.........
IF SY-SUBRC = 0.
FL_OPEN = 'X'.
ENDIF.
LOOP AT ITAB.
IF FL_OPEN = SPACE.
Create new session
CALL FUNCTION 'BDC_OPEN_GROUP'.........
IF SY-SUBRC = 0.
FL_OPEN = 'X'.
ENDIF.
ENDIF.
Here elaborate your data and fill BDCDATA
Insert the transaction:
CALL FUNCTION 'BDC_INSERT'
IF SY-SUBRC = 0.
COUNT = COUNT + 1.
IF COUNT = COUNT_MAX.
COUNT = 0.
Close the session
IF FL_OPEN = 'X'.
CALL BDC_CLOSE_GROUP
IF SY-SUBRC = 0.
FL_OPEN = SPACE.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
Max -
hai
can anyone post me bdc using session method plzHi,
ABAP BDC SESSION METHOD SAMPLE CODE
pool of form routines
include zmppn001.
Define BDC Table Structure
data: begin of itab_bdc_tab occurs 0.
include structure bdcdata.
data: end of itab_bdc_tab.
Input record layout of Leagcy File
data: begin of itab_xcel occurs 0,
matnr(18) type c,
werks(4) type c,
alnag(2) type c,
verid(4) type c,
text1(40) type c,
bstmi like mkal-bstmi,
bstma like mkal-bstma,
adatu(10) type c,
bdatu(10) type c,
stlal(2) type c,
stlan(1) type c,
serkz(1) type c,
mdv01(8) type c,
elpro(4) type c,
alort(4) type c,
end of itab_xcel.
data: begin of lt_pp04_cache occurs 0,
matnr like itab_xcel-matnr,
werks like itab_xcel-werks,
alnag like itab_xcel-alnag,
plnnr like mapl-plnnr,
arbpl like crhd-arbpl,
ktext like crtx-ktext,
end of lt_pp04_cache.
data: v_ssnnr(4) type n,
v_lines_in_xcel like sy-tabix,
v_ssnname like apqi-groupid,
v_trans_in_ssn type i,
wa_xcel LIKE itab_xcel,
l_tabix like sy-tabix,
v_matnr like rc27m-matnr,
v_plnnr like mapl-plnnr,
v_plnal like mapl-plnal,
v_tcode like sy-tcode value 'C223',
v_plnty like plas-plnty value 'R',
v_objty like crhd-objty value 'A',
v_plpo_steus like plpo-steus value 'PP04',
v_verwe like crhd-verwe value '0007'.
Parameters
selection-screen: skip 3.
selection-screen: begin of block 1 with frame.
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'
obligatory,
bdc session name prefix
p_bdcpfx(6) default 'ZPVCRT'
obligatory,
number for transction per BDC session
p_trnssn type i
default 2000 obligatory,
retain the BDC session after successfull execution
p_keep like apqi-qerase
default 'X',
user who will be executing BDC session
p_uname like apqi-userid
default sy-uname
obligatory.
selection-screen: end of block 1.
possible entry list (F4 dropdown) for input file name
at selection-screen on value-request for p_name.
*-SELECT FILE FROM USERS LOCAL PC
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
def_path = 'C:\Temp\'
mask = ',.,..'
mode = 'O'
title = 'Select File '(007)
importing
filename = p_name
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
begin the show
start-of-selection.
read data from input file
perform transfer_xcel_to_itab.
loop at itab_xcel.
hang on to xcel line num
l_tabix = sy-tabix.
each line in the xcel file marks begining of new prod.version defn
if num-of-trnas-in-session = 0, create new BDC session
if v_trans_in_ssn is initial.
perform bdc_session_open.
endif.
begin new bdc script for rtg create trans
fill in bdc-data for prod.version maintenance screens
perform bdc_build_script.
insert the bdc script as a BDC transaction
perform bdc_submit_transaction.
keep track of how many BDC transactions were inserted in the BDC
session
add 1 to v_trans_in_ssn.
if the user-specified num of trans in BDC session is reached OR
if end of input file is reached, close the BDC session
if v_trans_in_ssn = p_trnssn or
l_tabix = v_lines_in_xcel.
perform bdc_session_close.
clear v_trans_in_ssn.
endif.
endloop.
top-of-page.
call function 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
FORM TRANSFER_XCEL_TO_ITAB *
Transfer Xcel Spreadsheet to SAP Internal Table *
form transfer_xcel_to_itab.
Read the tab-delimited file into itab
call function 'WS_UPLOAD'
exporting
filename = p_name
filetype = 'DAT'
IMPORTING
filelength = flength
tables
data_tab = itab_xcel
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
others = 8.
if sy-subrc = 0.
sort the data
sort itab_xcel by matnr werks.
clear v_lines_in_xcel.
if no data in the file - error out
describe table itab_xcel lines v_lines_in_xcel.
if v_lines_in_xcel is initial.
write: / 'No data in input file'.
stop.
endif.
else.
if file upload failed - error out
write: / 'Error reading input file'.
stop.
endif.
endform.
FORM BDC_SESSION_OPEN *
Open BDC Session *
form bdc_session_open.
create bdc session name = prefix-from-selectn-screen + nnnn
add 1 to v_ssnnr.
concatenate p_bdcpfx v_ssnnr into v_ssnname.
open new bdc session
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = v_ssnname
keep = p_keep
user = p_uname
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11.
endform.
FORM BDC_BUILD_SCRIPT *
Build BDC *
form bdc_build_script.
data: l_arbpl like crhd-arbpl,
l_text1 like mkal-text1,
l_mdv01 like mkal-mdv01,
l_mapl like mapl.
clear bdc-data itab - begin of new bdc transaction
clear itab_bdc_tab.
refresh itab_bdc_tab.
read material cross reference tables to determine sap part#
clear : v_matnr, v_plnnr, v_plnal.
perform read_matnr_cross_ref using itab_xcel-matnr
itab_xcel-werks
changing v_matnr.
determine the version description to use
if itab_xcel-text1 is initial.
l_text1 = itab_xcel-verid.
else.
l_text1 = itab_xcel-text1.
endif.
determine the routing group# and group ctr# to use
perform read_routing .
determine the production line to use
if itab_xcel-mdv01 is initial.
if not provided in the file then:
prod line = work ctr on the last PP04 op of the rtg determined above
perform read_wc_on_last_pp04 using v_plnnr v_plnal
changing l_mdv01.
NOTE: when executing the above form\routine, if v_plnnr is initial
or v_plnal is initial, THEN l_mdv01 will automatically be
returned blank (ie initial)
else.
l_mdv01 = itab_xcel-mdv01.
endif.
build bdc script
perform bdc_build_script_record
fill in initial screen
using: 'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=ENTE',
' ' 'MKAL-WERKS' itab_xcel-werks,
' ' 'MKAL-MATNR' v_matnr,
' ' 'MKAL_ADMIN-DISPO' space,
' ' 'MKAL-PLNNR' space,
' ' 'MKAL_ADMIN-STTAG' space,
' ' 'MKAL-PLNNG' space,
' ' 'MKAL-MDV01' space,
' ' 'MKAL-PLNNM' space,
click create button on initial screen and go to detail screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=CREA',
fill in the detail screen and go back to initial screen
'X' 'SAPLCMFV' '2000',
' ' 'BDC_OKCODE' '=CLOS',
' ' 'MKAL_EXPAND-MATNR' v_matnr,
' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,
' ' 'MKAL_EXPAND-TEXT1' l_text1,
' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,
' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,
' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,
' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,
' ' 'MKAL_EXPAND-PLTYG' v_plnty,
' ' 'MKAL_EXPAND-PLNNG' v_plnnr,
' ' 'MKAL_EXPAND-ALNAG' v_plnal,
' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,
' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,
' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,
' ' 'MKAL_EXPAND-MDV01' l_mdv01,
' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,
' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,
save the production version from initial screen
'X' 'SAPLCMFV' '1000',
' ' 'BDC_OKCODE' '=SAVE'.
endform.
FORM BDC_SUBMIT_TRANSACTION *
Submit BDC Session *
form bdc_submit_transaction.
Load BDC script as a trqansction in BDC session
call function 'BDC_INSERT'
exporting
tcode = v_tcode
tables
dynprotab = itab_bdc_tab
exceptions
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
endform.
FORM BDC_BUILD_SCRIPT_RECORD *
form bdc_build_script_record using dynbegin name value.
clear itab_bdc_tab.
if dynbegin = 'X'.
move: name to itab_bdc_tab-program,
value to itab_bdc_tab-dynpro,
'X' to itab_bdc_tab-dynbegin.
else.
move: name to itab_bdc_tab-fnam,
value to itab_bdc_tab-fval.
shift itab_bdc_tab-fval left deleting leading space.
endif.
append itab_bdc_tab.
endform.
FORM BDC_SESSION_CLOSE *
Close BDC Session *
form bdc_session_close.
close the session
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
skip 2.
if sy-subrc ne 0.
write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
else.
write : / 'Session created:', v_ssnname,
50 '# of transactions:', v_trans_in_ssn.
endif.
endform.
*& Form read_routing_cache
*FORM read_routing_cache USING pi_matnr
pi_werks
pi_alnag
pi_verid
pi_mdv01.
DATA: BEGIN OF lt_plpo OCCURS 0,
vornr LIKE plpo-vornr,
objty LIKE crhd-objty,
objid LIKE crhd-objid,
arbpl LIKE crhd-arbpl,
END OF lt_plpo,
l_mapl_plnnr LIKE mapl-plnnr.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
SELECT plnnr INTO l_mapl_plnnr
FROM mapl UP TO 1 ROWS
WHERE matnr = pi_matnr AND
werks = pi_werks AND
plnty = 'R' AND
plnal = pi_alnag AND
loekz = space.
ENDSELECT.
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
-- the work center was not determined yet AND
-- work center was really needed for this line in the input file
then
-- read the work center from last PP04 operation on the routing
-- update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
*ENDFORM. " read_last_pp04_operation_cache
*& Form read_routing
form read_routing.
data: begin of lt_mapl occurs 0,
plnnr like mapl-plnnr,
plnal like mapl-plnal,
end of lt_mapl,
l_arbpl like crhd-arbpl.
get all the rtg# and grp ctr# from MAPL
select plnnr plnal
into corresponding fields of table lt_mapl
from mapl
where matnr = v_matnr and
werks = itab_xcel-werks and
plnty = v_plnty and "Rate Routing
loekz = space. "with del flag = OFF
sort lt_mapl by plnal.
if not itab_xcel-verid is initial.
if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#
if itab_xcel-verid = '0001'.
read table lt_mapl index 1.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
else.
if the verid<>0001 then use the rtg-grp# and grp-ctr# of the routing
whose work center on the last PP04 operation matches the given verid
loop at lt_mapl.
clear l_arbpl.
get the work center from the last PP04 operation
perform read_wc_on_last_pp04 using lt_mapl-plnnr
lt_mapl-plnal
changing l_arbpl.
if itab_xcel-verid = l_arbpl.
v_plnnr = lt_mapl-plnnr.
v_plnal = lt_mapl-plnal.
exit.
endif.
endloop.
endif.
else.
do nothing
endif.
For version IDs that are other then '0000' or 'ZWIP' :--
if itab_xcel-verid NE '0000' and
itab_xcel-verid NE 'ZWIP'.
if routing group# or group counter was not determined, make the
valid-to date 99/99/9999 so that the BDC, on execution, errors out.
if v_plnnr is initial or
v_plnal is initial.
itab_xcel-bdatu = '99/99/9999'.
endif.
endif.
determine the routing group#
CLEAR lt_pp04_cache.
chk if its in the cache first, if not then get it from MAPL table
and put it in the cache
READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
IF sy-subrc = 0.
do nothing - lt_pp04_cache header line has rtg#
ELSE.
get the routing group # from MAPL
put it in the cache internal table
IF NOT l_mapl_plnnr IS INITIAL.
lt_pp04_cache-matnr = pi_matnr.
lt_pp04_cache-werks = pi_werks.
lt_pp04_cache-alnag = pi_alnag.
lt_pp04_cache-plnnr = l_mapl_plnnr.
APPEND lt_pp04_cache.
ENDIF.
ENDIF.
if the rtg# was determined AND
-- the work center was not determined yet AND
-- work center was really needed for this line in the input file
then
-- read the work center from last PP04 operation on the routing
-- update the cache accordingly
IF NOT lt_pp04_cache-plnnr IS INITIAL AND
lt_pp04_cache-arbpl IS INITIAL AND
( pi_verid IS INITIAL OR
pi_mdv01 IS INITIAL ).
read the last PP04 operation
CLEAR lt_plpo.
REFRESH lt_plpo.
SELECT vornr eobjty eobjid e~arbpl
INTO CORRESPONDING FIELDS OF TABLE lt_plpo
FROM plas AS b
INNER JOIN plpo AS c
ON bplnty = cplnty AND
bplnnr = cplnnr AND
bzaehl = czaehl
INNER JOIN crhd AS e
ON carbid = eobjid
WHERE b~plnty = v_plnty AND
b~plnnr = lt_pp04_cache-plnnr AND
b~plnal = lt_pp04_cache-alnag AND
c~loekz = space AND
c~steus = v_plpo_steus AND
e~objty = v_objty AND
e~werks = lt_pp04_cache-werks AND
e~verwe = v_verwe.
SORT lt_plpo BY vornr DESCENDING.
READ TABLE lt_plpo INDEX 1.
IF NOT lt_plpo-arbpl IS INITIAL.
lt_pp04_cache-arbpl = lt_plpo-arbpl.
read work center description
SELECT SINGLE ktext INTO lt_pp04_cache-ktext
FROM crtx WHERE objty = lt_plpo-objty AND
objid = lt_plpo-objid AND
spras = sy-langu.
the following read will get the index of the correct record to be
updated in the cache
READ TABLE lt_pp04_cache
WITH KEY matnr = pi_matnr
werks = pi_werks
alnag = pi_alnag.
MODIFY lt_pp04_cache
INDEX sy-tabix
TRANSPORTING arbpl ktext.
ENDIF.
ENDIF.
endform. " read_last_pp04_operation_cache
*& Form read_wc_on_last_pp04
form read_wc_on_last_pp04 using pi_plnnr
pi_plnal
changing pe_arbpl.
data: begin of lt_plpo occurs 0,
vornr like plpo-vornr,
objty like crhd-objty,
objid like crhd-objid,
arbpl like crhd-arbpl,
end of lt_plpo.
get all the PP04 operations for the given rtg# & grp-ctr#
select vornr eobjty eobjid e~arbpl
into corresponding fields of table lt_plpo
from plas as b
inner join plpo as c
on bplnty = cplnty and
bplnnr = cplnnr and
bzaehl = czaehl
inner join crhd as e
on carbid = eobjid
where b~plnty = v_plnty and "Rate Routing
b~plnnr = pi_plnnr and
b~plnal = pi_plnal and
c~loekz = space and "Oper Del Flag = OFF
c~steus = v_plpo_steus and "PP04
e~objty = v_objty. "WC Obj Type = 'A'
read the last operation
sort lt_plpo by vornr descending.
read table lt_plpo index 1.
pe_arbpl = lt_plpo-arbpl.
endform.
Reward Points if useful
Raghunath.S
9986076729 -
hi,
can any post me bdc using oops that is material creation.
plz its urgentHi Friend,
Please do not use BDC to create material.
Use BAPI BAPI_MATERIAL_SAVEDATA to create a material, it will tackle OOPS scenario also.
Regards
Krishnendu -
hi gurus,
plz give codes for bdc using for all entries i am new to abap
thanks jayantFOA is for passing one internal table to select statement..
Press F1 on it, it will give you the details.
if you really want to pass more than one tables, you can use range tables.. just similar to what we do in case of select-options..
as in
select x y z from dbtab
where x in s_x
y in s_y.
hope you understand.. -
How to create bdc for fbs1 using both call transaction and session
Hi Friends,
i have one problem with tcode FBS1, i need to create a bdc program for both call transaction and session method using subroutine.
first call transaction needs to execute if there is an error sesion has to execute. if u have code please forward.
thanks in advance.
chandramouli pothuguntawhere as in call transaction we can do error handling explictly.those errors are stored in one file .this file will send to the error log(session method),i.e session log.
in the above case we use both call transaction n session method at time in one program.sample code is below ,go through it .
data : begin of itxk01 occurs 0,
end of itxk01.
data : bdcdata like itbdcdata occurs 0 with header line.
data : itbdcmsgcoll like itbdcmsgcoll occurs 0 with header line,
itxk01 like itxk01-dup occurs 0 with header line.
call gui-upload.
loop at itxk01.
refresh itxk01.
perform bdc-dynpr0 using 'prg' 'scr'
perform bdc-dynfld using fnam fval
call transaction 'xk01' using bdcdata mode 'a' update 's' messages into itbdcmsgcoll.
if sy-subrc ne 0.
append itxk01 into itxk01-dup.
endif.
endloop.
if not itxk01-dup[] is initial.
refresh itck01.
call bdc_open_group
itxk01 = itxk01-dup.
loop at itxk01.
refresh itxk01.
perform bdc-dynpr0 using 'prg' 'scr'
perform bdc-dynfld using fnam fval
call bdc-insert.
endloop.
call bdc-close-group.
form bdc-dynpr0 using pr sc
endform .
form bdc-field using fnam faval
endform.
this will help u.
reward points for me
kiran -
Is it possible to skip the screen in BDC using IF statement.
Hi Friends,
I have written a report using BDC for tcode CO11 thru recording using CALL TRANSACTION.
Case 1:
If I go to transaction CO11 (screen number 100) and give the order number which has more than 1 operations to be partially confirmed and press ENTER a pop-up screen (screen number 140) appears where in I need to select the operation number and after selecting the required operation number it automatically takes me to another screen (screen number 150).
Case 2:
If I go to transaction CO11 (screen number 100) and give the order number which has only 1 operation to be partially confirmed and press ENTER it directly takes me to screen 150 skiping screen 140.
When I enter the order number which has more than 1 operations to be partially confirmed on my selection screen, my code is working fine as needed.
But, when I enter the order number which has 1 operation to be partially confirmed on my selection screen, it is giving me error in my BDCMSGCOLL saying that the screen 140 doesn't exist.
Is there any way, Can I skip screen 140 using IF statement?
My thoughts:
1. calling screen 100.
After calling screen 100, I have put the pop-up operation numbers in an ITAB.
DESCRIBE table lines ITAB <variable>.
At NEW <order-field>.
IF <variable> = 1.
2. calling screen 140. "I need some help here to skip the screen 140
" Will this logic work?
ENDIF.
ENDAT.
3. calling screen 150.
Rest everything is working fine.
Will my above logic works correctly? I would appreciate if someone could help me with this.
Thanks in Advance.Hi,
Try something like this:
1. Call Screen 100.
Check if screen 140 needs to be called depending on your custom logic. Lets say you populate a variable as 'X' if it needs to be called.
Then write:
if valiable = 'X'.
Call screen 140.
Enter Screen 140 details.
endif.
Call screen 150.
Here the 'Call Screen' is nothing but the code you extracted after BDC recording.
Thanks.
Ravi' -
How to keep long text in bdc using create_text function module
hi,
ihave bdc in that i having field like long text i have to upload the long text using create_text function module how to use and where to use in bdc. wat parameters i have to pass exactly.
i need some other information like how can i pass this to BDC i got like this .
can u plz check it.
its a length of 255 chaters
perform bdc_field using 'RSTXT-TXLINE(02)'
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
& 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'.
perform bdc_field using 'RSTXT-TXLINE(03)'
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
& 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.
perform bdc_field using 'RSTXT-TXLINE(04)'
'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
& 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'.
perform bdc_field using 'RSTXT-TXLINE(05)'
'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh'
& 'hhhhhhhhhhhhhhhhhhhhhh'.Hi,
Use this coding where do u want,
data: begin of textline occurs 10.
include structure tline.
data: end of textline.
start-of-selection.
textline-tdformat = '*'.
textline-tdline = 'TESTING FOR CREATION OF TEXT'.
append textline.
clear textline.
call function 'CREATE_TEXT'
exporting
fid = '0013'
flanguage = sy-langu
fname = '0095000501'
fobject = 'VBBK'
tables
flines = textline
exceptions
no_init = 01
no_save = 02.
end-of-selection. -
Error in BDC using 'N' mode while creating production order
Hi,
I am trying to create a production order ( transaction CO01 ) by using a BDC. I just have to fill the header details, components , assign the component to operation , save and exit. When I am running the BDC in 'A' or 'E' mode, it works fine. The 'E' mode doesnt stop anywhere and successfully creates the production order . But when I change the mode to 'N', it throws an error "No batch input data for the screen SAPLCOKO1 0115". I am using Call transaction in BDC to create the production order. What could be the issue? Can someone throw some light?
Thanks,
SuganyaHi Suganya,
I guess that Chandra Madapati is right. I also faced the same issue for another transaction.
If you want to disable the batch input (sy-binpt), you can use the addition OPTIONS FROM in call transaction statement.
It refers to the structure CTU_PARAMS in ABAP dictionary and contains the following components:
Component
Meaning
DISMODE
Processing mode for batch input processing. Values as for the MODE addition.
UPMODE
Processing mode for batch input processing. Values as for the UPDATE addition.
CATTMODE
CATT mode for batch input processing. CATT means Computer Aided Testtool. While batch input is mostly used for data transfer, CATT processes are to be viewed as more complex transactions, since they are reusable tests. Values: " " (no CATT mode), "N" (CATT without single screen control), "A" (CATT with single screen control).
DEFSIZE
Selection as to whether the screens of the called transaction are displayed in the standard screen size. Values "X" (standard size), " " (current size).
RACOMMIT
Selection as to whether the COMMIT WORK statement terminates batch input processing or not. Values: " " (COMMIT WORK terminates processing), "X" ( COMMIT WORK does not terminate processing).
NOBINPT
Selection for the symbol field sy-binpt. Values: " " (sy-binpt contains in the called transaction "X"), "X" (sy-binpt contains in the called transaction " ").
NOBIEND
Selection for the system field sy-binpt. Values: " " (sy-binpt contains "X" after the end of the batch input data in the called transsaction ) "X" (sy-binpt contains " " after the end of the batch input data in the called transaction).
In this, if you give NOBINPT as 'X', the system field sy-binpt becomes disabled. You can also set the processing mode and update mode using DISMODE and UPMODE respectively.
Thanks & Regards,
T. Prasanna Kumar -
More than 1 line items in bdc using table controls for BOM
Hi....
how do u update more than one line item for BOM using BDC table control.......
is there any specific command for doing that.......
hav tried d following code bt it takes the flatfile i/p FOR 2 LINE ITEMS as 2 different BOM'S.....
would appreciate ur help....plz provide code.............
REPORT zbdc4_cs01
NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
DATA : a TYPE i,
b type i,
c type i.
DATA : BEGIN OF it_rec OCCURS 0,
rec(200) TYPE c,
END OF it_rec.
DATA : BEGIN OF ctab OCCURS 0,
matnr(18),
werks(4),
stlan(1),
END OF ctab.
DATA : BEGIN OF xtab OCCURS 0,
idnrk(18),
menge(13),
postp(1),
END OF xtab.
DATA : BEGIN OF itab OCCURS 0,
matnr(18),
werks(4),
stlan(1),
idnrk(18),
menge(13),
postp(1),
END OF itab.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:/TEST4.TXT'
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_rec.
LOOP AT it_rec.
a = strlen( it_rec-rec ).
if a = 55.
itab-matnr = it_rec-rec+0(18).
itab-werks = it_rec-rec+18(4).
itab-stlan = it_rec-rec+22(1).
itab-idnrk = it_rec-rec+23(18).
itab-menge = it_rec-rec+41(13).
itab-postp = it_rec-rec+54(1).
APPEND itab.
elseif a > 55.
itab-matnr = it_rec-rec+0(18).
itab-werks = it_rec-rec+18(4).
itab-stlan = it_rec-rec+22(1).
itab-idnrk = it_rec-rec+23(18).
itab-menge = it_rec-rec+41(13).
itab-postp = it_rec-rec+54(1).
APPEND itab.
itab-idnrk = it_rec-rec+55(18).
itab-menge = it_rec-rec+73(13).
itab-postp = it_rec-rec+86(1).
APPEND itab.
endif.
ENDLOOP.
PERFORM open_group.
LOOP AT itab.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29N-STLAN'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RC29N-MATNR'
itab-matnr. "'3000000107'.
PERFORM bdc_field USING 'RC29N-WERKS'
itab-werks. "'UN02'.
PERFORM bdc_field USING 'RC29N-STLAN'
itab-stlan. "'1'.
PERFORM bdc_field USING 'RC29N-STLAL'
PERFORM bdc_field USING 'RC29N-DATUV'
'11.08.2008'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0110'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RC29K-BMENG'
'1'.
PERFORM bdc_field USING 'RC29K-STLST'
'1'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29K-EXSTL'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0111'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29K-LABOR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0140'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29P-POSTP(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RC29P-IDNRK(01)'
itab-idnrk. "'1000000232'.
PERFORM bdc_field USING 'RC29P-MENGE(01)'
itab-menge. "'100'.
PERFORM bdc_field USING 'RC29P-POSTP(01)'
itab-postp. "'L'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0130'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29P-POSNR'.
PERFORM bdc_field USING 'RC29P-POSNR'
'0010'.
PERFORM bdc_field USING 'RC29P-IDNRK'
'1000000232'.
PERFORM bdc_field USING 'RC29P-MENGE'
'100'.
PERFORM bdc_field USING 'RC29P-MEINS'
'KG'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0131'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29P-POTX1'.
PERFORM bdc_field USING 'RC29P-SANKA'
'X'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0140'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29P-POSNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0140'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RC29P-POSNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=FCBU'.
PERFORM bdc_transaction USING 'CS01'.
ENDLOOP.
PERFORM close_group.Hi
Check this sample code for the Table Control in BDC:
data: fnam(20) type c.
move 1 to id.
loop at TI_STAGING WHERE VENDOR = IT_STAGING-VENDOR AND DOCDATE = IT_STAGING-DOCDATE.
concatenate 'RM06E-EPSTP(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-itmcategory.
concatenate 'EKPO-KNTTP(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-accassignment.
concatenate 'EKPO-EMATN(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-material.
concatenate 'EKPO-TXZ01(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-shortxt.
quan = ti_staging-poqty.
concatenate 'EKPO-MENGE(0' id ')' into fnam.
perform bdc_field using fnam quan.
concatenate 'RM06E-EEIND(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-deliverydate.
netpr = ti_staging-netpr.
concatenate 'EKPO-NETPR(0' id ')' into fnam.
perform bdc_field using fnam netpr.
concatenate 'EKPO-MATKL(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-mategroup.
concatenate 'EKPO-WERKS(0' id ')' into fnam.
perform bdc_field using fnam TI_STAGING-plant.
ID = ID + 1.
ENDLOOP.
Regards,
Vishwa. -
Hi All,
I'm creating a BDC session calling the VA01.
my problem is where do I put my code? I test it and I still got a blank in header text pick list.
Codes is more helpful so I can compare my work.
Thanks.here is my code for BDC.
data: begin of record,
TXLINE_02_028(072),
end of record.
****MESLAN
clear: v_itm, v_kwmeng, v_mabnr.
LOOP AT t_hdr .
*-- HEADER
PERFORM fill_dynpro USING 'SAPMV45A' '0101' 'X'.
PERFORM fill_field USING: 'VBAK-AUART' p_auart,
'VBAK-VKORG' t_hdr-vkorg,
'VBAK-VTWEG' t_hdr-vtweg,
'VBAK-SPART' t_hdr-spart,
'BDC_OKCODE' '/00'.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '/00'.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '=KBES'.
PERFORM fill_dynpro USING 'SAPMV45A' '4002' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'VBKD-BSARK' P_BSARK,
'BDC_OKCODE' '/00'.
PERFORM fill_dynpro USING 'SAPMV45A' '4002' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'VBKD-BSARK' P_BSARK,
'BDC_OKCODE' '/EBACK'.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '=POAN'.
LOOP AT t_line WHERE bstnk EQ t_hdr-bstnk . " Select all line items
*-- LINE ITEMS
CONCATENATE 'RV45A-MABNR(' '0' VAL ')' INTO v_MABNR.
CONCATENATE 'RV45A-KWMENG(' '0' VAL ')' INTO v_kwmeng.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
v_MABNR t_line-matnr,
v_kwmeng t_line-kwmeng,
'BDC_OKCODE' '/00'.
*---- for t_curlin
v_itm = val * 10 .
t_curlin = t_line.
t_curlin-lineno = v_itm .
APPEND t_curlin .
*---- for line item
VAL = VAL + 1.
endloop.
VAL = 01.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '=SICH'.
CALL TRANSACTION 'VA01' USING t_bdctab
MODE p_mode
UPDATE c_s
MESSAGES INTO t_message .
IF sy-subrc NE 0 . " Post errored sessions- for correction
v_errflg = c_x . " Online posting error - open session
v_errno = v_errno + 1 .
PERFORM append_mail_table .
PERFORM open_session .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'VA01' "c_va01
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
TABLES
dynprotab = t_bdctab
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
ELSE .
t_text-tdline = t_hdr-text .
APPEND t_text .
CLEAR t_text .
WRITE sy-msgv2 TO v_vbeln RIGHT-JUSTIFIED .
TRANSLATE v_vbeln USING c_0 .
v_tdname = v_vbeln . "' order no.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = c_z961
flanguage = p_spras
fname = v_tdname
fobject = c_vbbk
save_direct = c_x
FFORMAT = '*'
TABLES
flines = t_text
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
CLEAR t_text . REFRESH t_text .
IF sy-subrc NE 0 .
WRITE : / c_er_load , v_tdname .
ENDIF .
v_succno = v_succno + 1 .
ENDIF .
CLEAR t_bdctab . REFRESH t_bdctab .
endloop.
IF v_errflg EQ c_x .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc EQ 0 .
MESSAGE i260(zo) WITH text-i01.
ENDIF .
ENDIF .
ENDFORM. -
Hi All,
Pls Send me sample code for using Bapi in a Bdc Program to upload Flat file
(non-SAP) Data into SAP R/3 .
Rgds
Rafi .Hi
You can straight use a BAPI and upload the data into SAP like how you do using a BDC program.
see the doc
BAPI - BAPIs (Business Application Programming Interfaces) are the standard SAP interfaces. They play an important role in the technical integration and in the exchange of business data between SAP components, and between SAP and non-SAP components. BAPIs enable you to integrate these components and are therefore an important part of developing integration scenarios where multiple components are connected to each other, either on a local network or on the Internet.
BAPIs allow integration at the business level, not the technical level. This provides for greater stability of the linkage and independence from the underlying communication technology.
LSMW- No ABAP effort are required for the SAP data migration. However, effort are required to map the data into the structure according to the pre-determined format as specified by the pre-written ABAP upload program of the LSMW.
The Legacy System Migration Workbench (LSMW) is a tool recommended by SAP that you can use to transfer data once only or periodically from legacy systems into an R/3 System.
More and more medium-sized firms are implementing SAP solutions, and many of them have their legacy data in desktop programs. In this case, the data is exported in a format that can be read by PC spreadsheet systems. As a result, the data transfer is mere child's play: Simply enter the field names in the first line of the table, and the LSM Workbench's import routine automatically generates the input file for your conversion program.
The LSM Workbench lets you check the data for migration against the current settings of your customizing. The check is performed after the data migration, but before the update in your database.
So although it was designed for uploading of legacy data it is not restricted to this use.
We use it for mass changes, i.e. uploading new/replacement data and it is great, but there are limits on its functionality, depending on the complexity of the transaction you are trying to replicate.
The SAP transaction code is 'LSMW' for SAP version 4.6x.
Check your procedure using this Links.
BAPI with LSMW
http://esnips.com/doc/ef04c89f-f3a2-473c-beee-6db5bb3dbb0e/LSMW-with-BAPI
For document on using BAPI with LSMW, I suggest you to visit:
http://www.****************/Tutorials/LSMW/BAPIinLSMW/BL1.htm
what is BAPI?
BAPI stands for Business API(Application Program Interface).
A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
The following standardized BAPIs are provided:
Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
Create( ) and CreateFromData! ( )
The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
Change( )
The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
list of all bapis
http://www.planetsap.com/LIST_ALL_BAPIs.htm
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Also refer to the following links..
www.sappoint.com/abap/bapiintro.pdf
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
u can check the below the material also
Example Code
U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.
U can find these parameters for a particular condition type in table KONV.
*& Form saveTransactionJOCR
text
--> p1 text
<-- p2 text
FORM saveTransactionJOCR .
data: salesdocument like BAPIVBELN-VBELN,
order_header_inx like bapisdh1x,
order_header_in like bapisdh1,
return type standard table of bapiret2 with header line,
conditions_in type standard table of bapicond with header line,
conditions_inx type standard table of bapicondx with header line,
logic_switch like BAPISDLS,
step_nr like conditions_in-cond_st_no,
item_nr like conditions_in-itm_number,
cond_count like conditions_in-cond_count,
cond_type like conditions_in-cond_type.
salesdocument = wa_order_information-VBELN.
LOGIC_SWITCH-COND_HANDL = 'X'.
order_header_inx-updateflag = 'U'.
conditions
clear conditions_in[].
clear conditions_inx[].
clear: step_nr,
item_nr,
cond_count,
cond_type.
step_nr = '710'.
item_nr = '000000'.
cond_count = '01'.
cond_type = 'ZCP2'.
CONDITIONS_IN-ITM_NUMBER = item_nr.
conditions_in-cond_st_no = step_nr.
CONDITIONS_IN-COND_COUNT = cond_count.
CONDITIONS_IN-COND_TYPE = cond_type.
CONDITIONS_IN-COND_VALUE = 666.
CONDITIONS_IN-CURRENCY = 'EUR'.
append conditions_in.
CONDITIONS_INX-ITM_NUMBER = item_nr.
conditions_inx-cond_st_no = step_nr.
CONDITIONS_INX-COND_COUNT = cond_count.
CONDITIONS_INX-COND_TYPE = cond_type.
CONDITIONS_INX-UPDATEFLAG = 'U'.
CONDITIONS_INX-COND_VALUE = 'X'.
CONDITIONS_INX-CURRENCY = 'X'.
append conditions_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = salesdocument
ORDER_HEADER_IN = order_header_in
ORDER_HEADER_INX = order_header_inx
LOGIC_SWITCH = logic_switch
TABLES
RETURN = return
CONDITIONS_IN = conditions_in
CONDITIONS_INX = conditions_inx
if return-type ne 'E'.
commit work and wait.
endif.
ENDFORM. " saveTransactionJOCR
Bdc to Bapi
The steps to be followed are :
1. Find out the relevant BAPI (BAPI_SALESORDER_CHANGE for VA02).
[for VA01 use BAPI_SALESORDER_CREATEFROMDAT2]
2. Create a Z program and call the BAPi (same as a Funtion module call).
2. Now, if you see this BAPi, it has
-> Importing structures.
eg: SALESDOCUMENT: this will take the Sales order header data as input.
-> Tables parameters:
eg: ORDER_ITEM_IN: this will take the line item data as input.
Note :
Only specify fields that should be changed
Select these fields by entering an X in the checkboxes
Enter a U in the UPDATEFLAG field
Always specify key fields when changing the data, including in the checkboxes
The configuration is an exception here. If this needs to be changed, you need to complete it again fully.
Maintain quantities and dates in the schedule line data
Possible UPDATEFLAGS:
U = change
D = delete
I = add
Example
1. Delete the whole order
2. Delete order items
3. Change the order
4. Change the configuration
Notes
1. Minimum entry:
You must enter the order number in the SALESDOCUMENT structure.
You must always enter key fields for changes.
You must always specify the update indicator in the ORDER_HEADER_INX.
2. Commit control:
The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.
For further details... refer to the Function Module documentation for the BAPi.
Bapi to VB(Visual Basic)
Long back I had used the following flow structure to acheive the same.
Report -> SM59 RFC destination -> COM4ABAP -> VB.exe
my report uses the rfc destination to create a COM session with com4abap. com4abap calls the vb.exe and manages the flow of data between sap and vb exe.
You need to have com4abap.exe
If com4abap is installed you will find it in sapgui installatin directory , C:\Program Files\SAPpc\sapgui\RFCSDK\com4abap.
else refer OSS note 419822 for installation of com4abap
after making the settings in com4abap to point to the vb program and setting up rfc destination in sm59 to point to com4abap session , you can use the following function modules to call the vb code.
for setting up com4abap and rfc destination please refer to the documentation for com4abap.
Invoke NEW DCOM session
call function 'BEGIN_COM_SESSION'
exporting
service_dest = service_dest "(this will be a RFC destination created in SM59)
importing
worker_dest = worker_dest
exceptions
connect_to_dcom_service_failed = 1
connect_to_dcom_worker_failed = 2
others = 3.
call function 'create_com_instance' destination worker_dest
exporting
clsid = g_c_clsid
typelib = g_c_typelib
importing
instid = g_f_oid
exceptions
communication_failure = 1 message g_f_msg
system_failure = 2 message g_f_msg
invalid_instance_id = 3
others = 4.
call function 'com_invoke' destination worker_dest
exporting
%instid = g_f_oid
%method = 'UpdatePDF'
sntemp = g_v_const_filent
snsysid = sy-sysid
snflag = 'N'
tables
rssaptable = g_t_pdfdetail1
%return = g_t_pdfdetail1 "t_test
exceptions
communication_failure = 1 message g_f_msg
system_failure = 2 message g_f_msg
invalid_instance_id = 3
others = 4.
then close the com session , using
FM delete_com_instance
FM END_COM_SESSION
Reward points if useful
Regards
Anji -
I want to update standard table field (EKES-EINDT)? Not using BDC using FM.
Hi all,
I would like to seek for you help, to resolve a problem.
I need to know how can i update the EINDT(date) field in the EKES table.
Is there any Function Module or BAPI available for update EKES-EINDT ?
And my requirement is don't use BDC.
Currently I am doing in following way
LOOP AT I_DATA.
UPDATE EKES SET EINDT = P_NEWDAT
WHERE EBELN = I_DATA-EBELN
AND EBELP = I_DATA-EBELP
AND ETENS = I_DATA-ETENS.
ENDLOOP.
I know we should not update standard table directly. This will only update EKES it will not update other tables related with EKES-EINDT.
Got my point?
Please help me it's on high priority.EKES can be updated with function module
ME_CONFIRMATION_UPDATE -
About bdc using session method
how to update mm thru mk01. please provide the source code with a flat file to be updated.
it's urgent.Well, you can go do the following steps:
1. Go to SHDB, create a new recording session for the t-code mk01.
2. Go though the t-code and create an entry and complete the transaction.
3. Once that's done, it will record everthing, save and transfer it to a program.
4. Go to the program in change mode, upload the flat file into a internal table using FM 'upload' or 'gui_upload'.
5. Use the internal table to populate further interies into the tcode.
Please go through the following link to understand the process better:
http://www.sap-img.com/abap/learning-bdc-programming.htm
Please go through the following code also:
report ZABC_BDC
no standard page heading line-size 255.
include bdcrecx1.
*parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
data element: MATNR
MATNR_001(018),
data element: MBRSH
MBRSH_002(001),
data element: MTART
MTART_003(004),
data element: XFELD
KZSEL_01_004(001),
data element: MAKTX
MAKTX_005(040),
data element: MEINS
MEINS_006(003),
end of record.
End generated data section ***
DATA : ITAB LIKE TABLE OF RECORD WITH HEADER LINE.
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\Documents and Settings\sa01.indelgpttrg\Desktop'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
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_dataset using dataset.
perform open_group.
*do.
*read dataset dataset into record.
*do.
LOOP AT ITAB.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
ITAB-MATNR_001.
perform bdc_field using 'RMMG1-MBRSH'
ITAB-MBRSH_002.
perform bdc_field using 'RMMG1-MTART'
ITAB-MTART_003.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
ITAB-KZSEL_01_004.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX_005.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS_006.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM01'.
*enddo.
ENDLOOP.
perform close_group.
*perform close_dataset using dataset.
<b>Please reward the helpful entries.</b>
Regards,
Raman.
Maybe you are looking for
-
HP laserjet CM1015 won't print fonts in color
I have some text that is in blue and green but it prints in black instead. I also have clip art on the page and that prints in color with no issues. Why wont the text print in color when the clip art will? That obviously tells me there is no issue
-
Can I use the tom tom app on my iPhone 4
I have a tom tom app on my iPad and want to know if I can use it on my iPhone 4?
-
Acrobat 9 Pro. S/N not valid
Dear all; I used to have on my old laptop WIN XP 32. "Adobe Acrobat 9 pro." and i have uninstalled this software because I have a new laptop now WIN 7 64. while installing Adobe Acrobat 9 pro, I am receiving an error message that my Serial number is
-
Does anyone know of any kown issues or problems with the LED TV's? They are fairly new, so I am hesitant to buy one yet.
-
Okay this might sound stupid but I have my Mac since Monday now and I don't have any idea how to exit the fullscreen mode when playing a game. For example I was playing EVE Online the other day (in fullscreen mode) and wanted to check something on my