BDC FOR ME21
Hi ALL,
Iam Creating BDC Program bu using ME21 for Uploading PO.
Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
Let me know what are the mandotory fields for creating PO using Me21.
Here iam also attaching the code, Please help us because it is very urgent.
report ZPOUPLOADME21
no standard page heading line-size 255.
*include bdcrecx1.
INCLUDE YMM_BDCRECX1.
Internal Table T_BDCDATA to store BDC data
Batchinputdata of single transaction
DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
Internal Table T_BDC_MSG to store BDC messages
DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
SIZE 0 WITH HEADER LINE.
DATA: V_FILE LIKE RLGRAP-FILENAME ,
V_COUNT(5) TYPE C,
V_MESSAGE_CNT(5) TYPE C .
DATA : BEGIN OF IT_DATA OCCURS 0,
LIFNR LIKE EKKO-LIFNR, " Vendor
BSART LIKE RM06E-BSART, " Order Type
BEDAT(10) TYPE C, " Date
EKORG LIKE EKKO-EKORG, " Purchasing Organization
EKGRP LIKE EKKO-EKGRP, " Purchasing Group
WERKS LIKE RM06E-WERKS, " Plant
INCO2 LIKE EKKO-INCO2, " Inco Terms
KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category
EMATN LIKE EKPO-EMATN, " Material Number
MENGE LIKE EKPO-MENGE, " Purchase Order Quantity
NETPR LIKE EKPO-NETPR, " Net Price
MWSKZ LIKE EKPO-MWSKZ, " Tax Code
NPLNR LIKE MSEG-NPLNR, " Network
VORNR LIKE PSORDER-VORNR, " Operation
END OF IT_DATA.
START-OF-SELECTION.
PERFORM OPEN_GROUP.
PERFORM DATA_UPLOAD.
PERFORM CALL_TRANSACTION.
PERFORM CLOSE_GROUP.
PERFORM WRITE_ERROR.
*& Form DATA_UPLOAD
text
--> p1 text
<-- p2 text
FORM DATA_UPLOAD.
*call function ws_upload to retrieve data from a flat file in the
*presentation server into an internal table
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = V_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
if ws_upload fails then display appropriate message
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Data not Uploaded into internal table'.
ENDIF.
ENDFORM. " DATA_UPLOAD
*& Form CALL_TRANSACTION
text
--> p1 text
<-- p2 text
FORM CALL_TRANSACTION.
DATA : V_IVDAT(10) TYPE C,
V_AKTIV(10) TYPE C,
V_MESSAGE(404) TYPE C.
REFRESH T_BDCDATA.
CLEAR T_BDCDATA.
V_COUNT = 0.
V_MESSAGE_CNT = 0.
LOOP AT IT_DATA .
V_COUNT = V_COUNT + 1.
*perform open_group.
perform bdc_dynpro using 'SAPMM06E' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EKKO-LIFNR'
IT_DATA-LIFNR.
perform bdc_field using 'RM06E-BSART'
IT_DATA-BSART.
*perform bdc_field using 'RM06E-BEDAT'
'24.01.2008'.
perform bdc_field using 'RM06E-BEDAT'
IT_DATA-BEDAT.
perform bdc_field using 'EKKO-EKORG'
IT_DATA-EKORG.
perform bdc_field using 'EKKO-EKGRP'
IT_DATA-EKGRP.
*perform bdc_field using 'RM06E-LPEIN'
'T'.
perform bdc_field using 'RM06E-WERKS'
IT_DATA-WERKS.
perform bdc_dynpro using 'SAPMM06E' '0101'.
perform bdc_field using 'BDC_CURSOR'
'EKKO-INCO2'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EKKO-EKGRP'
IT_DATA-EKGRP1. "'SP3'.
*perform bdc_field using 'EKKO-PINCR'
IT_DATA-PINCR. "'10'.
*perform bdc_field using 'EKKO-SPRAS'
IT_DATA-SPRAS. "'EN'.
*perform bdc_field using 'EKKO-UPINC'
IT_DATA-UPINC. "'1'.
*perform bdc_field using 'EKKO-ZTERM'
IT_DATA-ZTERM.
*perform bdc_field using 'EKKO-WAERS'
IT_DATA-WAERS. "'INR'.
*perform bdc_field using 'EKKO-ZBD1T'
IT_DATA-ZBD1T. "'44'.
*perform bdc_field using 'EKKO-WKURS'
IT_DATA-WKURS. "' 1.00000'.
*perform bdc_field using 'EKKO-INCO1'
IT_DATA-INCO1.
perform bdc_field using 'EKKO-INCO2'
IT_DATA-INCO2.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-NETPR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EKPO-KNTTP(01)'
'N'.
perform bdc_field using 'EKPO-KNTTP(01)'
IT_DATA-KNTTP.
perform bdc_field using 'EKPO-EMATN(01)'
IT_DATA-EMATN.
perform bdc_field using 'EKPO-MENGE(01)'
IT_DATA-MENGE.
perform bdc_field using 'EKPO-NETPR(01)'
IT_DATA-NETPR.
perform bdc_dynpro using 'SAPMM06E' '0111'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-MWSKZ'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EKPO-KNTTP'
'N'.
*perform bdc_field using 'EKPO-TXZ01'
'Clamps & Connector'.
*perform bdc_field using 'EKPO-MENGE'
'4'.
*perform bdc_field using 'EKPO-SPINF'
'A'.
*perform bdc_field using 'EKPO-NETPR'
'100.00'.
*perform bdc_field using 'EKPO-PEINH'
'1'.
*perform bdc_field using 'EKPO-BPRME'
'NO'.
*perform bdc_field using 'EKPO-BPUMN'
'1'.
*perform bdc_field using 'EKPO-BPUMZ'
'1'.
*perform bdc_field using 'EKPO-PRSDR'
'X'.
*perform bdc_field using 'RM06E-EEIND'
'24.01.2008'.
*perform bdc_field using 'RM06E-LPEIN'
'D'.
*perform bdc_field using 'EKPO-WEPOS'
'X'.
perform bdc_field using 'EKPO-MWSKZ'
IT_DATA-MWSKZ.
*perform bdc_field using 'EKPO-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06E' '0511'.
perform bdc_field using 'BDC_CURSOR'
'EKKN-SAKTO'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
*perform bdc_field using 'EKKN-SAKTO'
'6034025'.
*perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
*perform bdc_field using 'BDC_CURSOR'
'COBL-VORNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-NPLNR'
IT_DATA-NPLNR.
perform bdc_field using 'COBL-VORNR'
IT_DATA-VORNR.
perform bdc_dynpro using 'SAPMM06E' '0111'.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EBELP'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'RM06E-EBELP'
'10'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'ME21'.
perform close_group.
LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
AT FIRST.
V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
T_MESSTAB-REC_NO = V_COUNT.
ENDAT.
MODIFY T_MESSTAB TRANSPORTING REC_NO.
ENDLOOP.
REFRESH T_BDCDATA.
CLEAR T_BDCDATA.
ENDLOOP.
SKIP.
WRITE : /10 'Record Number ', 30 'Error Message'.
SKIP.
endform.
*& Form WRITE_ERROR
text
--> p1 text
<-- p2 text
FORM WRITE_ERROR.
LOOP AT T_MESSTAB.
WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
ENDLOOP.
ULINE /10(100).
WRITE : /10 'No of Records : ' , V_COUNT.
WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
ULINE /10(100).
ENDFORM. " WRITE_ERROR
*& Form CHECK_BDC
text
--> p1 text
<-- p2 text
FORM CHECK_BDC.
DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
WHERE PROGRAMM EQ SY-REPID
AND YCHECK EQ 'X'.
IF SY-SUBRC NE 0.
MESSAGE S000(YM) WITH 'Execution not possible'.
STOP.
ENDIF.
ENDFORM. " CHECK_BDC
Answers will be awarded
Thanks
Rahul
It is going into the second screen but whatever the value iam passing to incoterms2 it sis not populating when i run program, but in debugging value is coming.
Is there any possibility of user exits attached to this ME21 transaction
please advice
thanks
Madhukar Reddy
Similar Messages
-
Hi ALL,
Iam Creating BDC Program bu using ME21 for Uploading PO.
Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
Let me know what are the mandotory fields for creating PO using Me21.
Here iam also attaching the code, Please help us because it is very urgent.
report ZPOUPLOADME21
no standard page heading line-size 255.
*include bdcrecx1.
INCLUDE YMM_BDCRECX1.
Internal Table T_BDCDATA to store BDC data
Batchinputdata of single transaction
DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
Internal Table T_BDC_MSG to store BDC messages
DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
SIZE 0 WITH HEADER LINE.
DATA: V_FILE LIKE RLGRAP-FILENAME ,
V_COUNT(5) TYPE C,
V_MESSAGE_CNT(5) TYPE C .
DATA : BEGIN OF IT_DATA OCCURS 0,
LIFNR LIKE EKKO-LIFNR, " Vendor
BSART LIKE RM06E-BSART, " Order Type
BEDAT(10) TYPE C, " Date
EKORG LIKE EKKO-EKORG, " Purchasing Organization
EKGRP LIKE EKKO-EKGRP, " Purchasing Group
WERKS LIKE RM06E-WERKS, " Plant
INCO2 LIKE EKKO-INCO2, " Inco Terms
KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category
EMATN LIKE EKPO-EMATN, " Material Number
MENGE LIKE EKPO-MENGE, " Purchase Order Quantity
NETPR LIKE EKPO-NETPR, " Net Price
MWSKZ LIKE EKPO-MWSKZ, " Tax Code
NPLNR LIKE MSEG-NPLNR, " Network
VORNR LIKE PSORDER-VORNR, " Operation
END OF IT_DATA.
START-OF-SELECTION.
PERFORM OPEN_GROUP.
PERFORM DATA_UPLOAD.
PERFORM CALL_TRANSACTION.
PERFORM CLOSE_GROUP.
PERFORM WRITE_ERROR.
*& Form DATA_UPLOAD
text
--> p1 text
<-- p2 text
FORM DATA_UPLOAD.
*call function ws_upload to retrieve data from a flat file in the
*presentation server into an internal table
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = V_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
if ws_upload fails then display appropriate message
IF SY-SUBRC 0.
MESSAGE E000 WITH 'Data not Uploaded into internal table'.
ENDIF.
ENDFORM. " DATA_UPLOAD
*& Form CALL_TRANSACTION
text
--> p1 text
<-- p2 text
FORM CALL_TRANSACTION.
DATA : V_IVDAT(10) TYPE C,
V_AKTIV(10) TYPE C,
V_MESSAGE(404) TYPE C.
REFRESH T_BDCDATA.
CLEAR T_BDCDATA.
V_COUNT = 0.
V_MESSAGE_CNT = 0.
LOOP AT IT_DATA .
V_COUNT = V_COUNT + 1.
*perform open_group.
perform bdc_dynpro using 'SAPMM06E' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EKKO-LIFNR'
IT_DATA-LIFNR.
perform bdc_field using 'RM06E-BSART'
IT_DATA-BSART.
*perform bdc_field using 'RM06E-BEDAT'
'24.01.2008'.
perform bdc_field using 'RM06E-BEDAT'
IT_DATA-BEDAT.
perform bdc_field using 'EKKO-EKORG'
IT_DATA-EKORG.
perform bdc_field using 'EKKO-EKGRP'
IT_DATA-EKGRP.
*perform bdc_field using 'RM06E-LPEIN'
'T'.
perform bdc_field using 'RM06E-WERKS'
IT_DATA-WERKS.
perform bdc_dynpro using 'SAPMM06E' '0101'.
perform bdc_field using 'BDC_CURSOR'
'EKKO-INCO2'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EKKO-EKGRP'
IT_DATA-EKGRP1. "'SP3'.
*perform bdc_field using 'EKKO-PINCR'
IT_DATA-PINCR. "'10'.
*perform bdc_field using 'EKKO-SPRAS'
IT_DATA-SPRAS. "'EN'.
*perform bdc_field using 'EKKO-UPINC'
IT_DATA-UPINC. "'1'.
*perform bdc_field using 'EKKO-ZTERM'
IT_DATA-ZTERM.
*perform bdc_field using 'EKKO-WAERS'
IT_DATA-WAERS. "'INR'.
*perform bdc_field using 'EKKO-ZBD1T'
IT_DATA-ZBD1T. "'44'.
*perform bdc_field using 'EKKO-WKURS'
IT_DATA-WKURS. "' 1.00000'.
*perform bdc_field using 'EKKO-INCO1'
IT_DATA-INCO1.
perform bdc_field using 'EKKO-INCO2'
IT_DATA-INCO2.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-NETPR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EKPO-KNTTP(01)'
'N'.
perform bdc_field using 'EKPO-KNTTP(01)'
IT_DATA-KNTTP.
perform bdc_field using 'EKPO-EMATN(01)'
IT_DATA-EMATN.
perform bdc_field using 'EKPO-MENGE(01)'
IT_DATA-MENGE.
perform bdc_field using 'EKPO-NETPR(01)'
IT_DATA-NETPR.
perform bdc_dynpro using 'SAPMM06E' '0111'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-MWSKZ'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EKPO-KNTTP'
'N'.
*perform bdc_field using 'EKPO-TXZ01'
'Clamps & Connector'.
*perform bdc_field using 'EKPO-MENGE'
'4'.
*perform bdc_field using 'EKPO-SPINF'
'A'.
*perform bdc_field using 'EKPO-NETPR'
'100.00'.
*perform bdc_field using 'EKPO-PEINH'
'1'.
*perform bdc_field using 'EKPO-BPRME'
'NO'.
*perform bdc_field using 'EKPO-BPUMN'
'1'.
*perform bdc_field using 'EKPO-BPUMZ'
'1'.
*perform bdc_field using 'EKPO-PRSDR'
'X'.
*perform bdc_field using 'RM06E-EEIND'
'24.01.2008'.
*perform bdc_field using 'RM06E-LPEIN'
'D'.
*perform bdc_field using 'EKPO-WEPOS'
'X'.
perform bdc_field using 'EKPO-MWSKZ'
IT_DATA-MWSKZ.
*perform bdc_field using 'EKPO-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06E' '0511'.
perform bdc_field using 'BDC_CURSOR'
'EKKN-SAKTO'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
*perform bdc_field using 'EKKN-SAKTO'
'6034025'.
*perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
*perform bdc_field using 'BDC_CURSOR'
'COBL-VORNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-NPLNR'
IT_DATA-NPLNR.
perform bdc_field using 'COBL-VORNR'
IT_DATA-VORNR.
perform bdc_dynpro using 'SAPMM06E' '0111'.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EBELP'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'RM06E-EBELP'
'10'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'ME21'.
perform close_group.
LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
AT FIRST.
V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
T_MESSTAB-REC_NO = V_COUNT.
ENDAT.
MODIFY T_MESSTAB TRANSPORTING REC_NO.
ENDLOOP.
REFRESH T_BDCDATA.
CLEAR T_BDCDATA.
ENDLOOP.
SKIP.
WRITE : /10 'Record Number ', 30 'Error Message'.
SKIP.
endform.
*& Form WRITE_ERROR
text
--> p1 text
<-- p2 text
FORM WRITE_ERROR.
LOOP AT T_MESSTAB.
WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
ENDLOOP.
ULINE /10(100).
WRITE : /10 'No of Records : ' , V_COUNT.
WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
ULINE /10(100).
ENDFORM. " WRITE_ERROR
*& Form CHECK_BDC
text
--> p1 text
<-- p2 text
FORM CHECK_BDC.
DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
WHERE PROGRAMM EQ SY-REPID
AND YCHECK EQ 'X'.
IF SY-SUBRC NE 0.
MESSAGE S000(YM) WITH 'Execution not possible'.
STOP.
ENDIF.
ENDFORM. " CHECK_BDC
<REMOVED BY MODERATOR>
Thanks
Rahul
Edited by: Alvaro Tejada Galindo on Jan 24, 2008 9:38 AMit depends on your release whether you can use ME21N and/or the bapi.
but why throw away what you have already achieved? ME21 still works also in later releases. to find out the mandatory fields in your system, check the customzing settings in tx. OLME -> Purchase Order -> Define Screen Layout at Document Level -> click on ME21 -> Terms of delivery and payment. Here are the incoterm-settings.
Edited by: Mylene Euridice Dorias on Jan 24, 2008 5:19 PM -
Dear All,
I have a requirement to create PO using transaction ME21N. I had written a code to create PO using BDC for transaction ME21. But the user wants it to be modified to ME21N. The user wants the PO created in the foreground like the one i created fro ME21. But is it possible to use BDC for ME21N or is there any other way i can change the BAPI to foreground processing like in BDC?
Regards,
KarthikHi Raghavender,
This is a report to display and validate the RFQ's. And once the user selects the RFQ and clicks on Create PO from RFQ push button, it should go to transaction 'ME21N' with values from RFQ. ( similar to what we do in ME21N, when we drag RFQ from the documents overview and drop it into cart, the values are populated). I want the similar functionality to happen when the user clicks on clicks on Create PO push button. But it should happen only in the foreground and not background.
Regards,
Karthik -
BDC for ME21N (Flat file format)
Hello,
I have to write a BDC for ME21N(stock transfer).... Someone pls give me the format of flat file... we need separate files for header and items or only one file is enough??? pls someone send me the format and code......
my email id is [email protected]
Thanks in advance...
Regards,
Maya.Hi
see this and do accordingly
REPORT zmm_bdcp_purchaseorderkb02
NO STANDARD PAGE HEADING LINE-SIZE 255.
Declaring internal tables *
*-----Declaring line structure
DATA : BEGIN OF it_dummy OCCURS 0,
dummy(255) TYPE c,
END OF it_dummy.
*-----Internal table for line items
DATA : BEGIN OF it_idata OCCURS 0,
ematn(18), "Material Number.
menge(13), "Qyantity.
netpr(11), "Net Price.
werks(4), "Plant.
ebelp(5), "Item Number.
END OF it_idata.
*-----Deep structure for header data and line items
DATA : BEGIN OF it_me21 OCCURS 0,
lifnr(10), "Vendor A/c No.
bsart(4), "A/c Type.
bedat(8), "Date of creation of PO.
ekorg(4), "Purchasing Organisation.
ekgrp(3), "Purchasing Group.
x_data LIKE TABLE OF it_idata,
END OF it_me21.
DATA : x_idata LIKE LINE OF it_idata.
DATA : v_delimit VALUE ','.
DATA : v_indx(3) TYPE n.
DATA : v_fnam(30) TYPE c.
DATA : v_count TYPE n.
DATA : v_ne TYPE i.
DATA : v_ns TYPE i.
*include bdcrecx1.
INCLUDE zmm_incl_purchaseorderkb01.
Search help for file *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
START-OF-SELECTION.
To upload the data into line structure *
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = it_dummy.
Processing the data from line structure to internal tables *
REFRESH:it_me21.
CLEAR :it_me21.
LOOP AT it_dummy.
IF it_dummy-dummy+0(01) = 'H'.
v_indx = v_indx + 1.
CLEAR it_idata.
REFRESH it_idata.
CLEAR it_me21-x_data.
REFRESH it_me21-x_data.
SHIFT it_dummy.
SPLIT it_dummy AT v_delimit INTO it_me21-lifnr
it_me21-bsart
it_me21-bedat
it_me21-ekorg
it_me21-ekgrp.
APPEND it_me21.
ELSEIF it_dummy-dummy+0(01) = 'L'.
SHIFT it_dummy.
SPLIT it_dummy AT v_delimit INTO it_idata-ematn
it_idata-menge
it_idata-netpr
it_idata-werks
it_idata-ebelp.
APPEND it_idata TO it_me21-x_data.
MODIFY it_me21 INDEX v_indx.
ENDIF.
ENDLOOP.
To open the group *
PERFORM open_group.
To populate the bdcdata table for header data *
LOOP AT it_me21.
v_count = v_count + 1.
REFRESH it_bdcdata.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0100',
' ' 'BDC_CURSOR' 'EKKO-LIFNR',
' ' 'BDC_OKCODE' '/00',
' ' 'EKKO-LIFNR' it_me21-lifnr,
' ' 'RM06E-BSART' it_me21-bsart,
' ' 'RM06E-BEDAT' it_me21-bedat,
' ' 'EKKO-EKORG' it_me21-ekorg,
' ' 'EKKO-EKGRP' it_me21-ekgrp,
' ' 'RM06E-LPEIN' 'T'.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'RM06E-EBELP',
' ' 'BDC_OKCODE' '/00'.
MOVE 1 TO v_indx.
*-----To populate the bdcdata table for line item data
LOOP AT it_me21-x_data INTO x_idata.
CONCATENATE 'EKPO-EMATN(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-ematn.
CONCATENATE 'EKPO-MENGE(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-menge.
CONCATENATE 'EKPO-NETPR(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-netpr.
CONCATENATE 'EKPO-WERKS(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-werks.
v_indx = v_indx + 1.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'RM06E-EBELP',
' ' 'BDC_OKCODE' '/00'.
ENDLOOP.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'RM06E-EBELP',
' ' 'BDC_OKCODE' '=BU'.
PERFORM bdc_transaction USING 'ME21'.
ENDLOOP.
PERFORM close_group.
End of selection event *
END-OF-SELECTION.
IF session NE 'X'.
*-----To display the successful records
WRITE :/10 text-001. "Sucess records
WRITE :/10 SY-ULINE(20).
SKIP.
IF it_sucess IS INITIAL.
WRITE :/ text-002.
ELSE.
WRITE :/ text-008, "Total number of Succesful records
35 v_ns.
SKIP.
WRITE:/ text-003, "Vendor Number
17 text-004, "Record number
30 text-005. "Message
ENDIF.
LOOP AT it_sucess.
WRITE:/4 it_sucess-lifnr,
17 it_sucess-tabix CENTERED,
30 it_sucess-sucess_rec.
ENDLOOP.
SKIP.
*-----To display the erroneous records
WRITE:/10 text-006. "Error Records
WRITE:/10 SY-ULINE(17).
SKIP.
IF it_error IS INITIAL.
WRITE:/ text-007. "No error records
ELSE.
WRITE:/ text-009, "Total number of erroneous records
35 v_ne.
SKIP.
WRITE:/ text-003, "Vendor Number
17 text-004, "Record number
30 text-005. "Message
ENDIF.
LOOP AT it_error.
WRITE:/4 it_error-lifnr,
17 it_error-tabix CENTERED,
30 it_error-error_rec.
ENDLOOP.
REFRESH it_sucess.
REFRESH it_error.
ENDIF.
CODE IN INCLUDE.
Include ZMM_INCL_PURCHASEORDERKB01
DATA: it_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: it_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA: E_GROUP_OPENED.
*-----Internal table to store sucess records
DATA:BEGIN OF it_sucess OCCURS 0,
msgtyp(1) TYPE c,
lifnr LIKE ekko-lifnr,
tabix LIKE sy-tabix,
sucess_rec(125),
END OF it_sucess.
DATA: g_mess(125) type c.
*-----Internal table to store error records
DATA:BEGIN OF it_error OCCURS 0,
msgtyp(1) TYPE c,
lifnr LIKE ekko-lifnr,
tabix LIKE sy-tabix,
error_rec(125),
END OF it_error.
Selection screen
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS session RADIOBUTTON GROUP ctu. "create session
SELECTION-SCREEN COMMENT 3(20) text-s07 FOR FIELD session.
SELECTION-SCREEN POSITION 45.
PARAMETERS ctu RADIOBUTTON GROUP ctu. "call transaction
SELECTION-SCREEN COMMENT 48(20) text-s08 FOR FIELD ctu.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) text-s01 FOR FIELD group.
SELECTION-SCREEN POSITION 25.
PARAMETERS group(12). "group name of session
SELECTION-SCREEN COMMENT 48(20) text-s05 FOR FIELD ctumode.
SELECTION-SCREEN POSITION 70.
PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 48(20) text-s06 FOR FIELD cupdate.
SELECTION-SCREEN POSITION 70.
PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'L'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) text-s03 FOR FIELD keep.
SELECTION-SCREEN POSITION 25.
PARAMETERS: keep AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN COMMENT 48(20) text-s09 FOR FIELD e_group.
SELECTION-SCREEN POSITION 70.
PARAMETERS e_group(12). "group name of error-session
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 51(17) text-s03 FOR FIELD e_keep.
SELECTION-SCREEN POSITION 70.
PARAMETERS: e_keep AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN END OF LINE.
PARAMETERS:p_file LIKE rlgrap-filename.
at selection screen *
AT SELECTION-SCREEN.
group and user must be filled for create session
IF SESSION = 'X' AND
GROUP = SPACE. "OR USER = SPACE.
MESSAGE E613(MS).
ENDIF.
create batchinput session *
FORM OPEN_GROUP.
IF SESSION = 'X'.
SKIP.
WRITE: /(20) 'Create group'(I01), GROUP.
SKIP.
*----open batchinput group
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = GROUP
USER = sy-uname.
WRITE:/(30) 'BDC_OPEN_GROUP'(I02),
(12) 'returncode:'(I05),
SY-SUBRC.
ENDIF.
ENDFORM. "OPEN_GROUP
end batchinput session *
FORM CLOSE_GROUP.
IF SESSION = 'X'.
*------close batchinput group
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
(12) 'returncode:'(I05),
SY-SUBRC.
ELSE.
IF E_GROUP_OPENED = 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /.
WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
ENDIF.
ENDIF.
ENDFORM. "CLOSE_GROUP
Start new transaction according to parameters *
FORM BDC_TRANSACTION USING TCODE TYPE ANY.
DATA: L_SUBRC LIKE SY-SUBRC.
*------batch input session
IF SESSION = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = TCODE
TABLES
DYNPROTAB = it_BDCDATA.
WRITE: / 'BDC_INSERT'(I03),
TCODE,
'returncode:'(I05),
SY-SUBRC,
'RECORD:',
SY-INDEX.
ELSE.
REFRESH it_MESSTAB.
CALL TRANSACTION TCODE USING it_BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO it_MESSTAB.
L_SUBRC = SY-SUBRC.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
ENDIF.
Message handling for Call Transaction *
perform subr_mess_hand using g_mess.
*-----Erzeugen fehlermappe
IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = E_GROUP
USER = sy-uname
KEEP = E_KEEP.
E_GROUP_OPENED = 'X'.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = TCODE
TABLES
DYNPROTAB = it_BDCDATA.
ENDIF.
REFRESH it_BDCDATA.
ENDFORM. "BDC_TRANSACTION
Form subr_bdc_table *
text
-->P_0220 text *
-->P_0221 text *
-->P_0222 text *
FORM subr_bdc_table USING VALUE(P_0220) TYPE ANY
VALUE(P_0221) TYPE ANY
VALUE(P_0222) TYPE ANY.
CLEAR it_bdcdata.
IF P_0220 = ' '.
CLEAR it_bdcdata.
it_bdcdata-fnam = P_0221.
it_bdcdata-fval = P_0222.
APPEND it_bdcdata.
ELSE.
it_bdcdata-dynbegin = P_0220.
it_bdcdata-program = P_0221.
it_bdcdata-dynpro = P_0222.
APPEND it_bdcdata.
ENDIF.
ENDFORM. " subr_bdc_table
Form subr_mess_hand *
text *
-->P_G_MESS text *
FORM subr_mess_hand USING P_G_MESS TYPE ANY.
LOOP AT IT_MESSTAB.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = it_messtab-msgid
LANG = it_messtab-msgspra
NO = it_messtab-msgnr
v1 = it_messtab-msgv1
v2 = it_messtab-msgv2
IMPORTING
MSG = P_G_MESS
EXCEPTIONS
OTHERS = 0.
CASE it_messtab-msgtyp.
when 'E'.
it_error-error_rec = P_G_MESS.
it_error-lifnr = it_me21-lifnr.
it_error-tabix = v_count.
APPEND IT_ERROR.
when 'S'.
it_sucess-sucess_rec = P_G_MESS.
it_sucess-lifnr = it_me21-lifnr.
it_sucess-tabix = v_count.
APPEND IT_SUCESS.
endcase.
ENDLOOP.
Describe table it_sucess lines v_ns.
Describe table it_error lines v_ne.
ENDFORM. " subr_mess_hand
Regards
Anji -
Hi,
How to write BDC, for Tcode KP06, How to handle the table control in that Tcode.
or any other way to upload data for this Tcode.
Regards
ManoharHi,
check the sample code for transaction ME51 and ME21.
PARAMETERS:
p_fname TYPE ibipparms-path.
*" Data declarations...................................................
Work variables *
DATA:
fs_bdc TYPE bdcdata,
fs_msg TYPE bdcmsgcoll.
Internal table to hold bdc data *
DATA:
t_bdc LIKE
STANDARD TABLE
OF fs_bdc.
Internal table to hold bdcmessage data *
DATA:
t_msg LIKE
STANDARD TABLE
OF fs_msg.
DATA:
w_string(50) TYPE c,
w_string1(19) TYPE c,
w_message(72) TYPE c,
w_num TYPE i VALUE 1,
w_num1 TYPE i.
*" Type declarations...................................................
Type declaration of the structure to hold header data *
DATA:
BEGIN OF t_header OCCURS 0,
ftype TYPE c,
doctype(10) TYPE c,
acctcat(4) TYPE c,
date(10) TYPE c,
plant(4) TYPE n,
text(10) TYPE c,
qty(5) TYPE n,
units(5) TYPE c,
pgrp(3) TYPE n,
mgrp(3) TYPE n,
price(2) TYPE n,
gacct(6) TYPE n,
cost(4) TYPE n,
END OF t_header.
START-OF-SELECTION EVENT *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
file_name = p_fname
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'c:\temp\item2.txt'
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_header
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. " IF SY-SUBRC <> 0
LOOP AT t_header WHERE ftype = 'H'..
CLEAR fs_msg.
IF t_header-ftype = 'H'.
PERFORM bdc_program USING 'SAPMM06B' '0100'.
PERFORM bdc_field USING 'eban-BSART' t_header-doctype.
PERFORM bdc_field USING 'eban-KNTTP' t_header-acctcat.
PERFORM bdc_field USING 'RM06B-EEIND' t_header-date.
PERFORM bdc_field USING 'eban-WERKS' t_header-plant.
PERFORM bdc_field USING 'BDC_OKCODE' 'AB'.
ENDIF.
IF t_header-ftype = 'I'.
LOOP AT t_header WHERE ftype = 'I'.
PERFORM bdc_program USING 'SAPMM06B' '0106'.
w_string = 'EBAN-TXZ01(01)'.
w_string+12(1) = w_num.
PERFORM bdc_field USING w_string t_header-text.
w_string = 'EBAN-MENGE(01)'.
w_string+12(1) = w_num.
PERFORM bdc_field USING w_string t_header-qty.
w_string = 'EBAN-MEINS(01)'.
w_string+12(1) = w_num.
PERFORM bdc_field USING w_string t_header-units.
w_string = 'EBAN-EKGRP(01)'.
w_string+12(1) = w_num.
PERFORM bdc_field USING w_string t_header-pgrp.
w_string = 'EBAN-MATKL(01)'.
w_string+12(1) = w_num.
PERFORM bdc_field USING w_string t_header-mgrp.
PERFORM bdc_field USING 'BDC_OKCODE' '=KN'.
w_num = w_num + 1.
PERFORM bdc_program USING 'SAPMM06B' '0102'.
PERFORM bdc_field USING 'EBAN-preis' t_header-price.
PERFORM bdc_field USING 'BDC_OKCODE' '=KN'.
PERFORM bdc_program USING 'SAPMM06B' '0505'.
PERFORM bdc_field USING 'BDC_OKCODE' '=KWE'.
PERFORM bdc_program USING 'SAPlkacb' '0002'.
PERFORM bdc_field USING 'EBAN-sakto' t_header-gacct.
PERFORM bdc_field USING 'cobl-kostl' t_header-cost.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_program USING 'SAPMM06B' '0102'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
ENDIF.
ENDLOOP.
ENDLOOP.
PERFORM bdc_program USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_OKCODE' 'BU'.
PERFORM BDC_PROGRAM USING 'SAPMM06E' '100'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' 'BACK'.
CALL TRANSACTION 'ME51' USING t_bdc MODE 'N' MESSAGES INTO t_msg.
LOOP AT t_msg INTO fs_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = fs_msg-msgid
lang = sy-langu
no = fs_msg-msgnr
v1 = fs_msg-msgv1
v2 = fs_msg-msgv2
v3 = fs_msg-msgv3
v4 = fs_msg-msgv4
IMPORTING
msg = w_message
EXCEPTIONS
not_found = 1
OTHERS = 2.
WRITE:
/ w_message.
ENDLOOP.
CLEAR t_bdc[].
PERFORM bdc_program USING 'SAPMM06E' '0100'.
PERFORM bdc_field USING 'EKKO-LIFNR' '1000'.
PERFORM bdc_field USING 'EKKO-EKORG' '1000'.
PERFORM bdc_field USING 'EKKO-EKGRP' '100'.
PERFORM bdc_field USING 'BDC_OKCODE' 'BS'.
PERFORM bdc_program USING 'SAPMM06E' '0501'.
PERFORM bdc_field USING 'EKET-BANFN' fs_msg-msgv1.
PERFORM bdc_field USING 'BDC_OKCODE' '=KOPF'.
PERFORM bdc_program USING 'SAPMM06E' '0125'.
PERFORM bdc_field USING 'BDC_OKCODE' 'MALL'.
PERFORM bdc_program USING 'SAPMM06E' '0125'.
PERFORM bdc_field USING 'BDC_OKCODE' 'REFH'.
PERFORM bdc_program USING 'SAPMM06E' '0504'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_program USING 'SAPMM06E' '0111'.
PERFORM bdc_field USING 'BDC_OKCODE' '=NEXP'.
*perform bdc_program using 'SAPLSPO1' '0300'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' 'YES'.
PERFORM bdc_program USING 'SAPMM06E' '0504'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_program USING 'SAPMM06E' '0111'.
PERFORM bdc_field USING 'BDC_OKCODE' '=NEXP'.
*perform bdc_program using 'SAPMM06E' '0504'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ENTE'.
*perform bdc_program using 'SAPMM06E' '0111'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=NEXP'.
perform bdc_program using 'SAPMM06E' '0504'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ENTE'.
perform bdc_program using 'SAPMM06E' '0504'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ENTE'.
*perform bdc_program using 'SAPMM06E' '0111'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=NEXP'.
PERFORM bdc_program USING 'SAPMM06E' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE' 'BU'.
CALL TRANSACTION 'ME21' USING t_bdc MODE 'N' MESSAGES INTO t_msg
LOOP AT t_msg INTO fs_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = fs_msg-msgid
lang = sy-langu
no = fs_msg-msgnr
v1 = fs_msg-msgv1
v2 = fs_msg-msgv2
v3 = fs_msg-msgv3
v4 = fs_msg-msgv4
IMPORTING
msg = w_message
EXCEPTIONS
not_found = 1
OTHERS = 2.
WRITE:
/ W_message.
ENDLOOP. " LOOP T_MSG
CLEAR t_bdc[].
PERFORM bdc_program USING 'SAPMM06E' '0105'.
PERFORM bdc_field USING 'RM06E-BSTNR' fs_msg-msgv2.
PERFORM bdc_field USING 'BDC_OKCODE' 'AB'.
w_num1 = w_num - 1.
DO w_num1 TIMES.
w_string1 = 'RM06E-TCSELFLAG(00)'.
w_string1+17(1) = w_num1.
PERFORM bdc_program USING 'SAPMM06E' '0120'.
PERFORM bdc_field USING w_string1 'X'.
PERFORM bdc_field USING 'BDC_OKCODE' 'DL'.
w_num1 = w_num1 - 1.
ENDDO. " DO W_NUM1
PERFORM bdc_program USING 'SAPMM06E' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE' 'BU'.
CALL TRANSACTION 'ME22' USING t_bdc MODE 'A' MESSAGES INTO t_msg.
LOOP AT t_msg INTO fs_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = fs_msg-msgid
lang = sy-langu
no = fs_msg-msgnr
v1 = fs_msg-msgv1
v2 = fs_msg-msgv2
v3 = fs_msg-msgv3
v4 = fs_msg-msgv4
IMPORTING
msg = w_message
EXCEPTIONS
not_found = 1
OTHERS = 2.
WRITE:
/ w_message.
ENDLOOP. " LOOP T_MSG
*& Form bdc_program
This subroutine gives screenname and screen number *
There are no interface parameters to be passed to this subroutine. *
FORM bdc_program USING value(p_screen)
value(p_num).
CLEAR fs_bdc.
fs_bdc-program = p_screen.
fs_bdc-dynpro = p_num.
fs_bdc-dynbegin = 'X'.
APPEND fs_bdc TO t_bdc.
ENDFORM. " FORM BDC_PROGRAM
*& Form BDC_FIELD
This subroutine gives the field name and field value *
There are no interface parameters to be passed to this subroutine. *
FORM bdc_field USING value(p_name)
value(p_value).
CLEAR fs_bdc.
fs_bdc-fnam = p_name.
fs_bdc-fval = p_value.
APPEND fs_bdc TO t_bdc.
ENDFORM. " FORM BDC_FIELD
Regards,
jaya -
Error while running a BDC for the Transaction F-02
Hi,
I'm getting an error <b><i>"Parking not possible during Batch Input"</i></b> while running a BDC for the transaction F-02.
When i click on the error message it displays the message [b<i>]"In Customizing, you can control whether an error message is issued."</b></i>
How to solve this issue?.
Waiting for ur replies.........
Regards
N.SenthilHi,
When you are doing the recording in SHDB, and in the same screen where the TCODE to be recorded is given, there are options that you can choose called "Recording Parameters"...Select the checkbox which says "Not a Batch Input Session", this will set the sy-binpt variable to " "(in a recording by default it is "X")...and you will not get this error...
Also make sure while writing the BDC program to make use of the "bdc options" parameter which has this property to switch of sy-binpt...
Refer below theard for sample bdc code for f-02.
https://forums.sdn.sap.com/click.jspa?searchID=5126766&messageID=1538409
Regards -
Problem in creation of BDC for transaction phap_create
Hello Friends,
I am trying to create BDC for PHAP_CREATE.
When you run a transaction a pop up window appears to select the template id.
And in BDC it is selected by cursor position. So once selected, the value of template id cannot be changed.
I want this as a parameter.So that each time I run a BDC I will be able to create different types of Appraisal documents i.e with different template ids.
How to go about it???
Regards,
BhushanHi,
For selecting the id, while doing recording,
record with
CTRL + F ( Where u can give ur id) and proceed further. -
How to give line items in flatfile while doing BDC for Table control
Hi all,
I am writing BDC for Multiple line items and Transaction is : FSE5N.
How do i give the data in the flat file. I mean how do we give the multiple line items in flat file , i.e for second line item again we have to header data or not ?
ex:
1015;ALL;demo;kr;INR;01;0001;3000172;100
1015;ALL;demo;kr;INR;01;0001;3000172;200
for first lineitem : 3000172;100
for 2nd line item : 3000172; 200.
header data : 1015;ALL;demo;kr;INR;01;0001.
Thanks in advance
krupaliHii ,
u can give in the same format as u have done in the example.
A B C D E F G H I
1015;ALL;demo;kr;INR;01;0001;3000172;100
1015;ALL;demo;kr;INR;01;0001;3000172;200
and while writing the loop u can give
loop at it_head.
loop at it_head where a = it_head-A and b = it_head-B ..........upto G = it_head-G.
endloop.
endloop.
check this
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Neeraj -
Hi Friends,
I am facing problem while developing BDC for tcode F150. The last action i.e. scheduling for particular dunning date is not getting executed in my BDC.
I am also pasting the end part of my BDC recording. Please review it and advise.
PERFORM bdc_dynpro USING 'SAPLF150_JOBS' '1000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'F150V-STRZT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=JOBS'.
PERFORM bdc_field USING 'F150V-STRDT'
rdate.
PERFORM bdc_field USING 'F150V-XSTRF'
'X'.
select single SPLD into p_out from USR01 where bname = sy-uname.
perform bdc_field using 'ITCPO-TDDEST'
p_out.
CALL TRANSACTION 'F150'
Thank you,
Swapnil
Edited by: Swapnil Tawade on Sep 22, 2008 3:15 PMHi,
If u want it for some specific plants then before populating data to bdcdata internal table check the conditions for which the plant fields required values to be passed and if the condition is satisfied then pass the plant field to bdcdata table . If the condition is not satisfied then dont pass that plant field to bdcdata table bcoz if u r not passing any field to bdcdata table then that field is going have default values.
Regards,
Shafi -
Hello All,
A code has been written in the User exit for Tcode ME22N, Which sets the indicator on PO line item. This has been done by modifying the standard itab POT by using field symbols, because the fields to be modified are shown in display mode in the tcode ME22N and cannot be done in BDC. See the below code in user exit ZXM06U43.
DATA char(50) VALUE '(SAPLMEPO)POT[]'.
CLEAR wa_ind.
FIELD-SYMBOLS <f1> TYPE ANY.
Move memory of internal table POT to field symbol f1.
ASSIGN (char) TO <f1>.
Move content of f1 to internal table i_ind
i_ind[] = <f1> .
LOOP AT i_ind INTO wa_ind.
IF wa_ind-pstyp = '9'. " Service PO - item category
IF PO Line item has History per Purchasing Document as 'D'
Set indicators on, for the line item.
CLEAR v_cnt.
SELECT COUNT( * ) INTO v_cnt FROM ent5100
WHERE ebeln = wa_ind-ebeln
AND ebelp = wa_ind-ebelp
AND bewtp = 'D'.
IF sy-subrc = 0.
wa_ind-wepos = 'X'. " Set Goods Receipt Indicator
wa_ind-webre = 'X'. " Set GR-based IV Indicator
wa_ind-lebre = 'X'. " Set Srv-based IV Indicator
ELSE.
*End of addition SAP-20070910104025 - SL36 - D01K963369
wa_ind-wepos = ' '. " Clear Goods Receipt Indicator
wa_ind-webre = ' '. " Clear GR-based IV Indicator
wa_ind-lebre = ' '. " Clear Srv-based IV Indicator
wa_ind-xersy = ' '. " Clear ERS Indicator
ENDIF.
MODIFY i_ind FROM wa_ind INDEX sy-tabix.
ENDIF.
ENDLOOP.
<f1> = i_ind[].
ENDIF.
ENDIF.
This code is in production and has been working fine.
The requirnment is now to make this indicator work for all the Purchase order before this code has been written in the Exit. For this my functional suggests that to write a separate program using BDC for PO change and jus add a period/dot in the short text and save it. The code has been written, the user exit and the above code is getting triggrred values are updated in internal table correctly.
However the flags was not set or cleared when seen in the tcode ME22N . This works fine if the tcode me22n is run directly and not working in BDC.
I have tried with ME22 without enjoy transaction in BDC changing the POT Program to SAPMM06E. It does not work.
Please help me as why it is not uodating in the table when using BDC.
Thanks in Advance.
Senthil KumarHi All,
Any luck on this??
Thanks -
Dear Friends,
Do anybody has the code for BDC for Transaction Code F-02.
If anybody has plz send me.
Thanks & Reg,
Nishanttry this:
REPORT zfir_f02
NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
TYPES : BEGIN OF tp_flatfile,
bldat(10),
doctyp(2),
comp(4),
postdate(10),
period(2),
currency(5),
reference(16),
htext(25),
postkey(2),
account(17),
amount(16),
profit(10),
assign(18),
text(50),
busarea(4),
cost(10),
bline(10),
base(16),
postkey2(2),
account2(17),
amount2(16),
profit2(10),
assign2(18),
text2(50),
busarea2(4),
END OF tp_flatfile.
DATA : t_flatfile TYPE TABLE OF tp_flatfile WITH HEADER LINE.
DATA : g_file TYPE string.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
*C-- Selection Screen VALUE-REQUEST FOR File path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
g_file = p_file.
*START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = g_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_flatfile
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.
loop at t_flatfile.
write:/ t_flatfile-doctyp,t_flatfile-amount.
endloop.
START-OF-SELECTION.
PERFORM open_group.
LOOP AT t_flatfile.
PERFORM bdc_dynpro USING 'SAPMF05A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BKPF-BLDAT'
t_flatfile-bldat.
PERFORM bdc_field USING 'BKPF-BLART'
t_flatfile-doctyp.
PERFORM bdc_field USING 'BKPF-BUKRS'
t_flatfile-comp.
PERFORM bdc_field USING 'BKPF-BUDAT'
t_flatfile-postdate.
PERFORM bdc_field USING 'BKPF-MONAT'
t_flatfile-period.
PERFORM bdc_field USING 'BKPF-WAERS'
t_flatfile-currency.
PERFORM bdc_field USING 'BKPF-XBLNR'
t_flatfile-reference.
PERFORM bdc_field USING 'BKPF-BKTXT'
t_flatfile-htext.
PERFORM bdc_field USING 'FS006-DOCID'
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account.
CASE t_flatfile-postkey.
WHEN '40' OR '50'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text.
IF t_flatfile-postkey = '40' and t_flatfile-account > '300000'.
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_field USING 'COBL-PRCTR'
t_flatfile-profit.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey2.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account2.
PERFORM debit_credit.
WHEN '21' OR '31' OR '24' OR '34'.
**perform bdc_field using 'RF05A-NEWBS'
'31'.
**perform bdc_field using 'RF05A-NEWKO'
'25000'.
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount.
PERFORM bdc_field USING 'BSEG-GSBER'
t_flatfile-busarea.
PERFORM bdc_field USING 'BSEG-ZFBDT'
t_flatfile-bline.
PERFORM bdc_field USING 'BSEG-SKFBT'
t_flatfile-base.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey2.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account2.
PERFORM bdc_dynpro USING 'SAPLFWTD' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'WITH_ITEM-WT_WITHCD(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=GO'.
PERFORM debit_credit.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount2.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign2.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text2.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea2.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_field USING 'COBL-PRCTR'
t_flatfile-profit2.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
WHEN '01' OR '11' OR '04' OR '14' OR '07' OR '17'.
*perform bdc_field using 'RF05A-NEWBS'
'11'.
*perform bdc_field using 'RF05A-NEWKO'
'1'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount.
PERFORM bdc_field USING 'BSEG-MWSKZ'
PERFORM bdc_field USING 'BSEG-GSBER'
t_flatfile-busarea.
IF NOT t_flatfile-bline IS INITIAL.
PERFORM bdc_field USING 'BSEG-ZFBDT'
t_flatfile-bline.
ENDIF.
IF NOT t_flatfile-base IS INITIAL.
PERFORM bdc_field USING 'BSEG-SKFBT'
t_flatfile-base.
ENDIF.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey2.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account2.
PERFORM debit_credit.
ENDCASE.
*perform bdc_dynpro using 'SAPMF05A' '0301'.
*perform bdc_field using 'BDC_CURSOR'
'BSEG-WRBTR'.
*perform bdc_field using 'BDC_OKCODE'
'=AB'.
*perform bdc_field using 'BSEG-WRBTR'
'3,000.00'.
*perform bdc_field using 'BSEG-MWSKZ'
*perform bdc_field using 'BSEG-GSBER'
'VUSO'.
*perform bdc_field using 'BSEG-ZFBDT'
'19.07.2005'.
*perform bdc_field using 'BSEG-SKFBT'
'3,000.00'.
*perform bdc_field using 'BSEG-ZUONR'
'ASSIGN'.
*perform bdc_field using 'BSEG-SGTXT'
'TEXT'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0700'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWBS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'BKPF-XBLNR'
'REF'.
*perform bdc_field using 'BKPF-BKTXT'
'text'.
PERFORM bdc_transaction USING 'F-02'.
ENDLOOP.
PERFORM close_group.
*& Form debit_credit
text
FORM debit_credit.
**SRINI
IF t_flatfile-postkey = '40' OR t_flatfile-postkey = '50'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDIF.
***SRINI
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount2.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign2.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text2.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea2.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_field USING 'COBL-PRCTR'
t_flatfile-profit2.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDFORM. "debit_credit
regards,
Bikash -
User Exit for ME21 PO Creation at the time of saving--Urgent
Hi,
Can some one help me out in finding the user exit for PO creation at the time of saving.
The Requirement is:
I need to create a custom field in EKKO table.
After appending the structure with the field to the EKKO table, i need to create a PO.
Now i need to update the field which has been created at the time of pressing the SAVE button.
I need to update the EKKO table it self.
I could find the user exits but none of them have the EKKO table either in Changing or in Tables.
Thanks,Hi,
You may want to check this user exits.
EXIT_SAPMM06E_012 - Check Customer-Specific Data Before Saving
EXIT_SAPMM06E_013 - Update Customer-Specific Data in Purchasing Document
Here is the list of available user exits for ME21.
EXIT_SAPMM06E_001 - Other Number Range or Own Document Number
EXIT_SAPMM06E_004 - User Exit for Cust.-Specific Control of Import Data Screens in Purchasing
EXIT_SAPMM06E_005 - Field Selection Control: Vendor Address Screen
EXIT_SAPMM06E_006 - Export Data to Customer Subscreen for Purchasing Document Header (PBO)
EXIT_SAPMM06E_007 - Export Data to Customer Subscreen for Purchasing Document Header (PAI)
EXIT_SAPMM06E_008 - Import Data from Customer Subscreen for Purchasing Document Header
EXIT_SAPMM06E_009 - Reset Customer Data at Beginning of New Document (Without Dialog)
EXIT_SAPMM06E_012 - Check Customer-Specific Data Before Saving
EXIT_SAPMM06E_013 - Update Customer-Specific Data in Purchasing Document
EXIT_SAPMM06E_014 - Read Customer-Specific Data when Importing Purchasing Document
EXIT_SAPMM06E_016 - Export Data to Customer Subscreen for Purchasing Document Item (PBO)
EXIT_SAPMM06E_017 - Export Data to Customer Subscreen for Purchasing Document Item (PAI)
EXIT_SAPMM06E_018 - Import Data from Customer Subscreen for Purchasing Document Item
EXIT_SAPMM06E_020 - User Exit: Change Document for Requisitions (Conversion into PO)
EXIT_SAPMM06E_021 - Fulfillment of Target Value: Release Orders Against a Contract
<b>Reward points</b>
Regards -
To Record J1IS BDC For Multiple Line Items
Hi,
Iam trying to record BDC for J1IS transaction.
while recording material document which contains more than 8 line items , Only 8 line items get saved and the rest of the items doesn't get saved ,
But when I do this manually then all the line items get saved,
Can anyone give the remedy for this Problem (to record J1IS for multiple line items).
Thanks in Advance.
Regards,
S.Janani.Hi Janani / Leo
The problem might be that the scroll down functionality after 8 line items is not recorded in your recording.
In order to overcome the issue, you need to check OK__CODE whicle page down and add it in recording after Number of line items are greater than 8.
Please check below link for details:
http://scn.sap.com/thread/1106677
http://scn.sap.com/thread/797827
http://scn.sap.com/thread/2037271
Best Regards,
Sachin -
BDC for multiple line items (VA01)
Hi Experts,
I create a BDC for VA01 transaction for single line item in that now i want to upload multiple line items also with o/p of total no. of records uploaded, no. of records posted and the no. of error records...
Can any body explain with sample code...Hi,
if the flat file is containing header and item records...
first split those records tooo two internal tables header and item..
Loop at header ...
process of recording steps for header....
Loop at item...
here create a varialbe with char 2 .. for index value....
process of item recording steps..
increment the index value by 1....
here u have to pass 'p+' OK_CODE..
Endloop ..(item)
Endloop...(header)
for more info goo through this link...
http://www.sap-img.com/bdc.htm
hope helpful
Raghunath.S -
"BDC for multiple line items of PO"
I am using this code to move data for multiple line items of a PO. But only one is getting transferred. I am using BDC for this.
FORM transaction_bdc .
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_correct TYPE i,
v_file TYPE string.
DATA: ls_outtab TYPE tb_struc.
DATA: l_valid TYPE c,
l_locked TYPE c.
CALL METHOD g_grid->check_changed_data
IMPORTING
e_valid = l_valid.
IF l_valid EQ 'X'.
LOOP AT tb_output WHERE check EQ 'X' .
MOVE-CORRESPONDING tb_output TO itab_output.
APPEND itab_output.
CLEAR itab_output.
ENDLOOP.
IF tb_output-check <> 'X'.
MESSAGE e003 WITH text-004.
ENDIF.
ENDIF.
IF itab_output[] IS NOT INITIAL.
PERFORM open_group.
***looping at purchase order level.
LOOP AT itab_output where ebelp is not initial .
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'
itab_output-ebeln.
***Changing alphanumeric fields and quantity fields to character type**
*v_ebelp = tB_OUTPUT-ebelp.
*clear v_ebelpt.
*v_menge1 = tB_OUTPUT-menge.
*v_ebelpt = v_ebelp.
***End Of Changing**
*Checking for the exact number of the item**
LOOP AT tb_output where ebeln = itab_output-ebeln.
READ TABLE itab_output INDEX 1.
IF tb_output-ebelp = itab_output-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 =
itab_output-ebelp AND ebeln = itab_output-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
itab_output-ebtyp.
PERFORM bdc_field USING v_eeind
itab_output-eindt.
PERFORM bdc_field USING v_menge
v_menge1.
PERFORM bdc_field USING v_xblnr
itab_output-xblnr.
**End Of Mappings**
*loop at itab_output.
MOVE-CORRESPONDING itab_output TO ekes.
modify ekes.
MOVE-CORRESPONDING itab_output TO eket.
MODIFY eket.
MOVE-CORRESPONDING tb_output TO ekpo.
MODIFY ekpo.
ENDLOOP.
CALL TRANSACTION 'ME22N'
USING itbdc
MODE 'E'.
commit work.
perform bdc_transaction using 'ME22N'.
**End Of Purchase Order Loop**
PERFORM close_group.
endloop.
endif.Hi Asha,
check the below code once...
LOOP AT tb_output where ebeln = itab_output-ebeln.
READ TABLE itab_output INDEX 1.
IF tb_output-ebelp = itab_output-ebelp.
exit.
ELSE.
v_bn = v_bn + 1.
ENDIF.
ENDLOOP.
Here you are reading the table itab_output with index 1, it means you alway reading the first record of that internal table.
Regards,
Satya.
Maybe you are looking for
-
Weird Error Message (AroundMe...)
I installed AroundMe few weeks back in my iPhone and uninstalled it afterwards... Everything seemed fine except two weeks ago a message started to appear every time I try to install an application. The message read something like "AroundMe and 1 anot
-
INSTALLMENT PAYMENTS FROM CUSTOMERS
hi, can any body help me in the following scnario. 1)the customer has to pay 25%(as down payment) of total invoice amount with in 15 days from the date of purchase order 2) 15% of amount with in 30 days(1st insatallment) 3)30% of amount with in 45 da
-
i was planning on burning some pictures onto a cd but when i put the cd in it didnt show up and i dont know how to get it out now. please help me out here. thank you. if you could email any answers you have to [email protected] if not just post them
-
Events entered in iPad calendar not in iPhone cal
Events entered in iPad calendar not in iPhone cal
-
Smart Script Player Applet (Player Only) Problem ...
Hi all! We are trying to make our SmartScript opens automatically when a user navigates to a particular view. We followed the following steps: * Using Siebel tools: 1) Create a new view. 2) Add "Smart Script Player Applet (Player Only)" to it. 3) Add