Local mode update in bdc -Call transaction method
what is LOCAL MODE UPDATE in BDC- Call transaction methods ?
Hi,
Try to understand from the below CODE
CALL TRANSACTION 'ZBDCSINGLE' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES INTO IT_BDCMSGCOLL.
REFRESH IT_BDCDATA.
Cheers!!
Similar Messages
-
Error in BDC CALL TRANSACTION METHOD..
hai i got an error in doing BDC CALL TRANSACTION METHOD
Error:diffrent number of parameters in FORM and PERFORM(routine :FILL_SCREEN_DETAILS:,number of formal parameters :3,number of actual parameters:1)
PROGRAM
REPORT ZDEMO_UPLOAD_COST_CENTER_DATA.
DATA:BEGIN OF WA_DATA,
KOKRS TYPE KOKRS,"CONTROLLING AREA
KOSTL TYPE KOSTL,"COST CENTER
DATAB TYPE DATAB,"START DATE
DATBI TYPE DATBI,"END DATE
KTEXT TYPE KTEXT,"NAME
LTEXT TYPE LTEXT,"DESCRIPTION
VERAK TYPE VERAK,"PERSON RESPONSIBLE
KOSAR TYPE KOSAR, "COST CENTER CATEGORY
KHINR TYPE KHINR,"HIERARCHY AREA
BUKRS TYPE BUKRS,"COMPANY CODE
GSBER TYPE GSBER,"BUISINESS AREA
END OF WA_DATA.
*TYPES:IT_DATA TYPE STANDARD TABLE OF TY_DATA.
DATA:IT_DATA LIKE TABLE OF WA_DATA,
IT_BDCDATA LIKE TABLE OF BDCDATA,
WA_BDCDATA LIKE LINE OF IT_BDCDATA,
IT_BDCMSGCOLL LIKE TABLE OF BDCMSGCOLL,
WA_BDCMSGCOLL LIKE LINE OF IT_BDCMSGCOLL.
DATA :V_FILE TYPE STRING.
CONSTANTS :C_KS01(4) TYPE C VALUE 'KS01',
C_X(1) TYPE C VALUE 'X',
C_A(1) TYPE C VALUE 'A'.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETER :PA_FILE LIKE FC03TAB-PL00_FILE OBLIGATORY.
SELECTION-SCREEN:END OF BLOCK B1.
*AT SELECTION SCREEN ON VALUE REQUEST
* EVENT TO BE TRIGGERED WHEN WE PRESS F4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FILE.
PERFORM GET_F4_FOR_FILE USING PA_FILE.
* START-OF-SELECTION
START-OF-SELECTION.
*WE NEED TO MOVE THE PA_FILE INTO ANOTHER VARIABLE OF TYPE STRING
*AS WE ARE GOING TO USE THE SAME IN THE FM:GUI_UPLOAD THERE THE FILE TYPE IS STRING
V_FILE = PA_FILE.
PERFORM UPLOAD_FILE_T0_ITAB USING V_FILE CHANGING IT_DATA.
*FILL THE SCREEN AND FIELD DETAILS
LOOP AT IT_DATA INTO WA_DATA.
REFRESH IT_BDCDATA.
*FIRST SCREEN DETAILS
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1''0200''X'.
*CURSOR DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_CURSOR''CSKSZ-KOKRS'.
*OK CODE DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_OKCODE''/00'.
*CONTROLLING AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KOKRS' WA_DATA-KOKRS.
*COST CENTER DETAILS
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KOSTL' WA_DATA-KOSTL.
* START DATE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-DATAB_ANFO' WA_DATA-DATAB.
*END DATE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-DATBI_ANFO' WA_DATA-DATBI.
*NEXT SCREEN DETAILS
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1''0299''X'.
*OKCODE DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_OKCODE''=BU'.
*SUBSCRN FIELD DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_SUBSCR''BDC-SUBSCR'.
*CURSOR DETAILS
PERFORM FILL_FIELD_DETAILS USING 'BDC_CURSOR''CSKSZ-WAERS'.
*NAME
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KTEXT' WA_DATA-KTEXT.
*DESCRIPTION
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-LTEXT' WA_DATA-LTEXT.
*PERSON RESPONSIBLE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-VERAK' WA_DATA-VERAK.
*COST CENTER CATEGORY
PERFORM FILL_FIELD_DETAILS USING'CSKSZ-KOSAR' WA_DATA-KOSAR.
*HIERARCHY AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-KHINR' WA_DATA-KHINR.
*COMPANY CODE
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-BUKRS' WA_DATA-BUKRS.
*BUISINESS AREA
PERFORM FILL_FIELD_DETAILS USING 'CSKSZ-GSBER' WA_DATA-GSBER.
*CALL THE TRANSACTION
CALL TRANSACTION C_KS01 USING IT_BDCDATA
MODE C_A "ALL SCREENS
"N-NO SCREENS
"E-ERROR SCREENS ONLY
UPDATE 'A' "ASYNCHRONOUS
"SYNCHRONOUS
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
* FORM FILL SCREEN_DETAILS
FORM FILL_SCREEN_DETAILS USING PROGRAM LIKE BDCDATA-PROGRAM
DYNPRO LIKE BDCDATA-DYNPRO
DYNBEGIN LIKE BDCDATA-DYNBEGIN.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = DYNBEGIN.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDOFRM.
* FORM FILL_FIELD_DETAILS
FORM FILL_FIELD_DETAILS USING FNAM FVAL.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDFORM.
* FORM GETE_F4_FOR_FILE
*DISPLAY ALL THE FILES IN THE SYSTEM FOR SELECTION
*P_PA_FILE NAME OF THE FILE
FORM GET_F4_FOR_FILE USING P_PA_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
* EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'PA_FILE'
* STATIC = ' '
* MASK = ' '
CHANGING
FILE_NAME = PA_FILE.
* EXCEPTIONS
* MASK_TOO_LONG = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
* FORM UPLOAD_FILE_TO_ITAB
* FP_V_FILE = FILE NAME
*FP_IT_DATA = INTERNAL TABLE TO STORE THE DATA
FORM UPLOAD_FILE_TO_ITAB USING FP_V_FILE CHANGING FP_IT_DATA LIKE IT_DATA.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FP_V_FILE
HAS_FIELD_SEPARATOR = ' X'
TABLES
DATA_TAB =FP_IT_DATA.
ENDFORM.
Edited by: saifudheenc on Aug 7, 2010 5:09 PMhi
try to add spaces between parameters :
example:
PERFORM FILL_SCREEN_DETAILS USING 'SAPLKMA1' '0200' 'X'.
regards,darek -
Holder(A008) is not maintaing in HRP1001 (BDC - Call Transaction Method)
Dear Friends,
Holder (A008) in HRP1001 is not maintained for some hiried persons through BDC - Call Transaction Method.
Except Holder update eveything is updated in the hrp1001.
When we hire a perosn through PA40, then its automatically maintaining Holder ( A008 ) in HRP1001. But for the same case through BDC program with Call Transaction method, its not maintaining Holder.
What can be reason behind not updating holder in HRP1001. How we can maintain Holder in this case.
Thanks
Rav
Edited by: Rav Jordan on Jan 10, 2012 8:03 AMHi Keshav,
Thanks for your response.
After running
CALL TRANSACTION 'PA40' USING BDCDATA
MODE CTUMODE " 'A'
UPDATE 'A'
MESSAGES INTO MESSTAB.
if sy-subrc eq '0'.
i am selecting perner created from pa0002.
now to update holder i am using fucntion module.
WA_HOLD-AEDTM = SY-DATUM.
WA_HOLD-UNAME = SY-UNAME.
WA_HOLD-OBJID = P_PLANS.
WA_HOLD-BEGDA = DT.
WA_HOLD-ENDDA = '99991231'.
WA_HOLD-OTYPE = 'S'.
WA_HOLD-PLVAR = '01'.
WA_HOLD-RSIGN = 'A'.
WA_HOLD-RELAT = '008'.
WA_HOLD-SCLAS = 'P'.
WA_HOLD-SOBID = GD_PERNR.
CALL FUNCTION 'RH_INSERT_INFTY'
EXPORTING
FCODE = 'INSE'
VTASK = 'A'
ORDER_FLG = 'X'
COMMIT_FLG = 'X'
AUTHY = 'X'
PPPAR_IMP =
OLD_TABNR = ' '
REPID = ' '
FORM = ' '
KEEP_LUPD =
WORKF_ACTV = 'X'
TABLES
INNNN = WA_HOLD
ILFCODE =
EXCEPTIONS
NO_AUTHORIZATION = 1
ERROR_DURING_INSERT = 2
REPID_FORM_INITIAL = 3
CORR_EXIT = 4
BEGDA_GREATER_ENDDA = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
This also not updating holder in the hrp1001 postion in the table.
May i know where to do change in the code so that holder can be maintained.
Thanks
Rav -
Reg Vendor master upload using BDC Call Transaction Method
Hi All,
Thanks in advance.
I am uploading vendor master data using bdc call transaction method for XK01. In that i am getting an error message that the fields " smtp_addr" ( for email) and "time_zone" (for time zone) doesnot exist on the screen '0110' ( this is the second screen) . the field timezone will be displayed on the screen only when we go for communications button and select the URL field .
Do anybody have the solution for this problem. if possible can you give me the code for that screen.Create a recording via SM35 (menu go to=>recording), this will generate automatically the code for filling your bdcdata-table...
-
How can we update mk01 with BDC call transaction method
can any one send the sample code for upload of MK01 using call transaction method.
its urgent..Use the following code.
*& Report ZMK01_VA01 *
REPORT Z_MK01 .
SOURCE INTERNAL TABLE
DATA: BEGIN OF T_SOURCE OCCURS 0,
LIFNR TYPE LIFNR,
EKORG TYPE EKORG,
KTOKK TYPE KTOKK,
NAME1 TYPE NAME1,
SORTL TYPE SORTL,
LAND1 TYPE LAND1,
WAERS TYPE WAERS,
END OF T_SOURCE.
*DATA: E_MESSAGE TYPE C.
ERROR MESSAGE TABLE
DATA: T_ERRORMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
TARGET TABLE LIKE BDCDATA
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
TO UPLOAD DATA FROM LEGACY SYSTEM
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'D:\MK01.TXT'
FILETYPE = 'DAT'
IMPORTING
FILELENGTH =
TABLES
data_tab = T_SOURCE
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
TRANSFERING DATA FROM INTERNAL SOURCE TABLE TO TARGET TABLE
LOOP AT T_SOURCE.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0107'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
T_SOURCE-LIFNR.
perform bdc_field using 'RF02K-EKORG'
T_SOURCE-EKORG.
perform bdc_field using 'RF02K-KTOKK'
T_SOURCE-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-LAND1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
T_SOURCE-NAME1.
perform bdc_field using 'LFA1-SORTL'
T_SOURCE-SORTL.
perform bdc_field using 'LFA1-LAND1'
T_SOURCE-LAND1.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
T_SOURCE-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'MK01' USING BDCDATA MODE 'A' MESSAGES INTO T_ERRORMSG.
ENDLOOP.
LOOP AT T_ERRORMSG.
WRITE:/ 'MESSAGE TYPE',T_ERRORMSG-MSGTYP,
'FIELDNAME WERE ERROR OCCURED', T_ERRORMSG-FLDNAME.
*CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = T_ERRORMSG-MSGID
LANG = SY-LANGU
NO = T_ERRORMSG-MSGNR
V1 = T_ERRORMSG-MSGV1
V2 = T_ERRORMSG-MSGV2
V3 = T_ERRORMSG-MSGV3
V4 = T_ERRORMSG-MSGV4
IMPORTING
MSG = E_MESSAGE
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*WRITE:/ E_MESSAGE.
ENDLOOP.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
With Regards
K Srinivas -
Hi all, BDC call transaction METHOD, trapping ERRORS
hi
i have developed BDC (recording via call transaction method) for VB01.
could u please tell me how to display records having errors after running recording or to give index of records having errors.
and is it possible to give transaction code for recording since my bdc is executable program.
plase answer both the questions.
thanxHere is the flow that Raja is explaining to you.
DATA: v_index LIKE sy-tabix.
LOOP AT itab.
v_index = sy-tabix.
*-- prepare the BDC data
CALL TRANSACTION 'VB01' USING bdcdata
MODE 'N'
MESSAGES INTO bdcmsgcoll.
READ TABLE bdcmsgcoll WITH KEY msgtyp = 'E'.
IF sy-subrc = 0.
*-- Error occured for the record with index <b>v_index</b>
ELSE.
*-- unless there is a success message with this number,
* it is not succesfull because 'No data for screen xxx'
* will not show up as an error message type, but will be
* a success message type
READ TABLE bdcmsgcoll WITH KEY msgnr = '312'.
IF sy-subrc = 0.
*-- success
ELSE.
*-- error with index <b>v_index</b>
ENDIF.
ENDIF.
ENDLOOP.
As you can see, now you have the index of the record where the error occured. Now this will become complicated if you are combining several records into one transaction call. In that case you need to find how you can know all the records that you just accumulated.
As an example, let us say you have an internal table with external number, customer, material, quantity and at every new external number, you want to create a sales order. Until you get a new external number, you will not do the call transaction because until then it will be items of the same sales order. So in this case, after the call transaction, you will have get all the records that belong to making this sales order by using the external number and then prepare your messages.
I hope this is clear.
Srinivas
Message was edited by: Srinivas Adavi -
Handling Warning pop up windows in BDC call transaction method
Hi All,
Iam using a BDC to automate the Costing Process i.e. Transaction CK40N using call transaction method. In a particular Screen after i perform the execute action, a warning pop up window appears. Only if I click on OK, the execution continues or else it will not proceed. How to handle this situation in case a warning pop up window appears based on the input which is given? In other words a Dynamic warning message. Thanks in advance....
Regards,
NirmalHello,
U can either use NO_DIALOG or SUPPRESS DIALOG to avaid this,.
Regards,
Vasanth -
Screen no change in BDC call transaction method
Hi experts
Greetings!
I have a BDC created in call transaction method for t-code FB01.
Data passed successfully to the first screen but when it navigates to the second screen I am not able to pass any data.
After debugging I found that the issue was because of the DYNPRO value.
It was 8500 when I created this recording but now the screen number shows 350.
Is is possible that screen nos change because of any support stack or OSS notes implementation.
In run time i tried to change the value to 350 and it works fine..
Thanks
JayHi,
LSMW Direct input method is better for your quiry. Becasuse i wrote BDC for FB01 but not working properly.
So i used LSMW, helped me a lot. Progmra name is RFBIBL00. Or else i will export and send you if you want. It can handle multiple line items upto 950.
Thanks,
Sriram -
In bdc call transaction method which one ll prefer synchronous or asynchron
hi could anybody tel me
call transaction method which one is preferred synchronous or asynchronous..?
what ll happen if we do other method..?
foreground or background which one ll prefer..?
what ll happen if we do otehr method..?
on which condition we have to use synchronous and asynchronous
on which condition we have to use foreground and background
thanx
kals.Hi,
if you haven't done yet please visit for general information:
http://help.sap.com/saphelp_nw70/helpdata/en/d2/f8f3393bef4604e10000000a11402f/frameset.htm
for further information:
http://help.sap.com/saphelp_nw70/helpdata/en/69/c2501a4ba111d189750000e8322d00/frameset.htm
This will hopefully answer your question.
Regards
Bernd -
Simple doubt in BDC Call Transaction Method
Hi Friends,
When i try to call vk13 transaction and pass the screen field values for the second screen and execute it it is displaying properly.But when i try to pass the different value in the bcddata internal table it is changing properly but in the screen it not updating that value.Alawly the screen fields are taking the values passed the first time.But in the internal table which we are oassing to the calltransaction it is changing correctly but not in the corresponding screen fields. Why it is happening so. Can any one help me out of this problem.
Thanks in Advance.I am not passing through the selection screen . It is like iteractive report. when i select the particular line in the list output then the screen fields should take the values from that selected line. First time when i select the line it is taking properly.
But next time when i select the line the content of the i_bdc_tbl is changing correctly but when it enter in to the transaction it is not taking the values from the i_bdc_tbl. Simply it is displaying the screen fields with the old values. It is not updating the screen fields with the values from the i_bdc_tbl. Why the screen fields are not replaced with the value of i_bdc_tbl? Why it is not getting refreshed with the new values?
Just i am posting the bdc portion of my code here. So you can help me out on this.
AT LINE-SELECTION.
SELECT SINGLE kozgf FROM t685 INTO v_kozgf
WHERE kschl = wa_report-kschl.
SELECT kolnr kotabnr FROM t682i INTO TABLE i_t682i
WHERE kozgf = v_kozgf.
SORT i_t682i BY kolnr.
READ TABLE i_t682i WITH KEY kotabnr = wa_report-tabna+1(3)
TRANSPORTING NO FIELDS.
CHECK sy-subrc = 0.
v_index = sy-tabix.
REFRESH i_bdc_tbl.
l_tabix = '01'.
PERFORM f_vk13.
CONCATENATE 'RV13' wa_report-tabna INTO v_bdc_val_field.
PERFORM bdc_dynpro USING v_bdc_val_field '1000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'F004-LOW'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ONLI'.
CREATE DATA v_rec TYPE (wa_report-tabna).
ASSIGN v_rec->* TO <wa_table>.
SELECT SINGLE * FROM (wa_report-tabna) INTO <wa_table>
WHERE kschl = wa_report-kschl AND matnr = wa_report-matnr AND knumh = wa_report-objectid.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = wa_report-tabna
TABLES
dfies_tab = lwa_tabna
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
READ TABLE lwa_tabna WITH KEY fieldname = 'KSCHL'.
p1 = sy-tabix + 1.
READ TABLE lwa_tabna WITH KEY fieldname = 'MATNR'.
p2 = sy-tabix.
LOOP AT lwa_tabna.
v_field = lwa_tabna-fieldname.
IF lwa_tabna-position BETWEEN p1 AND p2.
ASSIGN COMPONENT lwa_tabna-position OF STRUCTURE <wa_table> TO <fld>.
PERFORM f_vk13_s2 USING lwa_tabna-fieldname <fld>.
ENDIF.
ENDLOOP.
PERFORM bdc_field USING 'RV130-DATAM'
wa_report-fdate_value_new.
PERFORM bdc_field USING 'BDC_OKCODE'
'ONLI'.
PERFORM bdc_field USING 'BDC_CURSOR'
'F001'.
CALL TRANSACTION 'VK13' USING i_bdc_tbl
MODE 'A'.
FORM f_vk13.
DATA: l_tabix(2) TYPE c.
*Condition type
PERFORM bdc_dynpro USING 'SAPMV13A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV13A-KSCHL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RV13A-KSCHL'
wa_report-kschl.
*Key combination
PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV130-SELKZ(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=WEIT'.
PERFORM bdc_field USING 'RV130-SELKZ(01)'
l_tabix = v_index.
SHIFT l_tabix RIGHT.
OVERLAY l_tabix WITH '00'.
CONCATENATE 'RV130-SELKZ(' l_tabix ')' INTO v_bdc_field.
PERFORM bdc_field USING v_bdc_field
'X'.
ENDFORM. "f_vk13
FORM BDC_DYNPRO
This form accepts the program name and screen number
and places the values into the I_BDC_TBL internal table.
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdc_tbl.
wa_bdc_tbl-program = program.
wa_bdc_tbl-dynpro = dynpro.
wa_bdc_tbl-dynbegin = 'X'.
APPEND wa_bdc_tbl TO i_bdc_tbl.
ENDFORM. "BDC_DYNPRO
FORM F_BDC_FIELD
This form accepts the field name and the corresponding value
for that field and places them into the I_BDC_TBL internal table.
FORM bdc_field USING fnam fval.
CLEAR wa_bdc_tbl.
MOVE fnam TO wa_bdc_tbl-fnam.
MOVE fval TO wa_bdc_tbl-fval.
APPEND wa_bdc_tbl TO i_bdc_tbl.
ENDFORM. "BDC_FIELD
*& Form f_vk13_s2
text
--> p1 text
<-- p2 text
FORM f_vk13_s2 USING p_fieldname p_fld.
CONCATENATE wa_report-tabna '-' p_fieldname INTO v_bdc_val_field.
CHECK NOT p_fld IS INITIAL.
PERFORM bdc_field USING v_bdc_val_field p_fld.
ENDFORM. " f_vk13_s2
Thanks. -
Error Capturing in BDC Call Transaction Method
How does the Errors in BDC Call Transactin is captured ....can you please give same examples of using BDCMSGCOLL and FORMAT_MESSAGES..
Please explain clearly when to used these in real time..
Thankyouhi,
Here is hte sample code
call transaction 'ME22' using it_bdc
options from x_ctu_params
messages into lt_message.
clear w_success.
if sy-subrc <> 0.
w_success = 'N'.
endif.
loop at lt_message where msgtyp = 'E' or
msgtyp = 'A'.
endloop.
if sy-subrc = 0.
perform format_messages tables lt_message
using lv_msg lv_lines.
* To append error messages
perform append_message tables lt_message
return
using lv_msg.
else.
if w_success = 'N'.
perform format_messages tables lt_message
using lv_msg lv_lines.
perform append_message_err tables lt_message
return
using lv_msg.
else.
perform format_messages tables lt_message
using lv_msg lv_lines.
* To append success messages
perform append_message tables lt_message
return
using lv_msg.
endif.
endif.
refresh: it_bdc,
lt_message.
endat.
endloop.
endif.
form format_messages tables pt_messages structure bdcmsgcoll
using pv_msg pv_lines.
clear : pv_lines,pt_messages,pv_msg.
describe table pt_messages lines pv_lines.
read table pt_messages index pv_lines.
check not pt_messages-msgid is initial.
*-- Function module to format the message given
call function 'FORMAT_MESSAGE'
exporting
id = pt_messages-msgid
lang = sy-langu
no = pt_messages-msgnr
v1 = pt_messages-msgv1
v2 = pt_messages-msgv2
v3 = pt_messages-msgv3
v4 = pt_messages-msgv4
importing
msg = pv_msg
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into pv_msg.
endif.
endform. " format_messages
Regards,
Richa -
Should 'call transaction' be called inside the loop or outside the loop in BDC?
Hi Sangeeta,
It depends on the scenario in which your going to call the transaction. Consider a situation in which I was required to write a BDC program for Task List dependency editor (IA06 transaction). Every Task List can have a number of operations and operation can have suboperations. I was required to call the transaction for only the Task List Number and not for individual operations and suboperations. In such a scenario , we populate the BDCDATA internal table inside a loop . The process of calling the transaction can be done in the loop itself (using some flags and ON CHANGE and IF statements) or after the Task List Number changes exit the loop(using the EXIT statement) and then do the call transaction. So its just the ease with which you can implement your logic, that you call the transaction inside the loop or outside the loop. The only thing to be remembered is that BDCDATA internal table should be populated before you call the transaction. -
Dif betwen BDC call transaction and session method
Hi to all,
This is my problem. I want to know, what is the difference between BDC call Transaction method and Session method. where the situation we can use these methods.
I will be thankfull to all.Session Method :
Asynchronous Processing.
Transfers Data for Multiple Transactions
Synchronous Database Update
During Processing, No Transaction is started until the previous transction has been written to the database.
A Batch Input Processing log is generated for each session
Sessions can not be generated in Parallel.
The Batch Input Porgram must not open a Session until it has closed the preceding Session.
Call Transaction :
Synchronous Processing.
Transfers Data for a single transaction.
Synchronous and Asynchronous Database updating both Possible.
The Program Specifies which kind of updating is desired.
Seperate LUW for the transaction.
The System Performs a database commit immediately before and after the CALL TRANSACTION Using Statement.
No Batch Input Processing Log is generated.
These are the differences between session and call transaction method.
Call transaction is faster then session method. But usually we use session method in real time...because we can transfer large amount of data from internal table to database and if any errors in a session. Process will not complete until session get correct. -
Improve performance of bdc call transaction
Hi all,
I am performing a batch update of tax codes in a BDC call transaction program. This particular code takes about 3 minutes to process 2,600 entries. I have tried almost everything but is there a way to improve / make it run faster?
I have a feeling it has something to do with the form "do_transaction", but I really don't know anymore.
Thank you in advance.
Attached is the code:
*& Report ZFI_CHANGEWTAX
*& Description: Change Doctors Withholding Tax Code (EI)
*& Using BDC Call Transaction Method
*& Created by : mpena
*& Created on : 07/15/2009
*& Modification History
*& Seq Changed on
*& Changed by
*& 001 07/15/2009
*& mpena Initial Development
*& 002 07/20/2009
*& mpena Logic modification
*& Testing
*& 003 07/20/2009
*& mpena Call function parameter modification
*& 004 07/22/2009
*& mpena Report generation
*& Performance improvements
REPORT zfi_changewtax
NO STANDARD PAGE HEADING
MESSAGE-ID zfk02msg.
TYPES: BEGIN OF t_tax,
lifnr LIKE lfa1-lifnr, "account number
wt_withcd LIKE lfbw-wt_withcd, "current tax code
wt_withcd_new LIKE lfbw-wt_withcd, "new tax code (left blank at default)
END OF t_tax.
DATA: wa_tax TYPE t_tax,
i_tax TYPE STANDARD TABLE OF t_tax,
it_bdcdata TYPE bdcdata OCCURS 0 WITH HEADER LINE,
lin TYPE i.
-------Selection Screen Design -
SELECTION-SCREEN:
SKIP 1,
BEGIN OF BLOCK blk1 WITH FRAME TITLE aaa.
PARAMETERS: p_ktokk LIKE lfa1-ktokk DEFAULT 'DOCT' OBLIGATORY,
p_bukrs LIKE lfbw-bukrs DEFAULT 'SL' OBLIGATORY,
p_wtax LIKE lfbw-wt_withcd OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
INITIALIZATION.
aaa = 'Change Tax Code to specified value'.
TOP-OF-PAGE.
WRITE:
/ 'Update of taxes successful on:', sy-datum, sy-uzeit,
/ 'Generated by:', sy-uname,
/ 'Company Code:', p_bukrs, 'Vendor Group:', p_ktokk.
SKIP 1.
ULINE.
WRITE:
/ 'Account Number', 20 'Old Withholding Tax Code', 50 'New Withholding Tax Code'.
ULINE.
START-OF-SELECTION.
SELECT lfa1~lifnr
lfbw~wt_withcd
INTO TABLE i_tax
FROM lfa1 INNER JOIN lfbw
ON lfa1lifnr = lfbwlifnr
WHERE lfbw~bukrs EQ p_bukrs
AND lfbw~witht EQ 'EI'.
IF sy-subrc EQ 0.
DESCRIBE TABLE i_tax LINES lin.
ENDIF.
Update i_tax with new value of wt_witchd, then display for comparison.
After write: if old and new tax are the same, tax update was not successful for that specific account
or inputted tax type is the same as the old one.
LOOP AT i_tax INTO wa_tax.
wa_tax-wt_withcd_new = p_wtax.
MODIFY i_tax FROM wa_tax.
WRITE:
/ wa_tax-lifnr,
20 wa_tax-wt_withcd,
50 wa_tax-wt_withcd_new.
CLEAR wa_tax.
ENDLOOP.
PERFORM do_transaction USING p_bukrs p_wtax.
*& Form do_transaction
Extracted from ZFKO2 recording accessible in shdb.
FORM do_transaction USING v_bukrs v_wtax.
MESSAGE i000 WITH lin.
LOOP AT i_tax INTO wa_tax.
REFRESH it_bdcdata.
PERFORM bdc_dynpro USING 'SAPMF02K' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-D0610'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-LIFNR'
wa_tax-lifnr.
PERFORM bdc_field USING 'RF02K-BUKRS'
v_bukrs.
PERFORM bdc_field USING 'RF02K-D0610'
'X'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0610'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFBW-WT_WITHCD(01)'.
PERFORM bdc_field USING 'LFB1-QLAND'
'PH'.
PERFORM bdc_field USING 'LFBW-WT_WITHCD(01)'
v_wtax.
PERFORM bdc_dynpro USING 'SAPMF02K' '0610'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=UPDA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFB1-QLAND'.
PERFORM bdc_field USING 'LFB1-QLAND'
'PH'.
CALL TRANSACTION 'FK02' USING it_bdcdata
MODE 'N'
UPDATE 'A'.
ENDLOOP.
MESSAGE i001.
ENDFORM. "do_transaction
form for bdc dynpro
FORM bdc_dynpro USING program
dynpro.
it_bdcdata-program = program.
it_bdcdata-dynpro = dynpro.
it_bdcdata-dynbegin = 'X'.
APPEND it_bdcdata.
CLEAR it_bdcdata.
ENDFORM. "bdc_dynpro
form for bdc field
FORM bdc_field USING fnam
fval.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
APPEND it_bdcdata.
CLEAR it_bdcdata.
ENDFORM. "bdc_fieldYou might want to try using a BAPI instead of a call transaction. I believe "BAPI_VENDOR_SAVECHARVALREPLICA" will work for you. Calling a BAPI is just like calling a function module. After you call the bapi remember to commit it with the function module "BAPI_TRANSACTION_COMMIT".
-
Re: Bdc call transaction
Hi all can any one give good code and entire process for BDC call transaction method.explain the entire process clearly.
Thanks®ards
SashiHi,
Check the following code:
*& Report Z_BDCP_VENDCALLTRNS
*& TITLE : Vendor Creation BDC Program (Call Transaction Method) *
*& AUTHOR : XXXXXXXXXX *
*& DATE OF CREATION : xx-xx-xxxx *
*& PROGRAM TYPE : Executable Program *
MODIFICATION LOG *
*& AUTHOR : *
*& DATE OF CHANGE : *
*& FUNCTIONAL SPECS : *
*& CORRECTIONS REQUEST : *
*& DESCRIPTION OF CHANGE : *
REPORT z14644sd_bdcp_vendcalltrns.
TYPES: BEGIN OF t_vend,
lifnr LIKE rf02k-lifnr, "Vendor Account Number
ktokk LIKE rf02k-ktokk, "Vendor account group
anred LIKE lfa1-anred, "Title
name1 LIKE lfa1-name1, "Vendor Name
sortl LIKE lfa1-sortl, "Sort field
land1 LIKE lfa1-land1, "Country Key
spras LIKE lfa1-spras, "Language Key
banks TYPE lfbk-banks, "Bank country key
bankl TYPE lfbk-bankl, "bank key
bankn TYPE lfbk-bankn, "account number
END OF t_vend.
TYPES: BEGIN OF t_sucrec,
vnum TYPE lfa1-lifnr, "Vendor Account Number
vnam TYPE lfa1-name1, "Vendor Name
END OF t_sucrec.
TYPES: BEGIN OF t_errrec,
err_rec TYPE string, "Error Record
lineno TYPE i, "Line Number
message TYPE string, "Error Message
END OF t_errrec.
DATA: v_file TYPE string, "Variable for storing flat file
it_vend TYPE STANDARD TABLE OF t_vend, "Internal table of Vendor
wa_vend LIKE LINE OF it_vend, "Workarea of Internal table it_vend
it_sucrec TYPE STANDARD TABLE OF t_sucrec, "Internal table of Success records
wa_sucrec LIKE LINE OF it_sucrec, "Workarea of Internal table it_sucrec
it_errrec TYPE STANDARD TABLE OF t_errrec,
wa_errrec LIKE LINE OF it_errrec,
it_bdctab LIKE bdcdata OCCURS 0 WITH HEADER LINE, "Internal table structure of BDCDATA
it_messagetab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE, "Tracing Error Messages
v_date LIKE sy-datum, "Controlling of session date
v_index LIKE sy-index, "Index Number
v_totrec TYPE i, "Total Records
v_errrec TYPE i, "Error Records
v_sucrec TYPE i, "Success Records
v_sesschk TYPE c. "Session maintenance
*& SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001 NO INTERVALS.
PARAMETERS: p_file TYPE rlgrap-filename. "rlgrap-filename is a predefined structure
SELECTION-SCREEN: END OF BLOCK blk1.
SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002 NO INTERVALS.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N',
p_update LIKE ctu_params-updmode DEFAULT 'A'.
SELECTION-SCREEN END OF BLOCK blk2.
*& INITIALIZATION
INITIALIZATION.
v_date = sy-datum - 1.
*& AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
*& START-OF-SELECTION
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_vend
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.
*& END-OF-SELECTION
END-OF-SELECTION.
v_index = sy-index.
LOOP AT it_vend INTO wa_vend.
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'RF02K-LIFNR' wa_vend-lifnr.
PERFORM bdc_field USING 'RF02K-KTOKK' wa_vend-ktokk.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'sapmf02k' '0110'.
PERFORM bdc_field USING 'lfa1-anred' wa_vend-anred.
PERFORM bdc_field USING 'lfa1-name1' wa_vend-name1.
PERFORM bdc_field USING 'lfa1-sortl' wa_vend-sortl.
PERFORM bdc_field USING 'lfa1-land1' wa_vend-land1.
PERFORM bdc_field USING 'lfa1-spras' wa_vend-spras.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.
PERFORM bdc_field USING 'LFBK-BANKS(01)' wa_vend-banks.
PERFORM bdc_field USING 'LFBK-BANKL(01)' wa_vend-bankl.
PERFORM bdc_field USING 'LFBK-BANKN(01)' wa_vend-bankn.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'bdc_okcode' 'UPDA'.
CALL TRANSACTION 'XK01' USING it_bdctab
MODE p_mode
UPDATE p_update
MESSAGES INTO it_messagetab.
IF sy-subrc = 0.
*& reading success records to corresponding internal table
READ TABLE it_messagetab WITH KEY msgtyp = 'S'.
IF sy-subrc = 0.
wa_sucrec-vnum = it_messagetab-msgv1.
wa_sucrec-vnam = wa_vend-name1.
APPEND wa_sucrec TO it_sucrec.
CLEAR wa_sucrec.
ENDIF.
ELSE.
*& reading error records to corresponding internal table
READ TABLE it_messagetab WITH KEY msgtyp = 'E'.
IF sy-subrc = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
no = it_messagetab-msgnr
v1 = it_messagetab-msgv1
v2 = it_messagetab-msgv2
v3 = it_messagetab-msgv3
v4 = it_messagetab-msgv4
IMPORTING
msg = wa_errrec-message.
wa_errrec-lineno = v_index.
APPEND wa_errrec TO it_errrec.
CLEAR wa_errrec.
ENDIF.
ENDIF.
CLEAR : it_bdctab, it_messagetab.
REFRESH: it_bdctab, it_messagetab.
ENDLOOP.
DESCRIBE TABLE it_vend LINES v_totrec.
DESCRIBE TABLE it_errrec LINES v_errrec.
DESCRIBE TABLE it_sucrec LINES v_sucrec.
PERFORM disp_data.
SKIP 2.
IF v_sucrec > 0.
PERFORM disp_success_data.
ENDIF.
SKIP 2.
IF v_errrec > 0.
PERFORM disp_error_data.
ENDIF.
*& Form bdc_dynpro
text
-->P_0104 text
-->P_0105 text
FORM bdc_dynpro USING program
dynpro.
CLEAR it_bdctab.
it_bdctab-program = program.
it_bdctab-dynpro = dynpro.
it_bdctab-dynbegin = 'X'.
APPEND it_bdctab.
ENDFORM. " bdc_dynpro
*& Form bdc_field
text
-->P_0109 text
-->P_IT_VEND_LIFNR text
FORM bdc_field USING fnam
fval.
CLEAR it_bdctab.
it_bdctab-fnam = fnam.
it_bdctab-fval = fval.
APPEND it_bdctab.
ENDFORM. " bdc_field
*& Form disp_data
text
--> p1 text
<-- p2 text
FORM disp_data .
ULINE (45).
WRITE : / sy-vline,
18 'SUMMARY'(004) COLOR 1,
45 sy-vline.
ULINE /(45).
WRITE : / sy-vline,
'Total Records Processed'(007),
28 '=',
30 v_totrec,
45 sy-vline,
/ sy-vline,
'Error Records'(005),
28 '=',
30 v_errrec,
45 sy-vline,
/ sy-vline,
'Successful Records'(006),
28 '=',
30 v_sucrec,
45 sy-vline.
ULINE /(45).
ENDFORM. " disp_data
*& Form disp_success_data
text
--> p1 text
<-- p2 text
FORM disp_success_data .
ULINE (45).
WRITE : / sy-vline,
14 'Successful Records'(012) COLOR 1,
45 sy-vline.
ULINE /(45).
WRITE : / sy-vline ,
'Vendor Number'(010) COLOR 2,
17 sy-vline,
25 'Vendor Name'(011) COLOR 2,
45 sy-vline.
ULINE /(45).
LOOP AT it_sucrec INTO wa_sucrec.
WRITE: / sy-vline ,
wa_sucrec-vnum,
17 sy-vline,
19 wa_sucrec-vnam,
45 sy-vline.
ENDLOOP.
ULINE /(45).
ENDFORM. " disp_success_data
*& Form disp_error_data
text
--> p1 text
<-- p2 text
FORM disp_error_data .
ULINE (85).
WRITE : / sy-vline,
35 'Error Records'(013) COLOR 1,
85 sy-vline.
ULINE /(85).
WRITE : / sy-vline,
'Record Number'(008) COLOR 2,
sy-vline,
37 'Reason for error'(009) COLOR 2,
85 sy-vline.
ULINE /(85).
LOOP AT it_errrec INTO wa_errrec.
WRITE : / sy-vline,
wa_errrec-lineno,
17 sy-vline,
wa_errrec-message,
85 sy-vline.
ENDLOOP.
ULINE /(85).
ENDFORM. " disp_error_data
Regards,
Bhaskar
Maybe you are looking for
-
New problem in firefox 29: When I click a link that opens the new page in a new window, the window pops open in the last partially maximized state that it was in. Should I maximize the new window (in Windows 8.1) and close it and re-click the origina
-
Can Samsung Series 5 NP535U4C-S03MY Ultrabook run Adobe Illustrator CS5/6?
Hi, I've been using Adobe Illustrator cs5 on my iMac. I am about to purchase a new laptop (Samsung Series 5 NP535U4C-S03MY Ultrabook) and is wondering if Illustrator is able to run on that laptop. The specs are as folllows: Processor :AMD A-Series A8
-
Solution for family shared calendar using Mobile Me
Hello, I don't think this issue has been resolved. Here's what we did: Home computer is running the lastest update 10.6.4 ical is set to my (primary mobile account). It is a caldav account set to push. My iphone is set-up using a mobile account set o
-
Email IMAP folders / gmail labels invisible
After os update I can only see my email account in the mail app. All the IMAP folders which are represented by labels in gmail are gone. I can't see my folders. I can't access the trash for example because it is not shown in the left menu pane.
-
Hi, It's the details that kill me sometimes... I have a report with 5 groupings. I have a detail line that contains values Da1 and Da2. Da1 need to be summed (conditionally) at group 5; Da2 needs to be summed (conditionally) at group 4. I have a two