cancel
Showing results for 
Search instead for 
Did you mean: 

BDC Recording for uploadind data in server proxy

Former Member
0 Kudos

HI,

I have a scenario where i m getting data from file and sending to SAP.

Proxy is receiver

i need to use BDC to upload the data.

i am not good good in abap and have no knowledge of using BDC(SHDB).

could anyone guide me steps how to use BDC in proxy reciever to upload data to SAP.

jeff

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you need to use BDC then there is no need to of Proxy or XI...etc.

BDC is a technique used in SAP-ABAP/4 to upload data from legacy systems

(file-->SAP).

In BDC for u r case there are 2 methods normally used. (Actually there are 4 methods).

a> Session method

b> Call transaction method

You can create a recording using transaction code SHDB, e.g u r doing it for Sales Order, VA01..the recording technique will map the screens and the fields and presents in exe program..then u can use to code further in Session or Calltransaction method....for more information go to General ABAP/4 forums....

bye

Ajay

Former Member
0 Kudos

Hi,

I need to fetch file from vendors server using XI.

I am using File to proxy

so that we can write BDC code in Proxy.

map proxy structure to BDC.

i want to know after saving the SHDB .

wat we need to do in abap editor.

if you have sample code or can explian me procedure it would be helpful.

Jeff

Former Member
0 Kudos

Hi,

Here is the sample code for BDC call transaction...

all you need to do is replace the test values with the field names

this example is for transaction MM12

PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.

--> this is what you get in SHDB

PERFORM bdc_field USING 'BDC_CURSOR'

'05/07/2007'.

-


> this is when we replace the value with internal table and field name

PERFORM bdc_field USING 'BDC_CURSOR'

'RMMG1-AEDAT'.

Please go though it...hope this will be helpful

&----


*& Form sub_call_transaction

&----


  • validating and uploading data to SAP using Call transaction

----


FORM sub_call_transaction.

  • local variable

DATA l_check TYPE i.

  • sort table t_material

SORT t_material BY matnr.

  • sort table t_mara

SORT t_mara BY matnr.

  • sort table t_twew

SORT t_twew BY extwg.

  • if table t_material contains data upload the data to SAP

IF NOT t_material[] IS INITIAL.

  • uploading only valid records

LOOP AT t_material INTO w_material.

  • reading table t_mara for material

READ TABLE t_mara INTO w_mara WITH KEY matnr = w_material-matnr

BINARY SEARCH.

  • if material found setting the value of l_check to 2

IF sy-subrc EQ 0.

l_check = 2.

ELSE.

  • if material is not matching

l_check = 1.

ENDIF.

  • if material is valid

IF l_check = 2.

  • reading extwg

READ TABLE t_twew INTO w_twew WITH KEY extwg = w_material-extwg

BINARY SEARCH.

  • if extwg does not matches

IF sy-subrc NE 0.

  • l_check is set to 3

l_check = 3.

ELSE.

  • if both material and extwg are valid then l_check is set to 4

l_check = 4.

ENDIF.

ENDIF.

  • now bases on the l_check value either uploading the record are

  • generating an error value in the internal table

  • if l_check value is 1 then material is invalid

  • then the record is not update and a corresponding

  • error entry is entered in t_report table

IF l_check EQ 1.

w_report-matnr = w_material-matnr.

w_report-extwg = w_material-extwg.

w_report-date = g_date1.

w_report-message = c_inv_mat. "'Error Invalid Material'.

w_report-icon = icon_red_light. "Green Light

APPEND w_report TO t_report.

  • if l_check value is 3 then external material group is invalid

  • then the record is not update and a corresponding

  • error entry is entered in t_report table

ELSEIF l_check EQ 3.

w_report-matnr = w_material-matnr.

w_report-extwg = w_material-extwg.

w_report-date = g_date1.

w_report-icon = icon_red_light. "Green Light

w_report-message = c_inv_ext. "'Error Invalid Extwg'.

APPEND w_report TO t_report.

  • if l_check value is 4 then record is valid

  • and it will be updated

ELSEIF l_check EQ 4.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RMMG1-AEDAT'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=AUSW'.

PERFORM bdc_field USING 'RMMG1-MATNR'

w_material-matnr.

PERFORM bdc_field USING 'RMMG1-AEDAT'

g_date1.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

PERFORM bdc_field USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'

'X'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_field USING 'MARA-EXTWG'

w_material-extwg.

  • calling transaction MM12

PERFORM bdc_transaction USING c_tcode. "'MM12'.

ENDIF.

  • clearing work area w_material

CLEAR w_material.

  • clearing work area w_mara

CLEAR w_mara.

  • clearing work area w_twew

CLEAR w_twew.

  • clearing the local variable

CLEAR l_check.

  • clearing all the records of t_bdcdata

  • clearing all the records from t_bdcdata

REFRESH t_bdcdata.

ENDLOOP.

ENDIF.

ENDFORM. "sub_upload_data

&----


*& Form bdc_transaction

&----


  • This form is used to run call transaction method

----


FORM bdc_transaction USING tcode.

  • calling the transaction MM12 in mode 'N' background

CALL TRANSACTION tcode USING t_bdcdata

MODE g_ctumode

UPDATE g_cupdate

MESSAGES INTO t_bdcmsgcoll.

  • checking for records in table t_bdcmsgcoll

IF NOT t_bdcmsgcoll[] IS INITIAL.

  • checking the status of each record success or failure

READ TABLE t_bdcmsgcoll INTO w_bdcmsgcoll WITH KEY

msgtyp = c_error. "'E'.

  • if error record update with error message

IF sy-subrc EQ 0.

  • if error then trap the message

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = w_bdcmsgcoll-msgid

lang = sy-langu

no = w_bdcmsgcoll-msgnr

v1 = w_bdcmsgcoll-msgv1

v2 = w_bdcmsgcoll-msgv2

v3 = w_bdcmsgcoll-msgv3

v4 = w_bdcmsgcoll-msgv4

IMPORTING

msg = w_report-message

EXCEPTIONS

not_found = 1

OTHERS = 2.

  • appending t_report table with error message

w_report-matnr = w_material-matnr.

w_report-extwg = w_material-extwg.

w_report-icon = icon_red_light. "Red Light

  • appending the record

APPEND w_report TO t_report.

ELSE.

  • appending t_report with success message

w_report-matnr = w_material-matnr.

w_report-extwg = w_material-extwg.

w_report-date = g_date1.

w_report-message = c_success.

w_report-icon = icon_green_light. "Green Light

  • appending the record

APPEND w_report TO t_report.

ENDIF.

  • clearing the records from table

REFRESH t_bdcmsgcoll.

ENDIF.

ENDFORM. "BDC_TRANSACTION

Thank you

Ajay

Former Member
0 Kudos

Hi Ajay,

Thanks for this code.

i am really novice to ABAP/BDC

would you be able to assit me to do update a screen Fi01

create bank.

Regards,

Jeff

Former Member
0 Kudos

You can do the recording in SHDB for Tcode FI01.

Then transer it to some ABAP program from which you can copy it in your proxy method (Execute-> Asynchronous).

Regards

Sushil