01-02-2008 6:47 AM
hi,
what is the use of file uploading in bdc.
i mean that how can i see that my file was updated or not.
or where updation has happend using this files in both
session method and call transaction method.
i hope u can understood my problem.
hoping for good answer.
thanks
01-02-2008 11:35 AM
hi,
bdc stands for batch data communication.
means transfering bunch of data within or from legacy system.
the data of legacy system will come in the form of FLAT file which mean Notepad file.
where file is updating depends on for which requirement you wrote BDC, if i wrote BDC program for VA01. by this program we are going to create sales orders.
in session method, we will have error log. we can open that in SM35 and analyze the reason for failure.
regards,
pavan
01-02-2008 11:35 AM
hi,
bdc stands for batch data communication.
means transfering bunch of data within or from legacy system.
the data of legacy system will come in the form of FLAT file which mean Notepad file.
where file is updating depends on for which requirement you wrote BDC, if i wrote BDC program for VA01. by this program we are going to create sales orders.
in session method, we will have error log. we can open that in SM35 and analyze the reason for failure.
regards,
pavan
01-02-2008 12:42 PM
During upload,you can select the mode of upload viz Background Mode,Error Mode or Diplay Mode .
If you select Display mode then each and every record will be appearing on the screen one by one and you can view if it is getting saved or not.
In case you select Background mode you need to include some coding in your program where you store the no of warnings and errors issued during the upload and print this report once the upload is complete,so that you will get to know whether all your records were uploaded successfully
Reward points if useful
Regards,
Bhavin P Shah
03-29-2010 7:02 AM
Hello sir,
can u please tell me in BDC how to upload excel file's data to sap system with coding .
Thanks and regards
zuhi singh
03-31-2010 12:16 AM
TYPE-POOLS : TRUXS.
TYPES : BEGIN OF TYP_OUT,
PLVAR(2) TYPE C,
OTYPE(2) TYPE C,
SEARK(12) TYPE C,
INFTY(4) TYPE C,
SUBTY(4) TYPE C,
ISTAT(1) TYPE C,
BEGDA(10) TYPE C,
ENDDA(10) TYPE C,
RSIGN(1) TYPE C,
RELAT(3) TYPE C,
SCLAS(2) TYPE C,
SOBID(45) TYPE C,
END OF TYP_OUT.
DATA : TA_PP02 TYPE STANDARD TABLE OF TYP_OUT INITIAL SIZE 0,
WA_PP02 TYPE TYP_OUT.
DATA: TA_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE INITIAL SIZE 0,
WA_EXCEL TYPE ALSMEX_TABLINE.
DATA : RAW_DATA TYPE TRUXS_T_TEXT_DATA.
DATA: TA_BDCDATA TYPE STANDARD TABLE OF BDCDATA ,
WA_BDCDATA TYPE BDCDATA,
TA_BDCMESSAGE TYPE TABLE OF BDCMSGCOLL,
WA_BDCMESSAGE TYPE BDCMSGCOLL.
SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS FILE_N TYPE RLGRAP-FILENAME OBLIGATORY." Path name selected by user with help of Filemngr
SELECTION-SCREEN : END OF BLOCK BLK1 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_N.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
FIELD_NAME = 'FILE_N'
IMPORTING
FILE_NAME = FILE_N.
START-OF-SELECTION.
PERFORM UPLOAD.
PERFORM BDC_OPEN.
PERFORM BDC_SCREENS .
PERFORM BDC_CLOSE.
CALL TRANSACTION 'SM35'.
&----
*& Form UPLOAD
&----
text
----
--> p1 text
<-- p2 text
----
FORM UPLOAD .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
I_TAB_RAW_DATA = RAW_DATA
I_FILENAME = FILE_N
TABLES
I_TAB_CONVERTED_DATA = TA_PP02[]
EXCEPTIONS
CONVERSION_FAILED = 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. " UPLOAD
&----
*& Form BDC_OPEN
&----
text
----
--> p1 text
<-- p2 text
----
FORM BDC_OPEN .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'PP02'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
.
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
&----
*& Form BDC_SCREENS
&----
text
----
--> p1 text
<-- p2 text
----
FORM BDC_SCREENS .
LOOP AT TA_PP02 INTO WA_PP02.
REFRESH TA_BDCDATA.
PERFORM BDC_DYNPRO USING 'SAPMH5A0' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'PPHDR-ENDDA'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'PPHDR-PLVAR'
WA_PP02-PLVAR.
'01'.
PERFORM BDC_FIELD USING 'PPHDR-OTYPE'
WA_PP02-OTYPE.
'S'.
PERFORM BDC_FIELD USING 'PM0D1-SEARK'
WA_PP02-SEARK.
PERFORM BDC_FIELD USING 'PPHDR-INFTY'
WA_PP02-INFTY.
PERFORM BDC_FIELD USING 'PPHDR-SUBTY'
WA_PP02-SUBTY.
PERFORM BDC_FIELD USING 'PPHDR-ISTAT'
WA_PP02-ISTAT.
PERFORM BDC_FIELD USING 'PPHDR-BEGDA'
WA_PP02-BEGDA.
PERFORM BDC_FIELD USING 'PPHDR-ENDDA'
WA_PP02-ENDDA.
PERFORM BDC_DYNPRO USING 'SAPMH5A0' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'PPHDR-PLVAR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=INSE'.
PERFORM BDC_FIELD USING 'PPHDR-PLVAR'
WA_PP02-PLVAR.
PERFORM BDC_FIELD USING 'PPHDR-OTYPE'
WA_PP02-OTYPE.
PERFORM BDC_FIELD USING 'PM0D1-SEARK'
WA_PP02-SEARK.
PERFORM BDC_FIELD USING 'PPHDR-INFTY'
WA_PP02-INFTY.
PERFORM BDC_FIELD USING 'PPHDR-ISTAT'
WA_PP02-ISTAT.
PERFORM BDC_FIELD USING 'PPHDR-BEGDA'
WA_PP02-BEGDA.
PERFORM BDC_FIELD USING 'PPHDR-ENDDA'
WA_PP02-ENDDA.
PERFORM BDC_DYNPRO USING 'MP100100' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P1001-SOBID'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'P1001-BEGDA' WA_PP02-BEGDA.
'01.12.2009'.
PERFORM BDC_FIELD USING 'P1001-ENDDA' WA_PP02-ENDDA.
'31.12.9999'.
PERFORM BDC_FIELD USING 'P1001-RSIGN' WA_PP02-RSIGN.
'A'.
PERFORM BDC_FIELD USING 'P1001-RELAT' WA_PP02-RELAT.
'002'.
PERFORM BDC_FIELD USING 'P1001-SCLAS' WA_PP02-SCLAS.
'S'.
PERFORM BDC_FIELD USING 'P1001-SOBID' WA_PP02-SOBID.
'50001923'.
PERFORM BDC_DYNPRO USING 'MP100100' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P1001-BEGDA'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPD'.
PERFORM BDC_DYNPRO USING 'SAPMH5A0' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'PPHDR-PLVAR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BACK'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'PP02'
TABLES
DYNPROTAB = TA_BDCDATA.
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM BDC_TRANSACTION USING 'PP02'.
ENDLOOP.
PERFORM CLOSE_GROUP.
ENDFORM. " BDC_SCREENS
&----
*& Form BDC_CLOSE
&----
text
----
--> p1 text
<-- p2 text
----
FORM BDC_CLOSE .
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
*&----
*& Form bdc_dynpro
*&----
*
*text
*----
*
*-->P_1269 text
*-->P_1270 text
*----
FORM BDC_DYNPRO USING PROGRAM TYPE SY-REPID
DYNPRO TYPE ANY.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO TA_BDCDATA.
CLEAR WA_BDCDATA.
ENDFORM. " bdc_dynpro
*&----
**& Form bdc_field
*&----
*
*text
*----
*
*-->P_1329 text
*-->P_1330 text
*----
FORM BDC_FIELD USING FNAM TYPE ANY
FVAL TYPE ANY.
IF FVAL NE ''.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO TA_BDCDATA.
CLEAR WA_BDCDATA.
ENDIF.
ENDFORM. " bdc_field