Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BDC help...

Former Member
0 Likes
461

HI friends..

i've already posted a question regarding BDC for VA51 transaction....

But didnt get replies who cud solve my problem...

i am not able to get it done yet...

my ecxel sheet is as follw..

PROPOSAL-TYPE

SALES ORG

DISTRIBUTION

DIVISION

DESCRIPTION

MATERIAL

QUANTITY

FROM 'PROPOSAL TYPE' TO 'DESCRTPTION' ITS MY HEADER DATA...

MATERIAL AND QUANTITY CUD BE MORE FOR EACH HEADER DATA...

I AM NOT EVEN ABLE TO ARRANGE THIS EXCEL SHEET IN PROPER WAY TO FETCH DATA INTO MY INTERNAL TABLE...

Can somebody help me regarding this.?

ANYBODY HAS THE BDC FOR THE SAME TRANSACTION?

PLS HELP...

PTS REWRDED FOR SURE..

3 REPLIES 3
Read only

Former Member
0 Likes
427

hi

it's quite simple..u can try something like this

PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 1

PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 2

PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 3

1PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 22

1PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 32

1PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 44

1PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 55

1PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 66

1PROPOSAL SALESORG DISTRIBUTION DIVISION DESCRIPTION MAT1 77

build your excel like this

loop at itab.

at new proposal-type, move the header data ( first 5 fields) to header_itab.

append header_itab.

endat.

move all the fields to item_itab.

append item_itab.

endloop.

then apply this logic for bdc

loop at header_itab.

**perform bdc for header fields

loop at item_itab where proposal_type = header_itab-proposal_type.

**perform bdc for item fields

endloop.

endloop.

if helpful, reward

Sathish. R

Message was edited by:

Sathish

Read only

Former Member
0 Likes
427

hi Snehal

just refer to the link below

http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g

<b>it will definitely help u a lot</b>

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Read only

Former Member
0 Likes
427

Hi,

This is BDC for ME51, this code will help you to get flat file values to internal table, and you should use one upload function module to get flat file value to internal table. and one more thing you should specify the size of each fields in flat file same as original table.

report ZUDAY_BDC_TCL1 no standard page heading line-size 255.

include bdcrecx1.

TABLES EBAN.

DATA: BEGIN OF ITAB OCCURS 0,

NUMBER(3) TYPE C,

MATNR LIKE EBAN-MATNR,

TXZ01 LIKE EBAN-TXZ01,

MENGE(13) TYPE C,

MEINS LIKE EBAN-MEINS,

EEIND TYPE RM06B-EEIND,

EKGRP LIKE EBAN-EKGRP,

MATKL LIKE EBAN-MATKL,

WERKS(4) TYPE C,

END OF ITAB.

DATA: LVALUE TYPE I,

COUNT TYPE I,

TEMP(20) TYPE C,

CTRL TYPE I,

CTRL1(3) TYPE C,

PAGES(5) TYPE c VALUE '10',

PVALUE(3) TYPE C VALUE 0.

start-of-selection.

PERFORM GETDATA.

SORT ITAB BY NUMBER.

perform open_group.

LOOP AT ITAB.

IF ITAB-NUMBER <> LVALUE.

COUNT = 0.

perform bdc_dynpro using 'SAPMM06B' '0100'.

perform bdc_field using 'BDC_CURSOR'

'EBAN-BSART'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'EBAN-BSART'

'NB'.

perform bdc_field using 'RM06B-LPEIN'

'T'.

perform bdc_field using 'EBAN-EKGRP'

'008'.

perform bdc_dynpro using 'SAPMM06B' '0106'.

perform bdc_field using 'BDC_CURSOR'

'EBAN-MATNR(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

                      • Header part is over******************

PAGES = 10.

CTRL = 0.

LOOP AT ITAB WHERE NUMBER = ITAB-NUMBER.

CTRL = CTRL + 1.

IF CTRL >= 19.

PAGES = PAGES + 10.

ENDIF.

CTRL1 = CTRL.

IF CTRL >= 19.

CTRL1 = '19'.

ENDIF.

IF CTRL >= 10.

PVALUE = ''.

ENDIF.

perform bdc_field using 'RM06B-BNFPO'

PAGES.

Concatenate 'EBAN-MATNR(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-MATNR.

Concatenate 'EBAN-TXZ01(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-TXZ01.

Concatenate 'EBAN-MENGE(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-MENGE.

Concatenate 'EBAN-MEINS(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-MEINS.

Concatenate 'RM06B-EEIND(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-EEIND.

Concatenate 'EBAN-EKGRP(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-EKGRP.

Concatenate 'EBAN-MATKL(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-MATKL.

Concatenate 'EBAN-WERKS(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using Temp itab-WERKS.

perform bdc_dynpro using 'SAPMM06B' '0102'.

perform bdc_field using 'BDC_CURSOR'

'EBAN-MENGE'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'EBAN-TXZ01'

ITAB-TXZ01. "'HD GLAD BOY tank silver'.

perform bdc_field using 'EBAN-MENGE'

ITAB-MENGE. "'500'.

perform bdc_field using 'RM06B-EEIND'

ITAB-EEIND."'27.06.2007'.

perform bdc_field using 'EBAN-EKGRP'

ITAB-EKGRP. "'001'.

perform bdc_field using 'EBAN-BADAT'

'15.06.2007'.

perform bdc_field using 'EBAN-FRGDT'

'26.06.2007'.

perform bdc_field using 'EBAN-PREIS'

'55.48'.

perform bdc_field using 'EBAN-WAERS'

'GBP'.

perform bdc_field using 'EBAN-PEINH'

'1'.

perform bdc_field using 'EBAN-REPOS'

'X'.

perform bdc_dynpro using 'SAPMM06B' '0106'.

Concatenate 'ElBAN-MATNR(' PVALUE CTRL1 ')' into Temp.

CONDENSE Temp NO-GAPS.

perform bdc_field using 'BDC_CURSOR' Temp.

perform bdc_field using 'BDC_OKCODE'

'/00'.

ENDLOOP.

LVALUE = ITAB-NUMBER.

perform bdc_dynpro using 'SAPMM06B' '0106'.

perform bdc_field using 'BDC_CURSOR'

'RM06B-BNFPO'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'RM06B-BNFPO'

'80'.

*AT END OF NUMBER.

perform bdc_transaction using 'ME51'.

REFRESH BDCDATA.

*ENDAT.

ENDIF.

ENDLOOP.

perform close_group.

&----


*& Form GETDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GETDATA .

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = ' '

FILETYPE = ' '

TABLES

DATA_TAB = ITAB // here the flat file value is moving to internal table.

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.

ENDFORM. " GETDATA

IF USEFULL REWARD.