‎2006 Feb 24 6:22 AM
Hi Friends,
Can we use call transaction and session method in a single bdc program?How to link these two?
Is it possible to pass the errors from bdc call transaction method to session method in one program?
Pls let me know if any body has any example on this...
Thanks in Advance.
‎2006 Feb 24 6:34 AM
Jak,
Yes you can use both the transaction and session methods in the same program. What you can do is to pass the data to TRANSACTIOM method first, and collect the records which error out in this and then pass them on to the SESSION method.
THere will not be any link between these two.
Regards,
Ravi
‎2006 Feb 24 6:35 AM
u just incluse the following stetement in ur program
<b>include bdcrecx1.</b>
SEE THE FOLLOWING EXAMPLE PROGRAM WHICH USES BOTH
REPORT ZMM_BDC_CONFIRMATION_UPLOAD
NO STANDARD page heading
message-id ZV.
include bdcrecx1.
TABLES: EKPO,EKES.
data : begin of t_itab occurs 0,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
bstae like ekpo-bstae,
ebtyp like ekes-ebtyp ,
eindt(10),
menge like ekes-menge,
xblnr like ekes-xblnr,
end of t_itab.
DATA: BEGIN OF record,
ebeln type ebeln,
ebelp type ebelp,
END OF record.
creating an internal table containg the Items***
DATA : t_tab LIKE record OCCURS 0 WITH HEADER LINE.
PARAMETER : filename LIKE rlgrap-filename OBLIGATORY.
***declaring temporary variables
DATA :
v_cnt(2) TYPE n,
v_bst(2) TYPE n,
v_bn type i,
v_bstpo(25),
v_ebtyp(25),
v_menge(25),
v_eeind(25),
v_xblnr(25),
v_xblnr1(25),
v_ebelp(2) type n,
v_ebelpt(2),
v_menge1(11),
v_ebt type i,
v_vebtyp like ekes-ebtyp,
V_EB(2) TYPE N,
v_tcselflag(40),
v_tem(2) type n,
v_file type string.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
field_name = filename
CHANGING
file_name = filename.
START-OF-SELECTION.
v_file = filename.
***uploading from flat file into internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = t_itab.
loop at t_itab.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = t_itab-ebeln
IMPORTING
OUTPUT = t_itab-ebeln
.
modify t_itab.
clear t_itab.
endloop.
checking the item numbers in the flat file.
loop at t_itab.
select ebeln ebelp from ekpo into table t_tab
where ebeln = t_itab-ebeln.
endloop.
IF t_tab[] is not initial.
perform open_group.
***looping at purchase order level.
LOOP at t_itab.
clear v_bn.
clear v_ebt.
perform bdc_dynpro using 'SAPMM06E' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-BSTNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RM06E-BSTNR'
t_itab-ebeln.
**Changing alphanumeric fields and quantity fields to character type**
v_ebelp = t_itab-ebelp.
clear v_ebelpt.
v_menge1 = t_itab-menge.
v_ebelpt = v_ebelp.
**End Of Changing**
**Checking for the exact number of the item**
loop at t_tab where ebeln = t_itab-ebeln.
if t_tab-ebelp = t_itab-ebelp.
exit.
else.
v_bn = v_bn + 1.
endif.
endloop.
v_bst = v_bn + 1.
**End Of Checking**
**Mapping items**
v_tem = 1.
CONCATENATE 'RM06E-BSTPO(' v_bst ')' INTO v_bstpo.
CONCATENATE 'RM06E-TCSELFLAG(' v_tem ')' INTO v_tcselflag.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
v_bstpo.
perform bdc_field using 'BDC_OKCODE'
'=DETA'.
perform bdc_field using 'RM06E-EBELP'
v_ebelpt.
perform bdc_dynpro using 'SAPMM06E' '0111'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-BSTAE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
v_bstpo.
perform bdc_field using 'BDC_OKCODE'
'=BSTA'.
perform bdc_field using 'RM06E-EBELP'
v_ebelpt.
perform bdc_field using v_tcselflag
'X'.
**Checking weather Confirmation category already exists**
select ebtyp from ekes into v_vebtyp where ebelp =
t_itab-ebelp and ebeln = t_itab-ebeln.
endselect.
if sy-dbcnt > 0.
v_ebt = sy-dbcnt.
endif.
V_EB = V_EBT + 1.
**End Of Checking**
**For Line items**
CONCATENATE 'EKES-EBTYP(' v_eb ')' INTO v_ebtyp.
CONCATENATE 'EKES-MENGE(' v_eb ')' INTO v_menge.
CONCATENATE 'RM06E-EEIND(' v_eb ')' INTO v_eeind.
CONCATENATE 'EKES-XBLNR(' v_eb ')' INTO v_xblnr.
**End**
perform bdc_dynpro using 'SAPLEINB' '0200'.
perform bdc_field using 'BDC_CURSOR'
v_xblnr.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using v_ebtyp
t_itab-ebtyp.
perform bdc_field using v_eeind
t_itab-eindt.
perform bdc_field using v_menge
v_menge1.
perform bdc_field using v_xblnr
t_itab-xblnr.
**End Of Mappings**
perform bdc_transaction using 'ME22'.
ENDLOOP.
**End Of Purchase Order Loop**
perform close_group.
ELSE.
MESSAGE I083(zv).
ENDIF.
‎2006 Feb 24 6:36 AM
Hi Jak,
U can club those into a same program.
First process the internal table data using CALL TRANSACTION and then collect the errors and create the session
Process those using session method.
Thanks
eswar
‎2006 Feb 24 7:10 AM
Hi Jak,
Reward the points to the helpful answer and close the post..
Regards,
Santosh