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: 

Creating BOM using BDC :How to display no of records from flat file under

Former Member
0 Kudos

Hi,

How to display no of records from flat file under one (Alternative BOM) vertically.

When i execute, the records are replacing one by one.

Here my coding:

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(18),

MENGE(18),

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),

posnr(4),

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

BDCDATA-IDNRK.

perform bdc_field using 'RC29P-MENGE(01)'

BDCDATA-MENGE.

perform bdc_field using 'RC29P-MEINS(01)'

BDCDATA-MEINS.

perform bdc_field using 'RC29P-POSTP(01)'

BDCDATA-POSTP.

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'

BDCDATA-POSNR. "'0010'.

perform bdc_field using 'RC29P-IDNRK'

BDCDATA-IDNRK. "'15'.

perform bdc_field using 'RC29P-MENGE'

BDCDATA-MENGE. "'1'.

perform bdc_field using 'RC29P-MEINS'

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

ENDFORM.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Use Clear IBDCDATA.

After REFRESH IBDCDATA.

0 Kudos

Hi Bala,

Same thing i m getting after typing,

REFRESH IBDCDATA.

CLEAR IBDCDATA

endloop.

Do tell me any other soln.

0 Kudos

Hi,

the BDCDATA structure must be fnam, fval,dynbegin,dynpro,program.

You have to declare like this and pass this in your CALL TRANSACTION statement.

Please give some other table name for BDCDATA you declared for and also for IBDCDATA.