Skip to Content
5
Former Member
Jul 20, 2007 at 04:08 PM

BDC CREATION USING CALL TRANSACTION

52 Views

Hi Guys,

I am tryong to upload the transaction va01 using BDC call transaction and while doing that I am getting an error.

Please try to resolve it.

Thanks and Regards

Rajeev Gupta

data: bdctab like bdcdata occurs 0 with header line.

data: messtab like bdcmsgcoll occurs 0 with header line.

data: begin of itab occurs 0,

ord_typ(2),

sales_org(4),

dist_chan(2),

div(2),

PO_No(10),

SP(6),

SH(6),

pay_term(4),

inc_term(3),

inc_inf(10),

material(4),

item(2),

ord_quan(5),

plant(4),

amount(7),

Netweight(5),

Grossweight(5),

end of itab.

perform get_data.

perform create_bdcdata.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\Ekansh\Desktop\salesorder'

filetype = 'dat'

TABLES

DATA_TAB = ITAB

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

GUI_REFUSE_FILETRANSFER = 8

OTHERS = 9.

ENDFORM. " get_data

*&----


**& Form bdcdata

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


FORM create_bdcdata .

loop at itab.

perform bdc_dynpro using:

'X' 'SAPMV45A' '0101',

'' 'BDC_OKCODE' '/00',

'' 'VBAK-AUART' itab-ord_typ,

'' 'VBAK-VKORG' itab-sales_org,

'' 'VBAK-VTWEG' itab-dist_chan,

'' 'VBAK-SPART' itab-div,

'X' 'SAPMV45A' '4001',

'' 'BDC_OKCODE' '=T\02',

'' 'VBKD-BSTKD' itab-PO_No,

'' 'KUAGV-KUNNR' itab-SP,

'' 'KUWEV-KUNNR' itab-SH,

'' 'VBKD-ZTERM' itab-pay_term,

'' 'VBKD-INCO1' itab-inc_term,

'' 'VBKD-INCO2' itab-inc_inf,

'' 'RV45A-MABNR(01)' itab-material,

'' 'VBAP-POSNR(01)' itab-item,

'' 'RV45A-KWMENG(01)' itab-ord_quan,

'' 'VBAP-WERKS(01)' itab-plant,

'' 'KOMV-KBETR(01)' itab-amount,

'X' 'SAPMV45A' '4001',

'' 'BDC_OKCODE' '/00',

'' 'VBAP-NTGEW(01)' itab-Netweight,

'' 'VBAP-BRGEW(01)' itab-Grossweight,

'X' 'SAPMV45A' '4001',

'' 'BDC_OKCODE' '=SICH'.

endloop.

ENDFORM. " create_bdcdata

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0125 text

  • -->P_0126 text

  • -->P_0127 text

----


FORM bdc_dynpro USING P1

P2

p3.

if BDCTAB-DYNBEGIN = 'X'.

BDCTAB-PROGRAM = P1.

BDCTAB-DYNPRO = P2.

else.

BDCTAB-FNAM = P1.

BDCTAB-FVAL = P2.

endif.

APPEND BDCTAB.

ENDFORM. " bdc_dynpro

call transaction 'va01' using bdctab

MODE 'A'

update 'S'

error is:

Statement is not accessible.(for call transaction using)