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

help for data upload

Former Member
0 Likes
757

hii friends,

i have written this bdc program to upload the address data from flat file to the sap system but whenever i process the session i get the result like W_MAT-NAME,W_MAT-STREET etc instead of the data in the flat file.

i have pasted my program here..plzz site the error.

report ZADDRESS1

no standard page heading line-size 255.

TABLES : ztable.

include bdcrecx1.

DATA : BEGIN OF ITAB,

NAME like ztable-name,

street LIKE ZTABLE-STREET,

MOBILE LIKE ZTABLE-MOBILE,

FIXED LIKE ZTABLE-FIXEDLINE,

CITY LIKE ZTABLE-CITY,

STATE LIKE ZTABLE-STATE,

COUNTRY LIKE ZTABLE-COUNTRY,

MAIL LIKE ztable-email,

END OF ITAB.

data : i_mat type table of ITAB.

data : w_mat type ITAB.

start-of-selection.

call function 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

  • FILENAME = ' '

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = I_MAT

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • FILE_OPEN_ERROR = 2

  • FILE_READ_ERROR = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • NO_AUTHORITY = 10

  • OTHERS = 11

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

perform open_group.

LOOP AT I_MAT INTO w_mat.

perform bdc_dynpro using 'ZADDRESS' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=S'.

perform bdc_field using 'BDC_CURSOR'

'ZTABLE-EMAIL'.

perform bdc_field using 'ZTABLE-NAME'

'W_MAT-NAME'.

perform bdc_field using 'ZTABLE-STREET'

'W_MAT-STREET'.

perform bdc_field using 'ZTABLE-MOBILE'

'W_MAT-MOBILE'.

perform bdc_field using 'ZTABLE-FIXEDLINE'

'W_MAT_FIXED'.

perform bdc_field using 'ZTABLE-CITY'

'W_MAT-CITY'.

perform bdc_field using 'ZTABLE-STATE'

'W_MAT-STATE'.

perform bdc_field using 'ZTABLE-COUNTRY'

'W_MAT-COUNTRY'.

perform bdc_field using 'ZTABLE-EMAIL'

'W_MAT-MAIL'.

perform bdc_dynpro using 'ZADDRESS' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=E'.

perform bdc_field using 'BDC_CURSOR'

'ADDRESS'.

perform bdc_field using 'ZTABLE-NAME'

'W_MAT-NAME'.

perform bdc_field using 'ZTABLE-STREET'

'W_MAT-STREET'.

perform bdc_field using 'ZTABLE-MOBILE'

'W_MAT-MOBILE'.

perform bdc_field using 'ZTABLE-FIXEDLINE'

'W_MAT-FIXED'.

perform bdc_field using 'ZTABLE-CITY'

'W_MAT-CITY'.

perform bdc_field using 'ZTABLE-STATE'

'W_MAT-STATE'.

perform bdc_field using 'ZTABLE-COUNTRY'

'W_MAT-COUNTRY'.

perform bdc_field using 'ZTABLE-EMAIL'

'W_MAT-MAIL'.

perform bdc_transaction using 'ZADD'.

ENDLOOP.

perform close_group.

thanks in adv

abhinab

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
732

The problem is this


perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.

You are always passing literals, not variables.

This is the way you want to do it.


perform bdc_field using ZTABLE-NAME
W_MAT-NAME.

By the way, I don't see any filename in that function, what are you reading?

6 REPLIES 6
Read only

Former Member
0 Likes
733

The problem is this


perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.

You are always passing literals, not variables.

This is the way you want to do it.


perform bdc_field using ZTABLE-NAME
W_MAT-NAME.

By the way, I don't see any filename in that function, what are you reading?

Read only

Sm1tje
Active Contributor
0 Likes
732

Don't use any quotes for your w_mat fields:

W_MAT-NAME in stead of 'W_MAT-NAME'.

Read only

amit_khare
Active Contributor
0 Likes
732

You are passing all the parameters as Constants to the PERFORM.

perform bdc_field using 'BDC_CURSOR'

'ZTABLE-EMAIL'.

perform bdc_field using 'ZTABLE-NAME'

'W_MAT-NAME'.

Dont pass them as constants.

Regards,

Amit

Read only

b_deterd2
Active Contributor
0 Likes
732

By this:

perform bdc_field using 'ZTABLE-NAME'

'W_MAT-NAME'.

W_MAT-NAME is in quotes so it is seen like the text: w_mat-name.

Regards,

Bert

Read only

Former Member
0 Likes
732

Hi Abhinab Mishra ,

In your program you had placed the variable inside the quotes like this :

perform bdc_field using 'ZTABLE-NAME'

'W_MAT-NAME'.

this needs to be corrected like this :

perform bdc_field using 'ZTABLE-NAME'

W_MAT-NAME.

Hope this solves your problem.

Thanks,

Greetson

Read only

0 Likes
732

thnks experts tht really helped.