BDC with KB15N transaction
Hi All,
I have done Recoerding for KB15N Transaction for a BDC Program.
When i run the BDC in ALL screen mode using CALL TRANSACTION, the first filed in the Transaction 'Controlling Area' will not get the data from the BDCDATA table.
While recording the data will be entered correctly and even the PERFORM statement of recorded code will have the controlling value.
Inspte of this, the field in the transaction will nt get the required data.
What may be the reason and how to resolve this issue?
Your help will be appreciated...
Regards
Pavan
CLEAR statement was deleted from one of the PERFORM. Thanks,
Similar Messages
-
BDC with call transaction VD02 works fin in A mode but not in N mode
Hi All,
I have BDC program developed in 4.6c using call transaction VD02 works fine with mode A but not with mode N.
Now we upgraded to ECC 6.0.Do I need to change anything?No, you don't have to change anything for ECC. BTW, I wonder why VD02 is not working in the background for you?
-
Can we use BAPI in place of BDC for the transaction KB15N?
Hi,
I have a requirement where in i need to upload an excel sheet using KB15N (transaction for MANUAL COST ALLOCATION).
I have found an bapi BAPI_ACC_MANUAL_ALLOC_POST. Does this bapi serve my purpose completely.
Thanks and Regards,
GathamHi,
The bapi <b>BAPI_ACC_MANUAL_ALLOC_POST</b> is for Accounting: Post Manual Cost Allocation.
This is the correct BAPI, you can use this one, for more information, you can read the documentation of this BAPI
Regards
Sudheer -
Can anybody pls tell me limitations of BDC Session & Call transaction?
hi, Guys, this is srinivas.
How can we deside which method is to(BDC session/ Call transaction)
use to upload data to SAP database?
Can we run Call Transaction in Background?
Which is preferable for bulk data? and Why?
how can we restart Session if any error occurs?
Thanku?Hi,
Hope it helps this......
SAP BDC INTERVIEW QUESTIONS & ANSWERS
1. What is full form of BDC Session?
Batch Data Communication Session.
2. What are the steps in a BDC session?
The first step in a BDC session is to identify the screens of the transaction that the program will process. Next step is to write a program to build the BDC table that will be used to submit the data to SAP. The final step is to submit the BDC table to the system in the batch mode or as a single transaction by the CALL TRANSACTION command.
3. How do you find the information on the current screen?
The information on the current screen can be found by SYSTEM à STATUS command from any menu.
4. How do you save data in BDC tables?
The data in BDC tables is saved by using the field name BDC_OKCODE and field value of /11.
5. What is the last entry in all BDC tables?
In all BDC tables the last entry is to save the data by using the field name BDC_OKCODE and a field value of /11.
6. What is a multiple line field?
A multiple line field is a special kind of field which allows the user to enter multiple lines of data into it.
7. How do you populate data into a multiple line field?
To populate data into a multiple line field, an index is added to the field name to indicate which line is to be populated by the BDC session (Line index).
8. Write the BDC table structure.
BDC table structure
FIELD TYPE DESCRIPTION
Program CHAR (8) Program name of transaction.
DynPro CHAR (4) Screen number of transaction.
DynBegin CHAR (1) Indicator for new screen.
Fnam CHAR (35) Name of database field from screen.
Fval CHAR (80) Value to submit to field.
9. Does the CALL TRANSACTION method allow multiple transactions to be processed by SAP?
No. The CALL TRANSACTION method allows only a single transaction to be processed by SAP.
10. Does the BDC-INSERT function allow multiple transactions to be processed by SAP?
Yes.
11. What is the syntax for CALL TRANSACTION?
CALL TRANSACTION trans .
Three possible entries are there for MODE.
A - Show all screens.
E - Show only screens with errors.
N - Show no screens.
Regards,
V.Balaji
Reward if usefull -
HELLO
I HAVE CREATED A BDC WITH ME51,I AM FACING A PROBLEM WITH IT.IN THE ITEM DATA THE SECOND RECORD IS GETTING OVERWRITTEN BY THE 3RD RECORD DATA.PLEASE GIVE ME A SOLUTION.THE CODE GOES AS BELOW..........TELL ME WHERE I AM GOING WRONG.
REPORT Z_BDC_ME51_CALLTRANSACTION NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES: EBAN,RM06B.
*include bdcrecx1.
DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
DATA : BEGIN OF T_UPLOAD OCCURS 0 ,
BSART LIKE EBAN-BSART ,
EEIND LIKE RM06B-EEIND ,
LPEIN LIKE RM06B-LPEIN ,
WERKS LIKE EBAN-WERKS ,
LGORT LIKE EBAN-LGORT ,
EKGRP LIKE EBAN-EKGRP ,
MATKL LIKE EBAN-MATKL ,
MATNR LIKE EBAN-MATNR ,
MENGE(10) ,
END OF T_UPLOAD .
DATA : BEGIN OF T_HEADER OCCURS 0 ,
BSART LIKE EBAN-BSART ,
EEIND LIKE RM06B-EEIND ,
LPEIN LIKE RM06B-LPEIN ,
WERKS LIKE EBAN-WERKS ,
LGORT LIKE EBAN-LGORT ,
EKGRP LIKE EBAN-EKGRP ,
MATKL LIKE EBAN-MATKL ,
END OF T_HEADER ,
BEGIN OF T_ITEM OCCURS 0 ,
BSART LIKE EBAN-BSART ,
MATNR LIKE EBAN-MATNR ,
MENGE(10) ,
END OF T_ITEM ,
V1 TYPE SY-TABIX .
DATA : P_FLNAME LIKE RLGRAP-FILENAME VALUE 'D:\TEST_ME51.TXT' .
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'D:\TEST_ME51.txt'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = T_UPLOAD
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
DATA : V_BSART LIKE EBAN-BSART .
LOOP AT T_UPLOAD.
MOVE :
T_UPLOAD-BSART TO T_HEADER-BSART,
T_UPLOAD-EEIND TO T_HEADER-EEIND,
T_UPLOAD-LPEIN TO T_HEADER-LPEIN,
T_UPLOAD-WERKS TO T_HEADER-WERKS,
T_UPLOAD-LGORT TO T_HEADER-LGORT,
T_UPLOAD-EKGRP TO T_HEADER-EKGRP,
T_UPLOAD-MATKL TO T_HEADER-MATKL.
APPEND T_HEADER.
V_BSART = T_UPLOAD-BSART.
LOOP AT T_UPLOAD WHERE BSART = V_BSART.
MOVE :
T_UPLOAD-BSART TO T_ITEM-BSART ,
T_UPLOAD-MENGE TO T_ITEM-MENGE,
T_UPLOAD-MATNR TO T_ITEM-MATNR.
APPEND T_ITEM.
DELETE T_UPLOAD.
ENDLOOP.
ENDLOOP.
LOOP AT T_HEADER .
CLEAR T_BDCDATA .
REFRESH T_BDCDATA .
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0100'.
*PERFORM BDC_FIELD USING 'BDC_CURSOR' 'RM06B-EEIND'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_FIELD USING 'EBAN-BSART' T_HEADER-BSART.
PERFORM BDC_FIELD USING 'RM06B-EEIND' T_HEADER-EEIND.
PERFORM BDC_FIELD USING 'RM06B-LPEIN' T_HEADER-LPEIN.
PERFORM BDC_FIELD USING 'EBAN-WERKS' T_HEADER-WERKS.
PERFORM BDC_FIELD USING 'EBAN-LGORT' T_HEADER-LGORT.
PERFORM BDC_FIELD USING 'EBAN-EKGRP' T_HEADER-EKGRP.
PERFORM BDC_FIELD USING 'EBAN-MATKL' T_HEADER-MATKL.
*PERFORM BDC_FIELD USING 'BDC_CURSOR' 'EBAN-MENGE(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
LOOP AT T_ITEM WHERE BSART EQ T_HEADER-BSART .
IF SY-TABIX EQ 1.
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0106'.
PERFORM BDC_FIELD USING 'EBAN-MATNR(01)' T_ITEM-MATNR.
PERFORM BDC_FIELD USING 'EBAN-TXZ01(01)' ''.
PERFORM BDC_FIELD USING 'EBAN-MENGE(01)' T_ITEM-MENGE.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0102'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0106'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
ELSE .
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0106'.
PERFORM BDC_FIELD USING 'EBAN-MATNR(02)' T_ITEM-MATNR.
PERFORM BDC_FIELD USING 'EBAN-TXZ01(01)' ''.
PERFORM BDC_FIELD USING 'EBAN-MENGE(02)' T_ITEM-MENGE.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0102'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_DYNPRO USING 'SAPMM06B' '0106'.
PERFORM BDC_FIELD USING 'EBAN-MA
ENDIF .
ENDLOOP .
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=BU'.
*PERFORM BDC_FIELD USING 'RM06B-BNFPO' '10'.
CALL TRANSACTION 'ME51' USING T_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO MESSTAB.
ENDLOOP .
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR T_BDCDATA.
T_BDCDATA-PROGRAM = PROGRAM.
T_BDCDATA-DYNPRO = DYNPRO.
T_BDCDATA-DYNBEGIN = 'X'.
APPEND T_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR T_BDCDATA.
T_BDCDATA-FNAM = FNAM.
T_BDCDATA-FVAL = FVAL.
APPEND T_BDCDATA.
ENDIF.
ENDFORM.
I AM USING BSART,EEIND,LPEIN, WERKS,LGORT,EKGRP,MATKL,MATNR,MENGE IN THE FLAT FILE.The number in the brackets indicate the number of the line item, right?
So, if you are not incrementing that number, you are always overwriting your 2nd line item with the next line item.
So, as the loop goes, you should increment that number also so that when the BDC runs the materials are attached to different line numbers.
Outside the loop
DATA : counter(2) type n value '01'.
Inside the loop
counter = counter + 1.
concatenate 'EBAN-MATNR(' counter ')' into fieldmatnr.
PERFORM BDC_FIELD USING fieldmatnr = T_ITEM-MATNR.
concatenate 'EBAN-MENGE(' counter ')' into fieldmenge.
PERFORM BDC_FIELD USING fieldmenge T_ITEM-MENGE.
The above changes should solve your problem.
Regards,
Ravi
Note - Pleas emark all the helpful answes
Message was edited by:
Ravikumar Allampallam
Message was edited by:
Ravikumar Allampallam -
Hi all,
Can anyone of you provide me complete BDC code for Transaction XD01.
An early reply will be highly appreciated and would be rewarded.
Regards,
NeerajHi Prakash
hope this code will help you.
ABAP BDC SAMPLE CODE XD01
Table/Structure declarations. *
TABLES : KNA1. "Customer master
Constants declarations. *
CONSTANTS : C_MODE VALUE 'A',
C_UPDATE VALUE 'S',
C_X VALUE 'X',
C_SESS TYPE APQI-GROUPID VALUE 'ZCUSTOMER', "Session Name
C_XD01 LIKE TSTC-TCODE VALUE 'XD01'.
Variable declarations. *
DATA : V_FNAME(15) VALUE SPACE, " Name of file to be created
V_FAILREC TYPE I, " No of failed records
V_MSG(255), " Message Text
V_ERRREC TYPE I, " No of failed records
V_LINES TYPE I, " No of records
V_BANKS(15), " Table column BANKS
V_BANKL(15), " Table column BANKL
V_BANKN(15), " Table column BANKN
V_TIDX(2) TYPE N. " Table row index
*-- FLAG DECLARATIONS
DATA : FG_DATA_EXIST VALUE 'X', " Check for data
FG_SESSION_OPEN VALUE ' '. " Check for Session Open
*-- MACRO DEFINITIONS
*-- Macro for BANKS
DEFINE BANKS.
CLEAR V_BANKS.
CONCATENATE 'KNBK-BANKS(' &1 ')' INTO V_BANKS.
CONDENSE V_BANKS.
END-OF-DEFINITION.
*-- Macro for BANKL
DEFINE BANKL.
CLEAR V_BANKL.
CONCATENATE 'KNBK-BANKL(' &1 ')' INTO V_BANKL.
CONDENSE V_BANKL.
END-OF-DEFINITION.
*-- Macro for BANKN
DEFINE BANKN.
CLEAR V_BANKN.
CONCATENATE 'KNBK-BANKN(' &1 ')' INTO V_BANKN.
CONDENSE V_BANKN.
END-OF-DEFINITION.
Structures / Internal table declarations *
*-- Structure to hold BDC data
TYPES : BEGIN OF T_BDCTABLE.
INCLUDE STRUCTURE BDCDATA.
TYPES END OF T_BDCTABLE.
*-- Structure to trap BDC messages
TYPES : BEGIN OF T_MSG.
INCLUDE STRUCTURE BDCMSGCOLL.
TYPES : END OF T_MSG.
*-- Structure to trap ERROR messages
TYPES : BEGIN OF T_ERR_MSG,
MESSAGE(255),
END OF T_ERR_MSG.
*--Internal table to store flat file data
DATA : BEGIN OF IT_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
KTOKD LIKE T077D-KTOKD,
NAME1 LIKE KNA1-NAME1,
SORTL LIKE KNA1-SORTL,
ORT01 LIKE KNA1-ORT01,
PSTLZ LIKE KNA1-PSTLZ,
LAND1 LIKE KNA1-LAND1,
SPRAS LIKE KNA1-SPRAS,
LZONE LIKE KNA1-LZONE,
END OF IT_KNA1.
*--Internal table to store bank details
DATA : BEGIN OF IT_BANK OCCURS 0,
BANKS LIKE KNBK-BANKS,
BANKL LIKE KNBK-BANKL,
BANKN LIKE KNBK-BANKN,
END OF IT_BANK.
*-- Internal table to hold BDC data
DATA: IT_BDCDATA TYPE STANDARD TABLE OF T_BDCTABLE WITH HEADER LINE,
*-- Internal Table to store ALL messages
IT_MSG TYPE STANDARD TABLE OF T_MSG WITH HEADER LINE,
*-- Internal Table to store error messages
IT_ERR_MSG TYPE STANDARD TABLE OF T_ERR_MSG WITH HEADER LINE.
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FLNAME(15) OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R_LIST RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003.
PARAMETERS : R_SESS RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 30(20) TEXT-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Event:Initialization *
INITIALIZATION.
AT Selection Screen. *
AT SELECTION-SCREEN.
Event: Start-of-Selection *
START-OF-SELECTION.
V_FNAME = P_FLNAME.
PERFORM GET_DATA.
PERFORM GET_BANKDATA.
PERFORM GENERATE_DATASET.
Event: End-of-Selection *
END-OF-SELECTION.
IF FG_DATA_EXIST = ' '.
MESSAGE I010 WITH TEXT-009.
EXIT.
ENDIF.
PERFORM GENERATE_BDCDATA.
PERFORM DISPLAY_ERR_RECS.
Event: top-of-page
TOP-OF-PAGE.
FORM DEFINITIONS *
*& Form get_data
Subroutine to get the data from mard
--> p1 text
<-- p2 text
FORM GET_DATA.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\XD01.TXT'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = IT_KNA1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF IT_KNA1[] IS INITIAL.
FG_DATA_EXIST = ' '.
ENDIF.
ENDFORM. " get_data
*& Form GENERATE_DATASET
text
--> p1 text
<-- p2 text
FORM GENERATE_DATASET.
MESSAGE I010 WITH 'OPENING FILE IN APPLICATION SERVER'.
**--Creating a data set in application server
OPEN DATASET V_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
**---Transfering data from internal table to dataset
MESSAGE I010 WITH 'TRANSFERING DATA FROM INETERAL TABLE TO THE FILE'.
LOOP AT IT_KNA1.
TRANSFER IT_KNA1 TO V_FNAME.
ENDLOOP.
**--Closing the dataset
MESSAGE I010 WITH 'CLOSING THE FILE'.
CLOSE DATASET V_FNAME.
ENDFORM. " GENERATE_DATASET
*& Form BDC_DYNPRO
text
-->P_0467 text
-->P_0468 text
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
*& Form BDC_FIELD
text
-->P_0472 text
-->P_0473 text
FORM BDC_FIELD USING FNAM FVAL.
IF NOT FVAL IS INITIAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDIF.
ENDFORM.
*& Form GENERATE_BDCDATA
text
--> p1 text
<-- p2 text
FORM GENERATE_BDCDATA.
REFRESH IT_KNA1.
Opening dataset for reading
OPEN DATASET V_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
Reading the file from application server
DO.
CLEAR: IT_KNA1,IT_BDCDATA.
REFRESH IT_BDCDATA.
READ DATASET V_FNAME INTO IT_KNA1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
Populate BDC Data for Initial Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0100',
BDC_FIELD USING 'BDC_CURSOR' 'RF02D-KUNNR',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'RF02D-KUNNR' IT_KNA1-KUNNR,
BDC_FIELD USING 'RF02D-KTOKD' IT_KNA1-KTOKD.
Populate BDC Data for Second Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0110',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NAME1',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-NAME1' IT_KNA1-NAME1,
BDC_FIELD USING 'KNA1-SORTL' IT_KNA1-SORTL,
BDC_FIELD USING 'KNA1-ORT01' IT_KNA1-ORT01,
BDC_FIELD USING 'KNA1-PSTLZ' IT_KNA1-PSTLZ,
BDC_FIELD USING 'KNA1-LAND1' IT_KNA1-LAND1,
BDC_FIELD USING 'KNA1-SPRAS' IT_KNA1-SPRAS.
Populate BDC Data for Third Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0120',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-LZONE',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-LZONE' IT_KNA1-LZONE.
Populate BDC Data for Fourth Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0125',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NIELS',
BDC_FIELD USING 'BDC_OKCODE' '/00'.
Populate BDC Data for Table control for bank details.
V_TIDX = '01'.
LOOP AT IT_BANK.
BANKS V_TIDX.
BANKL V_TIDX.
BANKN V_TIDX.
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',
BDC_FIELD USING 'BDC_CURSOR' V_BANKN,
BDC_FIELD USING 'BDC_OKCODE' '=ENTR',
BDC_FIELD USING V_BANKS IT_BANK-BANKS,
BDC_FIELD USING V_BANKL IT_BANK-BANKL,
BDC_FIELD USING V_BANKN IT_BANK-BANKN.
V_TIDX = V_TIDX + 1.
ENDLOOP.
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',
BDC_FIELD USING 'BDC_CURSOR' V_BANKS,
BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.
CALL TRANSACTION C_XD01 USING IT_BDCDATA
MODE C_MODE
UPDATE C_UPDATE
MESSAGES INTO IT_MSG.
IF SY-SUBRC <> 0.
*--In case of error list display
IF R_LIST = C_X.
V_ERRREC = V_ERRREC + 1.
PERFORM FORMAT_MESSAGE.
IT_ERR_MSG-MESSAGE = V_MSG.
APPEND IT_ERR_MSG.
CLEAR : V_MSG,IT_ERR_MSG.
ENDIF.
*--In case of session log
IF R_SESS = C_X.
*-- In case of transaction fails.
IF FG_SESSION_OPEN = ' '.
FG_SESSION_OPEN = C_X.
PERFORM BDC_OPEN_GROUP.
ENDIF. " IF FG_SESSION_OPEN = ' '.
*-- Insert BDC Data..
PERFORM BDC_INSERT_DATA.
ENDIF. " IF R_SESS = C_X.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF SY-SUBRC <> 0.
ENDDO.
Closing the dataset
CLOSE DATASET V_FNAME.
*-- Close the session if opened
IF FG_SESSION_OPEN = C_X.
PERFORM BDC_CLOSE_GROUP.
CALL TRANSACTION 'SM35'.
ENDIF.
ENDFORM. " GENERATE_BDCDATA
*& Form BDC_OPEN_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_OPEN_GROUP.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = C_SESS
HOLDDATE = FILLER8
KEEP = C_X
USER = SY-UNAME
RECORD = FILLER1
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
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. " BDC_OPEN_GROUP
*& Form BDC_INSERT_DATA
text
--> p1 text
<-- p2 text
FORM BDC_INSERT_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = C_XD01
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " BDC_INSERT_DATA
*& Form BDC_CLOSE_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_CLOSE_GROUP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
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. " BDC_CLOSE_GROUP
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE.
CLEAR V_LINES.
DESCRIBE TABLE IT_MSG LINES V_LINES.
READ TABLE IT_MSG INDEX V_LINES.
CLEAR V_MSG.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MSG-MSGID
LANG = IT_MSG-MSGSPRA
NO = IT_MSG-MSGNR
V1 = IT_MSG-MSGV1
V2 = IT_MSG-MSGV2
V3 = IT_MSG-MSGV3
V4 = IT_MSG-MSGV4
IMPORTING
MSG = V_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.
ENDIF.
ENDFORM. " FORMAT_MESSAGE
*& Form DISPLAY_ERR_RECS
text
--> p1 text
<-- p2 text
FORM DISPLAY_ERR_RECS.
LOOP AT IT_ERR_MSG.
WRITE: / IT_ERR_MSG-MESSAGE.
ENDLOOP.
ENDFORM. " DISPLAY_ERR_RECS
*& Form GET_BANKDATA
text
--> p1 text
<-- p2 text
FORM GET_BANKDATA.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = '1000'.
IT_BANK-BANKN = 'S.B A/C'.
APPEND IT_BANK.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = 'CITY'.
IT_BANK-BANKN = 'CURR. A/C'.
APPEND IT_BANK.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = 'H001'.
IT_BANK-BANKN = 'S.B A/C'.
APPEND IT_BANK.
reward if help. -
Dear All .
can you give me some idea how to do BDC with tbale Control . Any documentation on the same or some simple example .Handling Table Control in BDC
An example abap program of handling Table Control during bdc programming.
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 -
Need to write BDC program for Transaction VA01(Sales order creation)
Dear Friends,
I need to write a BDC program for uploading data into sap from an excel sheet file. The data contain Material Description,Customer Name,Date of Delivery,Quantity,Unit of measure etc.
material desc customer date of delivery quantity unit of measure
abcdf xyz ltd 24.12.2011 2 4 gm
The transaction is VA01.How will I find the correct fields and related tables? What are the related fields needed in the transaction VA01.
Thanking you
Sacheen Pukhrambam
Moderator Message: Put some self-effort before posting your question. Thread locked.
Edited by: Suhas Saha on Nov 25, 2011 1:25 PMHello,
You could try using a BDC with VL04 but first preference would be to see if there are any BAPI functions (search for BAPI) that can do this.
If BUS2032 doesn't have an attribute that you want (eg shipping point) then sub-delegate to ZBUS2032 and add the attribute, it's straightforward. You just have to know how to determine the value programmatically.
regards
Rick Bakker
hanabi technology -
.can anybody explain the bdc with help of an example
i am new to bdc .can anybody explain the bdc with help of an example
Hi,
BDC is method to transfer legacy data into R3 system.
Data transfer can be done in any one method below:
BDC
LSMW
Direct Input method
BAPI
Of these BDC is subdivided into 2 types,
Call Transaction and Session method (TCode: SM35)
Let me give the sample prg for Call Transaction method.
tables ZMATMASTER.
DATA : itab like TABLE OF ZMATMASTER WITH KEY DESCRIPTION with header line.
DATA : IT_BDC LIKE TABLE OF BDCDATA WITH HEADER LINE.
DATA : IT_MSG LIKE TABLE OF BDCMSGCOLL WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Material.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '#'
TABLES
DATA_TAB = itab.
LOOP AT ITAB.
PERFORM BDC_HEADER USING 'ZFILE_DOWNLOAD' 9001.
PERFORM BDC_DATA USING 'BDC_OKCODE' 'SAVE'.
PERFORM BDC_DATA USING 'ZMATMASTER-MNO' ITAB-MNO.
PERFORM BDC_DATA USING 'ZMATMASTER-DESCRIPTION' ITAB-DESCRIPTION.
PERFORM BDC_DATA USING 'ZMATMASTER-PLANT' ITAB-PLANT.
PERFORM BDC_DATA USING 'ZMATMASTER-SLOC' ITAB-SLOC.
PERFORM BDC_DATA USING 'ZMATMASTER-ROL' ITAB-ROL.
PERFORM BDC_DATA USING 'ZMATMASTER-UOM' ITAB-UOM.
PERFORM BDC_DATA USING 'ZMATMASTER-PRICE' ITAB-PRICE.
PERFORM BDC_DATA USING 'ZMATMASTER-DDAYS' ITAB-DDAYS.
PERFORM BDC_DATA USING 'ZMATMASTER-FLOT' ITAB-FLOT.
ENDLOOP.
CALL TRANSACTION 'ZTRANSCODES'
USING IT_BDC
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_MSG.
FORM BDC_HEADER USING PROGRAMNAME SCREENNO.
IT_BDC-PROGRAM = PROGRAMNAME.
IT_BDC-DYNPRO = SCREENNO.
IT_BDC-DYNBEGIN = 'X'.
APPEND IT_BDC.
ENDFORM.
FORM BDC_DATA USING FNAME FVALUE.
CLEAR IT_BDC.
IT_BDC-FNAM = FNAME.
IT_BDC-FVAL = FVALUE.
APPEND IT_BDC.
ENDFORM.
In session method, log file can be viewed.
Foll. is the example for session method.
REPORT ZBDC_BATCH1 .
TABLES: ZEMPREC.
DATA : BEGIN OF STR1,
EMPNO(3),
EMPNAME(15),
SALARY(9),
DOJ(10),
END OF STR1.
DATA: FNAME(100) TYPE C VALUE 'C:\EMPLOYEE.TXT.,
DATA : BDCITAB LIKE TABLE OF BDCDATA WITH HEADER LINE,
MSGITAB LIKE TABLE OF BDCMSGCOLL WITH HEADER LINE.
OPEN DATASET: FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
perform open_group.
DO .
READ DATASET FNAME INTO STR1.
IF SY-SUBRC <> 0 .
EXIT.
ENDIF.
perform bdc_dynpro using 'ZBDC_BATCH' '9000'.
perform bdc_field using 'ZEMPREC-EMPNO'
STR1-EMPNO.
perform bdc_field using 'ZEMPREC-EMPNAME'
STR1-EMPNAME.
perform bdc_field using 'ZEMPREC-SALARY'
STR1-SALARY.
perform bdc_field using 'ZEMPREC-DOJ'
STR1-DOJ.
ENDDO.
CLOSE DATASET FNAME.
perform bdc_transaction using 'ZTCODE'.
perform close_group.
CLOSE DATASET FNAME1.
CALL TRANSACTION 'SM35'.
FORM open_group
FORM open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'sample'
HOLDDATE = SY-DATUM
KEEP = 'X'
USER = SY-UNAME.
ENDFORM. "open_group
FORM bdc_transaction
--> TCODE
form bdc_transaction USING TCODE.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'ZTCODE'
TABLES
DYNPROTAB = BDCITAB.
ENDFORM. "bdc_transaction
FORM close_group
FORM close_group.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDFORM. "close_group
FORM BDC_DYNPRO
--> PROGRAM
--> SCREEN
FORM BDC_DYNPRO USING PROGRAM SCREEN.
CLEAR BDCITAB.
BDCITAB-PROGRAM = PROGRAM.
BDCITAB-DYNPRO = SCREEN.
BDCITAB-DYNBEGIN = 'X'.
APPEND BDCITAB.
ENDFORM. "BDC_DYNPRO
FORM BDC_FIELD
--> FNAM
--> FVAL
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCITAB.
BDCITAB-FNAM = FNAM.
BDCITAB-FVAL = FVAL.
APPEND BDCITAB.
ENDFORM. "BDC_FIELD
Hope now u get an idea abt BDC.
Regards,
Router -
How to create bdc with table control
hi all.
please some body tell me how to create bdc with table control
or suggest any www with screen shots
thanks in advance ,
aparnaHi AParna,
Its very Simple.
ALl you have to do is set up a counter based on the number of lines in the tabke. when the counter reaches the number of lines in the table hit the next page button which is at the top of every screen in SAP.
Please refer to the following BDC program I had developed using Table control,
this is for ME01 transaction.
LOOP AT T_EORD_HED.
SELECT SINGLE * FROM MARA WHERE MATNR = T_EORD_HED-MATNR.
IF SY-SUBRC = 0.
PERFORM BDC_DYNPRO USING 'SAPLMEOR' '0200'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EORD-MATNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'EORD-MATNR'
T_EORD_HED-MATNR. "'58335'.
PERFORM BDC_FIELD USING 'EORD-WERKS'
T_EORD_HED-WERKS. "'0253'.
L_COUNT = 1.
LOOP AT T_EORD WHERE MATNR = T_EORD_HED-MATNR
AND WERKS = T_EORD_HED-WERKS.
SELECT SINGLE * FROM LFA1 WHERE LIFNR = T_EORD-LIFNR.
IF SY-SUBRC = 0.
* Look into the if condition below
IF L_COUNT = 010.
L_COUNT = 1.
PERFORM BDC_DYNPRO USING 'SAPLMEOR' '0205'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EORD-MATNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NS'.
L_COUNT = L_COUNT + 1.
ENDIF.
PERFORM BDC_DYNPRO USING 'SAPLMEOR' '0205'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EORD-AUTET(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
CONCATENATE 'EORD-VDATU' '(' L_COUNT ')' INTO OPR_FIELD.
WRITE SY-DATUM TO T_EORD-VDATU.
PERFORM BDC_FIELD USING OPR_FIELD
T_EORD-VDATU.
CONCATENATE 'EORD-BDATU' '(' L_COUNT ')' INTO OPR_FIELD.
WRITE T_EORD-BDATU TO V_BDATU.
PERFORM BDC_FIELD USING OPR_FIELD
V_BDATU.
CONCATENATE 'EORD-LIFNR' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
T_EORD-LIFNR.
CONCATENATE 'EORD-EKORG' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
'0001'.
CONCATENATE 'EORD-RESWK' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
T_EORD-RESWK.
WRITE T_EORD-MEINS TO V_MEINS.
CONCATENATE 'EORD-MEINS' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
V_MEINS.
* CONCATENATE 'EORD-EBELN' '(' L_COUNT ')' INTO OPR_FIELD.
* PERFORM BDC_FIELD USING 'OPR_FIELD'
* T_EORD-EBELN.
CONCATENATE 'EORD-EBELP' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
T_EORD-EBELP.
IF T_EORD-FLIFN NE SPACE OR T_EORD-FRESW NE SPACE OR
T_EORD-FEBEL NE SPACE.
CONCATENATE 'RM06W-FESKZ' '(' L_COUNT ')' INTO OPR1_FIELD.
PERFORM BDC_FIELD USING OPR1_FIELD
'X'.
ENDIF.
IF T_EORD-NOTKZ <> ''.
CONCATENATE 'EORD-NOTKZ' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
'X'.
ENDIF.
CONCATENATE 'EORD-AUTET' '(' L_COUNT ')' INTO OPR_FIELD.
PERFORM BDC_FIELD USING OPR_FIELD
T_EORD-AUTET.
L_COUNT = L_COUNT + 1.
ENDIF.
ENDLOOP.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'EORD-MATNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
CALL TRANSACTION 'ME01' USING I_BDCDATA
MODE UP_MODE
* optIONS FROM l_opt
MESSAGES INTO I_BDCMSGCOLL.
PERFORM FORMAT_OUTPUT.
ENDIF.
ENDLOOP. -
Can u send me the link which describes me in about bdc with direct method
Can u send me the link which describes me in about bdc with direct method with examples in detail
Hi,
http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm
and
http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf7940e11d295df0000e82de14a/frameset.htm
For BDC:
http://myweb.dal.ca/hchinni/sap/bdc_home.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
http://www.sap-img.com/abap/learning-bdc-programming.htm
http://www.sapdevelopment.co.uk/bdc/bdchome.htm
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
Check these link:
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
http://www.sap-img.com/abap/question-about-bdc-program.htm
http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
http://www.planetsap.com/bdc_main_page.htm
reward if useful
regards,
Anji -
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 -
GL A/C with Detailed Transactions
I have prepare a report which showing the GL A/C with Detailed Transactions.
I need the link about GL tables with PO, AP and AR tables
can anybody help me in this regard
thanks in advance
sadiqPlease Refer to table
gl_import_references
link this table with gl_je_headers and gl_je_lines using je_header_id and line_id
gl_import_references can be linked with subledger tables using gl_sl_link_id
the Link table in Subledger can be identified from gl_sl_link_table
Ex: gl_import_references shall be linked to ap_ae_lines table using gl_sl_link_id
I hope it is helpful
Regards,
Sridhar -
Showing Items with no transactions
I am trying to build a report that will show us items with potentially incorrect item status. Item status (on table itmmas) is either A(ctive) or I(nactive). The report should show all Inactive items which have had at least one transaction in the past 4 weeks AND active items which have had no transactions in that period.
My plan is to join the item master table to the item ledger table (itmldg) which lists all inventory transactions. I can show the inactive items with transactions without a problem.
What I can't figure out is how to show items with Active Status that don't have any transactions. I can't get CR to return a data set which includes ALL records from itmmas but only those from itmldg in the last 4 weeks. I tried this SQL query:
SELECT itmmas.itmiid, itmmas.itmdes, itmmas.itmsts, itmldg.ilgdno, itmldg.ilgdat
FROM {oj itmmas LEFT OUTER JOIN itmldg ON itmmas.itmiid = itmldg.ilgiid}
WHERE (itmldg.ilgdat>={d '2009-09-01'})
When I run this query in MS Query and return the results to Excel, I get single lines for items with no transactions. For these items, the fields from itmldg are NULL. When I run this query in CR, I don't get any data for items with no transactions.
Can anyone think of a way to get this to work?The issue that you have is that the WHERE clause in your SQL statement is only looking at an itmldg table field for a value. This is effectively making your Left Outer Join an Inner Join, because when an itmmas record does not have an itmldg record, the date field will be NULL. You have to add the condition "OR itmldg.ilgdat is null".
If you want to return ONLY the records that the report is interested in (which should have beter performance), change the SQL to
SELECT itmmas.itmiid, itmmas.itmdes, itmmas.itmsts, itmldg.ilgdno, itmldg.ilgdat
FROM {oj itmmas LEFT OUTER JOIN itmldg ON itmmas.itmiid = itmldg.ilgiid}
WHERE ((itmldg.ilgdat>={d '2009-09-01'}) and (itmmas.itmsts = 'I'))
or ((itmldg.ilgdat is null) and (itmmas.itmsts = 'A'))
HTH,
Carl -
Problem in creating a BDC program for transaction cj20n(project sytem)
Hi all,
I am trying to create project,WBS element ,network and activity using a BDC program,
I am able to create to a recording for the transaction cj20n using tcode shdb but when i run the recording it doesnt run properly i am not able to create any thing.
I get error saying that a particular field doesnt exist on the screen.
Is possible to create a BDC program for transaction CJ20N ?
Also is there any other alternative apart from using a BAPI or a function module.
Thanks,
NishantHi,
Check below link for BAPIs of transaction cj20n.
[BAPI for cj20n|BAPI for CJ20N transaction]
Thanks,
Asit Purbey.
Maybe you are looking for
-
How to set the Data types of the Excel sheet while exporting details to it.
Hi All, We are trying to export some order details to the excel sheet from a jsp. It is working fine when the local system language is set to English. But when i change it to Russian. the details like Line Numbers(e.g: 1.1, 1.2, 1.3 and so on... ) ar
-
S510p s59-383309 extremely dim, dark video quality of integerate​d webcam
please help, got this new laptop just 2 days before, the quality of the laptop is pathetic ! the drivers do not properly get install, when i click the setup, the setup starts, it extracts the files, but after granting the admin permission, the the
-
PSE 8 dialogue/value windows appear BLACK by default.
Hi, I'm a forum newbie, runningPSE 8 on an iMac. Is there a way to change the default dialogue / value windows to white or transparent, please? I'm also seeking a plug in to enable Channel manipulation in PSE. Many degraded graphics arise from pr
-
This is my first mac - I still would like to use my HP Laserjet 2100. It says it cannot find printer. I've downloaded driver/software from HP for Mac but still no luck. I'm connected to printer with USB. On a try or two it seemed to print but all tha
-
Script Execution failed (the build step failed)
Hi folks, i have a problem with the quick migration at oracle sql developer 1.2.1 . The build step failed after the Generate step. In Step 4 (Pre-Migration check) I click on the button Verify. Then there is a failure (Privilege 'Create Role' is not p