Application Development 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: 

BDC CREATION USING CALL TRANSACTION

Former Member
0 Kudos
135

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)

1 ACCEPTED SOLUTION

Former Member
0 Kudos
83

hi,

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'.

<b>call transaction 'VA01' using bdctab

MODE 'A'

update 'S'.</b>

endloop.

do reward if it helps,

priya.

3 REPLIES 3

Former Member
0 Kudos
83

HI,

Put this code after

<b> perform get_data.

perform create_bdcdata.

call transaction 'va01' using bdctab

MODE 'A'

update 'S'</b>

Thanks

Mahesh

Former Member
0 Kudos
84

hi,

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'.

<b>call transaction 'VA01' using bdctab

MODE 'A'

update 'S'.</b>

endloop.

do reward if it helps,

priya.

former_member196280
Active Contributor
0 Kudos
83

FORM bdc_dynpro USING P1

P2

p3.

***<b>if BDCTAB-DYNBEGIN = 'X'.</b> "Deleted

<b>IF P1 = 'X'. "ADDED

<b>CLEAR BDCTAB.</b> "ADDED

BDCTAB-DYNBEGIN = P1 "ADDED

BDCTAB-PROGRAM = P2. "ADDED

BDCTAB-DYNPRO = P3.</b> "ADDED

<b>**BDCTAB-PROGRAM = P1. "DELETED

**BDCTAB-DYNPRO = P2.</b> "DELETED

else.

<b>CLEAR BDCTAB.</b> ""ADDED

BDCTAB-FNAM = P1.

BDCTAB-FVAL = P2.

endif.

APPEND BDCTAB

Now try like this it will solve your problem.

Reward points if useful.

Regards,

SaiRam