‎2007 Jul 30 7:22 AM
How do you send files to the legacy systems from SAP and vice versa? How does one know that the legacy files have come on to the SAP server you are working on?
‎2007 Jul 30 7:32 AM
hi vamshi,
there are many ways to transfer data from one system to other.
they are called conversion programs and interface programs.
We use BDC for data Uploads from Legacy system to SAP
BDC programs also called as data conversions
we will use other interfaces like
RFC,BAPI, IDOC/ALE/EDI depending on the requirement.
reward points for useful answer.
gud luck.
‎2007 Jul 30 7:24 AM
Hi,
Use GUI_UPLOAD or DOWNLOAD or
For App Server use OPEN_DATASET.
also you can check existance of file using CL_FRONTEND_SERVICES class.
Reward if useful!
‎2007 Jul 30 7:28 AM
Hi
BDC using Call transaction involves calling an SAP transaction in back ground from within the ABAP
program. The process involves building an Internal BDC table containing the screen information needed to
execute the required transaction and then passing this to the Call transaction command
The full procedure for creating a BDC program is as follows:
<b>For a BDC upload you need to write a program which created BDC sessions.</b>
<b><u>Steps:</u></b>
1. Work out the transaction you would use to create the data manually.
2. Use transaction SHDB to record the creation of one material master data.
Click the New recording button or the Menu - Recording - Create
3. Save the recording, and then go back a screen and go to the overview.
4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.
5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:
5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).
5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.
5.3. After perform bdc_transaction, add the endloop.
Execute the program. It will have options to create a batch session or to process directly.
<b>These are all my finds . Might be it will be useful to you.</b>
Direct call of transactions, session handling:
/nxxxx This terminates the current transaction, and starts transaction xxxx
/n This terminates the transaction. This generally corresponds to pressing F15 to go back.
/nend This termiantes all separate sessions and logs off (corresponds to System - Logoff).
/nex This terminates all separate sessions and logs off immediately (without any warning!).
/oxxxx This opens a new session and starts transaction xxxx in This session.
/o This lists existing sessions and allows deletion or opening of a new session.
/i This terminates the current session (corresponds to System End
/i1, /i2,... This terminates the session with the number given.
.xyzw Fast path: 'xyzw' refers to the underlined letters in the menus. This type of navigation is uncommon and is provided more for emergencies (such as a defective mouse).
<u><b>Batch</b></u>
The following commands can be entered in correction mode ('Process in foreground' or 'Display errors only') when processing a batch input session:
/n This terminates the current batch input transaction and characterizes it as
/bdel This deletes the current batch input transaction.
/bend This terminates batch input processing and sets the session to Failed
/bda This switches from Display errors only to Process in foreground
/bde This switches from Process in foreground to Display errors only
<b>ABAP/4</b>
/h This switches into debugging mode.
/hs This switches into debugging mode and activates the debugging of system functions.
<b>Buffer</b>
<b><u>WARNING:</u></b> Resetting buffers can significantly change the performance of the entire system for a long time.
It should therefore only be used where there is a good reason tdso. As of release 3.0B system administator authorization is required (authorization object (S_ADMI_FCD). The action is noted in the system log.
/$SYNC This resets all buffers of the application server
/$CUA This resets the CUA buffer of the application server
/$TAB This resets the TABLE buffers of the application server
/$NAM This resets the nametab buffer of the application server
/$DYNP This resets the screen buffer of the application server
<b>Check this sample report</b>
*-----------------------------------------------------------------------
* Data declaration
TABLES: ekko, ekpo.
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekko-ebeln,
waers TYPE ekko-waers,
netpr TYPE ekpo-netpr,
err_msg(73) TYPE c,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko,
it_error TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_error TYPE t_ekko,
it_success TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_success TYPE t_ekko.
DATA: w_textout LIKE t100-text.
DATA: gd_update TYPE i,
gd_lines TYPE i.
*Used to store BDC data
DATA: BEGIN OF bdc_tab OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdc_tab.
*Used to stores error information from CALL TRANSACTION Function Module
DATA: BEGIN OF messtab OCCURS 0.
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF messtab.
*-----------------------------------------------------------------------
*Screen declaration
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME
TITLE text-001. "Purchase order Num
SELECT-OPTIONS: so_ebeln FOR ekko-ebeln OBLIGATORY.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME
TITLE text-002. "New NETPR value
PARAMETERS: p_newpr(14) TYPE c obligatory. "LIKE ekpo-netpr.
SELECTION-SCREEN END OF BLOCK block2.
************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.
* Retrieve data from Purchase order table(EKKO)
SELECT ekko~ebeln ekko~waers ekpo~netpr
INTO TABLE it_ekko
FROM ekko AS ekko INNER JOIN ekpo AS ekpo
ON ekpo~ebeln EQ ekko~ebeln
WHERE ekko~ebeln IN so_ebeln AND
ekpo~ebelp EQ '10'.
************************************************************************
*END-OF-SELECTION
END-OF-SELECTION.
* Check data has been retrieved ready for processing
DESCRIBE TABLE it_ekko LINES gd_lines.
IF gd_lines LE 0.
* Display message if no data has been retrieved
MESSAGE i003(zp) WITH 'No Records Found'(001).
LEAVE TO SCREEN 0.
ELSE.
* Update Customer master data (instalment text)
LOOP AT it_ekko INTO wa_ekko.
PERFORM bdc_update.
ENDLOOP.
* Display message confirming number of records updated
IF gd_update GT 1.
MESSAGE i003(zp) WITH gd_update 'Records updated'(002).
ELSE.
MESSAGE i003(zp) WITH gd_update 'Record updated'(003).
ENDIF.
* Display Success Report
* **********************
* Check Success table
DESCRIBE TABLE it_success LINES gd_lines.
IF gd_lines GT 0.
* Display result report column headings
PERFORM display_column_headings.
* Display result report
PERFORM display_report.
ENDIF.
* Display Error Report
* ********************
* Check errors table
DESCRIBE TABLE it_error LINES gd_lines.
* If errors exist then display errors report
IF gd_lines GT 0.
* Display errors report
PERFORM display_error_headings.
PERFORM display_error_report.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Form DISPLAY_COLUMN_HEADINGS
*&---------------------------------------------------------------------*
* Display column headings
*----------------------------------------------------------------------*
FORM display_column_headings.
WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
SKIP.
WRITE:2 'The following records updated successfully:'(013).
WRITE:/ sy-uline(42).
FORMAT COLOR COL_HEADING.
WRITE:/ sy-vline,
(10) 'Purchase Order'(004), sy-vline,
(11) 'Old Netpr'(005), sy-vline,
(11) 'New Netpr'(006), sy-vline.
WRITE:/ sy-uline(42).
ENDFORM. " DISPLAY_COLUMN_HEADINGS
*&---------------------------------------------------------------------*
*& Form BDC_UPDATE
*&---------------------------------------------------------------------*
* Populate BDC table and call transaction ME22
*----------------------------------------------------------------------*
FORM bdc_update.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0105',
' ' 'BDC_CURSOR' 'RM06E-BSTNR',
' ' 'RM06E-BSTNR' wa_ekko-ebeln,
' ' 'BDC_OKCODE' '/00', "OK code
'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'EKPO-NETPR(01)',
' ' 'EKPO-NETPR(01)' p_newpr,
' ' 'BDC_OKCODE' '=BU'. "OK code
* Call transaction to update customer instalment text
CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
MESSAGES INTO messtab.
* Check if update was succesful
IF sy-subrc EQ 0.
ADD 1 TO gd_update.
APPEND wa_ekko TO it_success.
ELSE.
* Retrieve error messages displayed during BDC update
LOOP AT messtab WHERE msgtyp = 'E'.
* Builds actual message based on info returned from Call transaction
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = messtab-msgid
msgnr = messtab-msgnr
msgv1 = messtab-msgv1
msgv2 = messtab-msgv2
msgv3 = messtab-msgv3
msgv4 = messtab-msgv4
IMPORTING
message_text_output = w_textout.
ENDLOOP.
* Build error table ready for output
wa_error = wa_ekko.
wa_error-err_msg = w_textout.
APPEND wa_error TO it_error.
CLEAR: wa_error.
ENDIF.
* Clear bdc date table
CLEAR: bdc_tab.
REFRESH: bdc_tab.
ENDFORM. " BDC_UPDATE
*---------------------------------------------------------------------*
* FORM DYNPRO *
*---------------------------------------------------------------------*
* stores values to bdc table *
*---------------------------------------------------------------------*
* --> DYNBEGIN *
* --> NAME *
* --> VALUE *
*---------------------------------------------------------------------*
FORM dynpro USING dynbegin name value.
IF dynbegin = 'X'.
CLEAR bdc_tab.
MOVE: name TO bdc_tab-program,
value TO bdc_tab-dynpro,
'X' TO bdc_tab-dynbegin.
APPEND bdc_tab.
ELSE.
CLEAR bdc_tab.
MOVE: name TO bdc_tab-fnam,
value TO bdc_tab-fval.
APPEND bdc_tab.
ENDIF.
ENDFORM. " DYNPRO
*&---------------------------------------------------------------------*
*& Form DISPLAY_REPORT
*&---------------------------------------------------------------------*
* Display Report
*----------------------------------------------------------------------*
FORM display_report.
FORMAT COLOR COL_NORMAL.
* Loop at data table
LOOP AT it_success INTO wa_success.
WRITE:/ sy-vline,
(10) wa_success-ebeln, sy-vline,
(11) wa_success-netpr CURRENCY wa_success-waers, sy-vline,
(11) p_newpr, sy-vline.
CLEAR: wa_success.
ENDLOOP.
WRITE:/ sy-uline(42).
REFRESH: it_success.
FORMAT COLOR COL_BACKGROUND.
ENDFORM. " DISPLAY_REPORT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ERROR_REPORT
*&---------------------------------------------------------------------*
* Display error report data
*----------------------------------------------------------------------*
FORM display_error_report.
LOOP AT it_error INTO wa_error.
WRITE:/ sy-vline,
(10) wa_error-ebeln, sy-vline,
(11) wa_error-netpr CURRENCY wa_error-waers, sy-vline,
(73) wa_error-err_msg, sy-vline.
ENDLOOP.
WRITE:/ sy-uline(104).
REFRESH: it_error.
ENDFORM. " DISPLAY_ERROR_REPORT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ERROR_HEADINGS
*&---------------------------------------------------------------------*
* Display error report headings
*----------------------------------------------------------------------*
FORM display_error_headings.
SKIP.
WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
SKIP.
WRITE:2 'The following records failed during update:'(008).
WRITE:/ sy-uline(104).
FORMAT COLOR COL_HEADING.
WRITE:/ sy-vline,
(10) 'Purchase Order'(009), sy-vline,
(11) 'Netpr'(010), sy-vline,
(73) 'Error Message'(012), sy-vline.
WRITE:/ sy-uline(104).
FORMAT COLOR COL_NORMAL.
ENDFORM. " DISPLAY_ERROR_HEADINGS
<b>Check this link for creating BDC with Screen shots</b>
http://www.sapdevelopment.co.uk/bdc/bdc_recording.htm
<b>Check this link on BDC doubts</b>
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
Reward all helpfull answers
Regards
Pavan<b></b>
‎2007 Jul 30 7:32 AM
hi vamshi,
there are many ways to transfer data from one system to other.
they are called conversion programs and interface programs.
We use BDC for data Uploads from Legacy system to SAP
BDC programs also called as data conversions
we will use other interfaces like
RFC,BAPI, IDOC/ALE/EDI depending on the requirement.
reward points for useful answer.
gud luck.
‎2007 Jul 30 7:45 AM
Conversions - This type of transfer refers to a one-time transfer from a legacy system to the SAP system. In this case, the legacy system is the old system that is being replaced by the SAP system.
For example, the old system being replaced has data for 2,000 vendors that must be transferred to the SAP system.
Interfaces - This type of transfer refers to an ongoing transfer from a complimentary system to the SAP system. In this case, the complimentary system is a system that will run along side the SAP system.
For example, customer orders may be taken in another system. For the SAP system to reflect accurate information, these orders must be transferred to the SAP system every night.
BDC can be both interfaces or conversions depending upon the functionality above.
Interfaces are needed when we need data from other than SAP envoronment and vise versa.
Suppose aclient may send his business data through Excel sheet which are to be loaded in his SAP Tables.Then we need to use interfaces.
There are two Categogies.
1.From Presentation Layer to your ABAP Program(and then into Database table)
Presentation layer means from your sytem (from C, drives)
2.From application Server to your ABAP Program(and then into Database table)
Application Server means the server for your Sap System.
For the first case you need to use:From Presentation Layer to your ABAP Program and vise versa)
GUI_UPLOAD to upload data,
GUI_DOWNLOAD to download data
For the Second case(From application Server to your ABAP Program and vise versa)
A.OPEN DATA SET FILE NAME ON APPL.SERVER FOR INPUT ENCODING BY DEFAULT. use tranfer command to send data to application server
B. CLOSE DATA SET.
CONVERSION programs are the ones which have one time usage, usually when a legacy system is being replaced by a system like SAP, then the data has to be mapped from the legacy system to SAP system. Here the data to be converted is given on a flat file & is uploaded to SAP tables mostly using LSMW only.
INTERFACE programs are the ones which are run at regular intervals, say weekly, monthly or even daily. Here the legacy system continues to co-exist along with SAP system, the legacy system might be useful for certain functionalities but the data might have to run thru SAP transactions for complex data maintenance at regular intervals.
.
Here is the difference
conversion program
http://help.sap.com/saphelp_erp2005/helpdata/en/d3/a65a14e96911d1b401006094b944c8/frameset.htm
Interface program
http://help.sap.com/saphelp_erp2005/helpdata/en/64/be5b4150b38147e10000000a1550b0/frameset.htm
Conversion program is nothing but file uploading ,it means when you have file from local server or application server,then we need to upload to SAP R/3 ,in this case we use BDC Method's or BAPI Function module
Interface program - is nothing but getting the data from third party system to SAP R/3 or SAP R/3 to Third party system. In this case we use ALE/IDOC/EDI.