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 UPLOAD QUERY

Former Member
0 Likes
826

hi ! my friend i want to upload 1000 records using bdc session method with one click ie: backprocessing .i m getting problem during scroole screen .plz send me the complete coding if possible or any other method which is applicable .

7 REPLIES 7
Read only

Former Member
0 Likes
798

Find out BAPI fir the same. And use it in to your program.

Read only

Former Member
0 Likes
798

use only page down key at the time of selecting the views when u r doing the recording. it ll work properly

or

else u can use BAPI_MATERIAL_SAVEDATA to upload the file.

Edited by: PRAKASH VARUN on Jun 27, 2008 3:12 PM

Read only

Former Member
0 Likes
798

hi ! i want to upload data using lsmw .but i do not have any tcode .functional provides me recording in this way .

they start recording directly in spro &

and then flow is go to logistic general,tax on goods movement ,india ,incoming,def. reference modes per transaction.tis is the complete flow in which functional guy creates his recording but using lsmw its not uploading properly .it will only provides me 2 screens while executing .plz provide me possible solution .

Is it possible that without tcode directly using spro uploading is possible .

thanks .

regards .

rajan mehta.

Read only

0 Likes
798

hi,

try the link below:

http://sap.niraj.tripod.com/id61.html

regards

pritam.

Read only

Former Member
0 Likes
798

Hi,

There are two ways to scroll while uploading in BDC.. Just record one scrolling action to catch the OK_CODE. mostly it must be "P+".... by using this scrolling we will no scroll down by making the last entry as the first.. And cursor will be in the empty field below the last field...

the other way is there is a counter at the end of the page... change the field value to 100 or something.. It will make it scroll to last data record...

Regards,

VIjay

Read only

Former Member
0 Likes
798

Hi Rajan,

This a case of Table control,Go through this

Table controls allow you to enter, display, and modify tabular data easily on the screen. Check this code,

PARAMETERS: file1 LIKE rlgrap-filename.

************************************************************************

*Internal Table Declarations

************************************************************************

DATA: BEGIN OF itab OCCURS 0,

matnr(18) TYPE c, "MaterialNumber

werks(4) TYPE c, "Plant

vdatu(10) TYPE c, "Valid From Date

bdatu(10) TYPE c, "Valid To Date

lifnr(10) TYPE c, "Vendor Number

ekorg(4) TYPE c, "Purchasing Organization

feskz TYPE c, "Fixed

autet TYPE c, "MRP Indicator

END OF itab.

DATA: bdcdata LIKE TABLE OF bdcdata WITH HEADER LINE.

************************************************************************

*VARIABLES Declarations

************************************************************************

DATA: wa1 LIKE LINE OF itab. "Workarea for ITAB

DATA: n TYPE i, "Check

count TYPE i.

DATA: cnt(2), "Counter

wa(15). "Workarea to hold concatenated value

DATA v_msg(100).

DATA: flag.

DATA: file TYPE string.

************************************************************************

*Initialization event

************************************************************************

INITIALIZATION.

************************************************************************

*At-selection-screen event

************************************************************************

*To provide Input help for file name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file1.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = file1.

***********************************************************************

*START-OF-SELECTION EVENT

***********************************************************************

START-OF-SELECTION.

MOVE file1 TO file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = file

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = itab

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*To populate BDCDATA and start data transfer

LOOP AT itab .

  • To validate Plant range

IF itab-werks = '1000' OR itab-werks = '2000'

OR itab-werks = '1008'.

AT NEW werks.

CLEAR: n.

cnt = 1.

PERFORM bdc_dynpro USING 'SAPLMEOR' '0200'.

PERFORM bdc_field USING 'BDC_CURSOR'

'EORD-MATNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'EORD-MATNR'

itab-matnr.

PERFORM bdc_field USING 'EORD-WERKS'

itab-werks.

PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.

CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.

PERFORM bdc_field USING 'BDC_CURSOR'

wa.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

ENDAT.

IF n = 12.

READ TABLE bdcdata WITH KEY fval = '=BU'.

bdcdata-fval = '=NS'.

MODIFY bdcdata INDEX sy-tabix TRANSPORTING fval.

PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.

PERFORM bdc_field USING 'BDC_CURSOR'

'EORD-VDATU(01)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

cnt = 2.

n = 2.

ENDIF.

CONCATENATE 'EORD-VDATU(' cnt ')' INTO wa.

PERFORM bdc_field USING wa

itab-vdatu.

CONCATENATE 'EORD-BDATU(' cnt ')' INTO wa.

PERFORM bdc_field USING wa

itab-bdatu.

CONCATENATE 'EORD-LIFNR(' cnt ')' INTO wa.

PERFORM bdc_field USING wa

itab-lifnr.

CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.

PERFORM bdc_field USING wa

itab-ekorg.

CONCATENATE 'RM06W-FESKZ(' cnt ')' INTO wa.

PERFORM bdc_field USING wa

itab-feskz.

CONCATENATE 'EORD-AUTET(' cnt ')' INTO wa.

PERFORM bdc_field USING wa

itab-autet.

IF n <> 12.

n = cnt.

ENDIF.

cnt = cnt + 1.

AT END OF werks.

CALL TRANSACTION 'ME01' USING bdcdata

UPDATE 'S'

MODE 'A'.

CLEAR:bdcdata,bdcdata[].

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = sy-msgid

lang = 'EN'

no = sy-msgno

v1 = sy-msgv1

v2 = sy-msgv2

v3 = sy-msgv3

v4 = sy-msgv4

IMPORTING

msg = v_msg.

WRITE:/ v_msg.

CLEAR: bdcdata,bdcdata[],flag.

ENDAT.

ENDIF.

ENDLOOP.

----


  • Start new screen *

----


FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM.

----


  • Insert field values

----


FORM bdc_field USING fnam fval.

IF NOT fval IS INITIAL.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDIF.

CLEAR wa.

ENDFORM.

Thanks

Ankur Sharma

Read only

Former Member
0 Likes
798

hi ! i want to upload data using lsmw .but i do not have any tcode .functional provides me recording in this way .

they start recording directly in spro &

and then flow is go to logistic general,tax on goods movement ,india ,incoming,def. reference modes per transaction.tis is the complete flow in which functional guy creates his recording but using lsmw its not uploading properly .it will only provides me 2 screens while executing .plz provide me possible solution .

Is it possible that without tcode directly using spro uploading is possible .

thanks .

regards .

rajan mehta.