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

regarding the bdc

Former Member
0 Likes
740

hi,

if you want to upload the data that is given in the excel sheet through the bdc.what are the steps to be followed?

it is very urgent.

thanks in advance

hi,

if you want to upload the data that is given in the excel sheet through the bdc.what are the steps to be followed?

it is very urgent.

thanks in advance

3 REPLIES 3
Read only

Former Member
0 Likes
627

Hi,

check out the following link it might help you

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

http://www.sap-img.com/bdc.htm

Check the code.....

REPORT ZMM016

NO STANDARD PAGE HEADING LINE-SIZE 255.

&----


*& Internal Table Declaration

&----


DATA: BEGIN OF ITAB OCCURS 0,

MATNR(10),

LIFNR(10),

IDNLF(35), "Article Number Used by Vendor

END OF ITAB.

&----


*& Data Declaration

&----


DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

----


  • Selection Screen

----


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT_001.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(20) TEXT_1_1.

PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B1.

----


  • Initialization Event

----


INITIALIZATION.

TEXT_001 = 'File path selection'.

TEXT_1_1 = 'File Path'.

----


  • At Selection Screen Event

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

FILE_NAME = P_FILE.

&----


*& Start of Selection

&----


START-OF-SELECTION.

PERFORM DATA_UPLOAD.

IF ITAB[] IS NOT INITIAL.

PERFORM OPEN_GROUP.

REFRESH BDCDATA.

PERFORM BDCDATA.

PERFORM CLOSE_GROUP.

ENDIF.

&----


*& Form BDCDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BDCDATA .

LOOP AT ITAB.

REFRESH BDCDATA.

PERFORM BDC_DYNPRO USING 'SAPLMGMW' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(03)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RMMW1-MATNR'

ITAB-MATNR.

PERFORM BDC_FIELD USING 'RMMW1-EKORG'

'1000'.

PERFORM BDC_FIELD USING 'RMMW1-LIFNR'

ITAB-LIFNR.

PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(03)'

'X'.

PERFORM BDC_DYNPRO USING 'SAPLMGMW' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BU'.

PERFORM BDC_FIELD USING 'EINA-IDNLF'

ITAB-IDNLF.

PERFORM BDC_INSERT.

ENDLOOP.

ENDFORM. " BDCDATA

&----


*& Form DATA_UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DATA_UPLOAD.

DATA: LOC_FILENAME TYPE STRING.

LOC_FILENAME = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = LOC_FILENAME

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.

ENDFORM. " DATA_UPLOAD

&----


*& Form BDC_INSERT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BDC_INSERT .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MM42'

TABLES

DYNPROTAB = BDCDATA.

ENDFORM. " BDC_INSERT

&----


*& Form CLOSE_GROUP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CLOSE_GROUP .

CALL FUNCTION 'BDC_CLOSE_GROUP'.

CALL TRANSACTION 'SM35'.

ENDFORM. " CLOSE_GROUP

&----


*& Form OPEN_GROUP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM OPEN_GROUP .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'MM42_PUR'

USER = SY-UNAME

KEEP = 'X'.

ENDFORM. " OPEN_GROUP

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM. "BDC_DYNPRO

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> SPACE.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM. "BDC_FIELD

Regards,

Padmam.

Read only

Former Member
0 Likes
627

Hi

Try this prgm..

REWARD IF USEFUL

&----


*& Report YITRQMBDC141_QE01 *

*& *

&----


*& Created By : A.Thuyavan

*& Created On : 23.12.2005

*& Change Request No : EDDk922974

*&

*& Changed By : A.Thuyavan

*& Changed On : 06.01.2006

*& Change Request No : EDDk923107

*

&----


report YITRQMBDC141_QE01

no standard page heading line-size 255 message-id zqm.

Constants: c_msg1(20) type c value 'ERROR OPENING FILE',

c_s(1) type c value 'S',

c_e(1) type c value 'E',

c_msg3(35) type c value 'ERROR IN CHECKING THE FILE',

c_msg4(35) type c value

'ENTER VALID FILE PATH AND FILE NAME',

c_neg(2) type c value '-1',

c_msg5(30) type c value

'ERROR IN FILE SELECTION',

c_zero(2) type c value '00'.

tables: qals.

Selection-Screen Begin Of Block BlkFIlter With Frame Title Text-001.

parameters: exfile like RLGRAP-FILENAME obligatory.

Selection-screen skip 1.

parameters:indDate like sy-datum obligatory.

Selection-screen skip 1.

Parameters:

R2 Radiobutton Group radi,

R1 Radiobutton Group radi.

Selection-Screen End Of Block BlkFIlter.

data: begin of datatab occurs 0,

prueflos like qals-prueflos,

merknr like qamkr-merknr,

srlno(2),

value like QAQEE-MESSWERT,

splflag ,

ColNo(4),

end of datatab,

wrkcprev_prueflos like qals-prueflos,

wrkcprev_merknr like qamkr-merknr,

wrkcdate(10) ,lockflag(1) , ProcessMode(1),time(8),

wrkcprev_Splflag(1).

Data: Begin of InspTab Occurs 0,

prueflos like qamv-prueflos,

merknr like qamv-merknr,

End Of InspTab.

ranges:

rngprueflos for qals-prueflos.

data: begin of bdcdata occurs 0.

include structure bdcdata.

data: end of bdcdata.

DATA: exceldata LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE,

resflag.

ranges: insplist for qals-prueflos.

AT SELECTION-SCREEN ON exfile.

PERFORM validate_pre_file USING exfile.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR exfile.

PERFORM sub_f4_help USING exfile.

start-of-selection.

perform upload-excel-data.

if resflag = 'N'. exit. endif.

perform read-and-move-data.

Perform upd-range-insplot.

Perform retr-inspcharnumber.

perform our-validation.

if resflag = 'N'. exit. endif.

Perform Transaction-Mode.

perform initialize-variables.

perform loop-thru-and-create-bdc.

perform end-of-entry.

form our-validation.

data: tmpstdt like sy-datum,

tmpinact,

tmpobjnr like JEST-objnr.

move 'Y' to resflag.

  • Identify & Inform about Blank Inspection Lot Numbers

  • loop at datatab where prueflos = '000000000000'.

  • move 'N' to resflag.

  • Write: / 'Values / Readings are present. But Inspection Lot is

*Missing!'.

  • write: / 'DATA CANNOT BE UPLOADED.'.

  • skip 2.

  • exit.

  • endloop.

*

  • check resflag = 'Y'.

delete datatab where prueflos = '000000000000'.

  • Identity & Inform about more than 17 entries per characteristic

loop at datatab where srlno > '17'.

move 'N' to resflag.

Write: / 'More Than 17 Entries Present for Inspection Lot ',

datatab-prueflos.

write: / 'DATA CANNOT BE UPLOADED.'.

skip 2.

exit.

endloop.

check resflag = 'Y'.

  • (a) Identify & Inform whether Inspection Lots are present

  • (b) Also, if present Start Date & actual keyed-in date differs, warn

  • the user about the same.

  • (c) Check if already has been uploaded. If so, inform the user as

  • error message

loop at insplist.

select single PASTRTERM into tmpstdt

from qals

where prueflos = insplist-low.

if sy-subrc <> 0.

move 'N' to resflag.

write: / 'Inspection Lot ', insplist-low, ' NOT FOUND IN MASTER!'.

write: / 'DATA CANNOT BE UPLOADED'.

skip 2.

continue.

else.

if tmpstdt <> indDate.

move 'N' to resflag.

Write: / 'Inspection Date Cannot Be ', indDate.

endif.

endif.

concatenate 'QL' insplist-low into tmpobjnr.

select single inact into tmpinact

from JEST

where objnr = tmpobjnr and stat = 'I0213'.

if sy-subrc = 0.

move 'N' to resflag.

write: / 'Data Already FOUND TO BE UPLOADED for Inspection Lot',

insplist-low.

write: / 'DATA CANNOT BE UPLOADED'.

skip 2.

endif.

endloop.

loop at insptab.

Read Table datatab with key prueflos = insptab-prueflos merknr =

insptab-merknr .

if sy-subrc <> 0.

move 'N' To resflag .

Write 😕 'Characteristic No',insptab-merknr,

'Is Missing In Excel File For Lot No -', insptab-prueflos.

Exit.

endif.

endloop.

endform.

form read-and-move-data.

data: tmpcprueflos like qals-prueflos,

tmpcprev_prueflos like qals-prueflos,

tmpcmerknr like qamkr-merknr,

tmpcvalue(10),

tmpcblnkflag(1),

tmpprevrow type i,

wrkisrlno type i,

wrknlen type i.

clear datatab.

clear insplist.

move: 'I' to insplist-sign,

'EQ' to insplist-option.

move 1 to tmpprevrow.

loop at exceldata.

  • Identify & Inform About InActive Excel Sheet.

if exceldata-row = 1 .

if exceldata-col = 1 .

Translate exceldata-value To Upper Case.

If exceldata-value <> 'INSPECTION LOT NUMBER' .

message e128 with 'Relavant WorkSheet Is Not Active..!'.

exit.

endif.

delete exceldata Where row = 1.

endif.

endif.

clear: tmpcvalue.

if tmpprevrow <> exceldata-row.

if wrkisrlno = 0 and tmpcmerknr <> '0000'.

move: tmpcprev_prueflos to datatab-prueflos,

tmpcmerknr to datatab-merknr,

'01' to datatab-srlno,

'0' to datatab-value,

'Y' to datatab-splflag.

append datatab.

clear datatab-splflag.

endif.

clear tmpcmerknr.

move exceldata-row to tmpprevrow.

endif.

if exceldata-col = 1.

move exceldata-value to tmpcprueflos.

endif.

if exceldata-col = 3.

wrknlen = strlen( exceldata-value ).

if ( exceldata-value is initial ) or

( exceldata-value(4) not between '0000' and '9999' ) or

wrknlen > 4.

clear tmpcprev_prueflos.

move tmpcprueflos to tmpcprev_prueflos.

clear tmpcprueflos.

else.

move exceldata-value to tmpcmerknr.

clear wrkisrlno.

endif.

endif.

if exceldata-col > 4.

if ( not exceldata-value is initial )

and ( not exceldata-value = '0' ).

move : exceldata-value to tmpcvalue.

endif.

if not tmpcvalue is initial.

add 1 to wrkisrlno.

if wrkisrlno = 1 and insplist-low <> tmpcprev_prueflos and

tmpcprev_prueflos <> '000000000000'.

move tmpcprev_prueflos to insplist-low.

append insplist.

endif.

exceldata-col = exceldata-col - 4.

move: tmpcprev_prueflos to datatab-prueflos,

tmpcmerknr to datatab-merknr,

tmpcvalue to datatab-value,

exceldata-col to datatab-ColNo.

move wrkisrlno to datatab-srlno.

if wrkisrlno < 10.

concatenate '0' datatab-srlno into datatab-srlno.

endif.

append datatab.

endif.

endif.

endloop.

endform.

form upload-excel-data.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = exfile

I_BEGIN_COL = 1

I_BEGIN_ROW = 1

I_END_COL = 50

I_END_ROW = 2000

TABLES

INTERN = exceldata.

.

IF SY-SUBRC <> 0.

move 'N' to resflag.

message e000(zfi) with 'Excel File Could NOT be Uploaded'.

else.

move 'Y' to resflag.

ENDIF.

endform.

form loop-thru-and-create-bdc.

loop at datatab where prueflos <> 0.

if wrkcprev_prueflos <> datatab-prueflos.

if not wrkcprev_prueflos is initial.

perform lock-the-updated-entry.

lockflag = 'Y'.

perform end-of-entry.

endif.

wrkcprev_prueflos = datatab-prueflos.

wrkcprev_merknr = datatab-merknr.

wrkcprev_Splflag = datatab-splflag.

perform populate-header-entry.

endif.

Read Table Insptab With

Key prueflos = datatab-prueflos Merknr = datatab-merknr.

If Sy-Subrc = 0.

if wrkcprev_merknr <> datatab-merknr.

perform lock-the-updated-entry.

lockflag = 'Y'.

perform goto-next-set.

wrkcprev_merknr = datatab-merknr.

wrkcprev_Splflag = datatab-splflag.

endif.

if datatab-splflag <> 'Y'.

perform populate-value-entry using datatab-srlno datatab-value.

Perform assign-time using Datatab-ColNo changing time.

Perform Populate-InspDate Using wrkcdate time datatab-srlno .

endif.

clear lockflag.

Endif.

endloop.

endform.

Form Transaction-Mode.

If R1 = 'X'.

ProcessMode = 'A'.

Elseif R2 = 'X'.

ProcessMode = 'E'.

Endif.

EndForm.

form initialize-variables.

clear: wrkcprev_prueflos, wrkcprev_merknr.

concatenate indDate6(2) '.' indDate4(2) '.' inddate(4) into wrkcdate.

endform.

form lock-the-updated-entry.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-MESSWERT(02)'.

perform bdc_field using 'BDC_OKCODE'

'=ABSL'.

If wrkcprev_Splflag = 'Y'.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_OKCODE'

'=ABSC'.

Endif.

perform bdc_dynpro using 'SAPLQEBR' '0501'.

perform bdc_field using 'BDC_CURSOR'

'QAEEA-MERKNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

perform bdc_field using 'QAEEA-ANNEHMEN'

'X'.

endform.

form populate-header-entry.

perform bdc_dynpro using 'SAPMQEEA' '0100'.

perform bdc_field using 'BDC_CURSOR'

'QALS-PRUEFLOS'.

perform bdc_field using 'BDC_OKCODE'

'=ENT0'.

perform bdc_field using 'QALS-PRUEFLOS'

datatab-prueflos.

perform bdc_field using 'QAQEE-VORNR'

'0010' . " '0020'.

perform bdc_field using 'QAQEE-PRPLATZWRK'

'F*'.

perform bdc_field using 'QAQEE-MODUS'

'1'.

perform bdc_field using 'QAQEE-PRUEFER'

sy-uzeit.

perform bdc_field using 'QAQEE-PRUEFZEITV'

'00:00:00'.

perform bdc_dynpro using 'SAPLQEEM' '1110'.

perform bdc_field using 'BDC_OKCODE'

'=MKPR'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-SUMPLUS(01)'.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-MESSWERT(02)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

endform.

form goto-next-set.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-MESSWERT(02)'.

perform bdc_field using 'BDC_OKCODE'

'=NMKP'.

if datatab-splflag <> 'Y'.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-MESSWERT(02)'.

perform bdc_field using 'BDC_OKCODE'

'=ABSL'.

endif.

endform.

form populate-value-entry using prmcSrlno prmcvalue.

data: tmpcFieldname(20),cstuecknr(18),cmark(14).

concatenate 'QASER-STUECKNR(' prmcsrlno ')' into cstuecknr.

concatenate 'QASER-MARK(' prmcsrlno ')' into cmark.

perform bdc_field using 'BDC_CURSOR' cstuecknr.

perform bdc_field using 'BDC_OKCODE'

'=PRUE'.

perform bdc_field using cmark 'X'.

concatenate 'QAQEE-MESSWERT(' prmcsrlno into tmpcFieldname.

perform bdc_field using tmpcfieldname

prmcvalue.

endform.

form end-of-entry.

if lockflag <> 'Y'.

perform lock-the-updated-entry.

endif.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-MESSWERT(02)'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_dynpro using 'SAPLQAPP' '0300'.

perform bdc_field using 'BDC_CURSOR'

'QAPPW-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

call transaction 'QE01'

using bdcdata

mode ProcessMode

update 'A'.

if sy-subrc <> 0.

write: / 'Entry NOT Posted for Inspection Lot', wrkcprev_prueflos.

endif.

refresh bdcdata.

endform.

form bdc_dynpro using program dynpro.

clear bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

append bdcdata.

endform.

form bdc_field using fnam fval.

clear bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

append bdcdata.

endform.

Form Cursor-Blank-Data.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-MESSWERT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=NMKP'.

Endform.

  • Update Range For Inspection Lot

form upd-range-insplot.

refresh rngprueflos. clear rngprueflos.

loop at datatab.

if not datatab-prueflos is initial.

rngprueflos-sign = 'I'. rngprueflos-option = 'EQ'.

rngprueflos-low = datatab-prueflos.

append rngprueflos. clear rngprueflos.

endif.

endloop.

clear datatab.

delete rngprueflos where low is initial.

endform.

  • Retrieve Inspection Characteristic Number

form retr-inspcharnumber.

select prueflos merknr into table insptab

from qamv

where prueflos in rngprueflos.

endform.

  • Assign Time

form assign-time using ColNo changing time.

case ColNo.

when 1. time = '01:00:00'.

when 2. time = '02:00:00'.

when 3. time = '03:00:00'.

when 4. time = '04:00:00'.

when 5. time = '05:00:00'.

when 6. time = '06:00:00'.

when 7. time = '07:00:00'.

when 8. time = '08:00:00'.

when 9. time = '09:00:00'.

when 10. time = '10:00:00'.

when 11. time = '11:00:00'.

when 12. time = '12:00:00'.

when 13. time = '13:00:00'.

when 14. time = '14:00:00'.

when 15. time = '15:00:00'.

when 16. time = '16:00:00'.

when 17. time = '17:00:00'.

when 18. time = '18:00:00'.

when 19. time = '19:00:00'.

when 20. time = '20:00:00'.

when 21. time = '21:00:00'.

when 22. time = '22:00:00'.

when 23. time = '23:00:00'.

when 24. time = '00:00:00'.

endcase.

endform.

Form Populate-InspDate Using cinspdate ctime prmcSrlNo.

data: tmpcFieldname(20).

perform bdc_dynpro using 'SAPLQEEM' '1002'.

perform bdc_field using 'BDC_CURSOR'

'QAQEE-PRUEFZEITB'.

Perform bdc_field using 'BDC_OKCODE'

'=ENTW'.

perform bdc_field using 'QAQEE-PRUEFER'

Sy-UName.

perform bdc_field using 'QAQEE-PRUEFDATUV' wrkcdate.

"record-PRUEFDATUV_014.

perform bdc_field using 'QAQEE-PRUEFDATUB' wrkcdate.

"record-PRUEFDATUB_015.

perform bdc_field using 'QAQEE-PRUEFZEITV' ctime.

"record-PRUEFZEITV_016.

perform bdc_field using 'QAQEE-PRUEFZEITB' ctime.

"record-PRUEFZEITB_017.

perform bdc_dynpro using 'SAPLQEEM' '0130'.

concatenate 'QAQEE-MESSWERT(' prmcsrlno into tmpcFieldname.

perform bdc_field using 'BDC_CURSOR' tmpcFieldname.

"'QAQEE-MESSWERT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

EndForm.

&----


*& Form validate_pre_file

&----


  • Validate presentation input file

----


FORM validate_pre_file USING fp_file TYPE rlgrap-filename.

DATA : l_result,

l_filename TYPE string.

l_filename = fp_file.

CLEAR l_result.

CALL METHOD cl_gui_frontend_services=>file_exist

EXPORTING

file = l_filename

RECEIVING

result = l_result

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

wrong_parameter = 3

not_supported_by_gui = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE c_msg3 TYPE c_e DISPLAY LIKE c_s.

ELSEIF l_result IS INITIAL.

MESSAGE c_msg4 TYPE c_e DISPLAY LIKE c_s.

ENDIF.

ENDFORM. " validate_pre_file

&----


*& Form sub_f4_help

&----


  • Provide F4 help for file paths and validate

----


FORM sub_f4_help USING fp_file TYPE rlgrap-filename.

DATA : l_return TYPE i,

tl_filetable TYPE filetable,

wl_filetable TYPE LINE OF filetable.

CLEAR : tl_filetable,

l_return.

REFRESH tl_filetable.

TRY.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

CHANGING

file_table = tl_filetable

rc = l_return.

IF l_return EQ c_neg.

MESSAGE c_msg5 TYPE c_s DISPLAY LIKE c_e .

ENDIF.

ENDTRY.

READ TABLE tl_filetable INTO wl_filetable INDEX 1.

IF sy-subrc EQ 0.

fp_file = wl_filetable-filename.

ENDIF.

ENDFORM.

Read only

Former Member
0 Likes
627

For a BDC upload you need to write a program which created BDC sessions.

Steps:

1. Work out the transaction you would use to create the data manually.

2. Use transaction SHDB to record the creation of one material master data.

Click the New recording button or the Menu - Recording - Create

3. Save the recording, and then go back a screen and go to the overview.

4. Select the recording and click on Edit - Create Program. Give the program a Z name, and select transfer from recording.

5. Edit the program. You will see that all the data you entered is hard-coded into the program. You need to make the following changes:

5.1 After the start-of-selection, Call ws_upload to upload the file (the excel file needs to be saved as TAB separated).

5.2 After the open-group, Loop on the uploaded data. For each line, perform validation checks on the data, then modify the perform bdc_field commands to use the file data.

5.3. After perform bdc_transaction, add the endloop.

Execute the program. It will have options to create a batch session or to process directly.

Following documents would give u some brief idea on Batch Data communication :

http://help.sap.com/saphelp_erp2005/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm

Check this link.You can find lot of information about BDC with examples.

http://www.sap-img.com/abap.htm

for more details see the above links given...

http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

http://www.sap-img.com/bdc.htm

http://www.utdallas.edu/~lnwang/homepage/project/bdc.pdf

http://help.sap.com/saphelp_nw04/helpdata/en/fa/09715a543b11d1898e0000e8322d00/frameset.htm

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://help.sap.com/saphelp_nw04/helpdata/en/69/c2501a4ba111d189750000e8322d00/frameset.htm

<b>Please reward the helpful entries.</b>

Regards,

Raman.