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: 

code to display flatfile records vertically under 1 alternative BOM use BDC

Former Member
0 Kudos

Hi,

I m trying to display flat file entire(i.e.. 4 rec's i m using) records vertically under one (Alternative BOM) for CS01-BOM using BDC recording method.

Now i m tried with the following code,i m getting as one (Alternative BOM) for one ff record,by replacing one by one.

But i want as vertically under one (Alternative BOM).

Can anyone help me to overcome this.

report ZBOM

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

posnr(4),

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

BDCDATA-IDNRK.

perform bdc_field using 'RC29P-MENGE(001)'

BDCDATA-MENGE.

perform bdc_field using 'RC29P-MEINS(001)'

BDCDATA-MEINS.

perform bdc_field using 'RC29P-POSTP(001)'

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.

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

1 REPLY 1

Former Member
0 Kudos

Hi Dilip,

Please change your code.

I request you to please go through BDC tutorials before even starting to write the program.

There are many online tutorials which can help you with.

Also, search in SDN.. there you will get more than thousand results.. with the search term BDC.

Take this suggestion seriously before nayone reports the moderators that u have been posting this thread daily without taking into consideration the previous replies.

Regards,

Vishwa.