Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

problem uploding flatfile in bom(cs01) using bdc recording

Hi,

I had a problem while uploading flatfile records in bom(cs01) by using bdc recording.

I had four records in flatfile(.txt & xl), i.e., header data with its components.

Sample material:

(Header data) (components)

SOFTDRINKS,WIND,1, ' 14','1','ml','l'

SOFTDRINKS,WIND,1, '11','1','ml','l'

SOFTDRINKS,WIND,1, '13','1','ml','l'

SOFTDRINKS,WIND,1, ' 15','1','ml','l'

while executing, the same component entered while recording has been displayed four times not the ff records.

So, i want to know whether whether ff structure is ok or not,

whether coding is correct or not?

report ZBOM1

no standard page heading line-size 255.

*include bdcrecx1.

DATA: BEGIN OF bdc OCCURS 0,

matnr(18),

werks(4),

stlan(1),

END OF BDC.

DATA: BEGIN OF BDC1 OCCURS 0,

idnrk(40),

MENGE(13),

MEINS(3),

postp(1),

END OF bdc1.

DATA: BEGIN OF BDCDATA OCCURS 0,

matnr(18),

werks(4),

stlan(1),

idnrk(18),

MENGE(18),

MEINS(3),

postp(1),

END OF BDCDATA.

data: ibdcdata type standard table of bdcdata with header line.

*start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = ','

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = BDCDATA

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

*perform open_group.

loop at bdcdata.

perform bdc_dynpro using 'SAPLCSDI' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RC29N-STLAN'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29N-MATNR'

'SOFTDRINKS'.

perform bdc_field using 'RC29N-WERKS'

'WIND'.

perform bdc_field using 'RC29N-STLAN'

'1'.

perform bdc_field using 'RC29N-DATUV'

'16.09.2008'.

perform bdc_dynpro using 'SAPLCSDI' '0110'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29K-BMENG'

'1'.

perform bdc_field using 'RC29K-STLST'

'1'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-EXSTL'.

perform bdc_dynpro using 'SAPLCSDI' '0111'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-LABOR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSTP(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

perform bdc_field using 'RC29P-IDNRK(01)'

'11'.

perform bdc_field using 'RC29P-MENGE(01)'

'1'.

perform bdc_field using 'RC29P-MEINS(01)'

'ml'.

perform bdc_field using 'RC29P-POSTP(01)'

'l'.

perform bdc_dynpro using 'SAPLCSDI' '0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR'.

perform bdc_field using 'RC29P-POSNR'

'0010'.

perform bdc_field using 'RC29P-IDNRK'

'11'.

perform bdc_field using 'RC29P-MENGE'

'1'.

perform bdc_field using 'RC29P-MEINS'

'ML'.

perform bdc_dynpro using 'SAPLCSDI' '0131'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POTX1'.

perform bdc_field using 'RC29P-SANKA'

'X'.

*perform bdc_transaction using 'CS01'.

*perform close_group.

CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.

REFRESH IBDCDATA.

endloop.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR iBDCDATA.

iBDCDATA-PROGRAM = PROGRAM.

iBDCDATA-DYNPRO = DYNPRO.

iBDCDATA-DYNBEGIN = 'X'.

APPEND ibDCDATA .

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

  • IF FVAL <> NODATA.

CLEAR iBDCDATA.

iBDCDATA-FNAM = FNAM.

iBDCDATA-FVAL = FVAL.

APPEND iBDCDATA .

  • ENDIF.

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question