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: 

reg: BOM using BDC - uploading records from excel

Former Member
0 Kudos

Hi,

I m doing sample BOM for already created material,in that i m uploading four records from excel or notepad using BDC recording.

While executing the records are not uploading,only the record which i record s entering for four times.

So, please clear this.

Code:

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.

10 REPLIES 10

former_member70391
Contributor
0 Kudos

Hi Dilip,

Where did you pass your internal table value to perform statement. You just looped at BDCDATA but have not passed data to screen.

Example:

perform bdc_field using 'RC29P-POSNR'

'0010'.

You suppose to pass say.

perform bdc_field using 'RC29P-POSNR'

BDCDATA-POSNR.

Thanks & Regards,

Nagaraj Kalbavi

0 Kudos

Hi Nagaraj,

thanks for ur soln.

I changed as u specified, but while executing the records from flat file is replacing one by one for different (Alternative BOM).

I want to display all the four records in flat file should be displayed or entered in the single (Alternative BOM).

So please any bodygive me a soln,it will be useful for me.

0 Kudos

HI Dilip,

I just looked at your code and found that in this portion

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

You are passing data on first line item so when the table is looping it will replace the data on same line '01'. So you have to increase 01 based on the flat file record or while doing recording, after every entry of 01 click on create button so that it wil be created one by one in the next line.

Thanks & Regards,

Nagaraj Kalbavi

0 Kudos

Hi Nagaraj,

I want the structure for flat file.I think i structured wrongly thr flatfile.

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

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

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

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

Above (softdrinks,wind, - Header data) and (13,1,ml,l - Item data or components).

I had made changes in coding,please check this also.

Bcoz i m new to abap.

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

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(04)'.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

perform bdc_field using 'RC29P-IDNRK(04)'

BDCDATA-IDNRK.

perform bdc_field using 'RC29P-MENGE(04)'

BDCDATA-MENGE.

perform bdc_field using 'RC29P-MEINS(04)'

BDCDATA-MEINS.

perform bdc_field using 'RC29P-POSTP(04)'

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.

perform bdc_field using 'RC29P-IDNRK'

'15'.

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.

ENDFORM.

0 Kudos

Hi Dilip,

First get the data from flat file that you already did into BDCDATA. Now you have table BDC right, so move MATNR, WERKS and STLNR from BDCDATA to BDC. So BDC will be a header data.

loop at bdcdata.

move bdcdata-matnr to bdc-matnr

- - - - - - - - -

- - - - - - - -

Append BDC.

endloop.

Loop at BDC.

First pass the header that you already did and after that during item data do the following steps.

data: FIELD(11) type c ,

INDX type string,

FINAL(17) type c.

loop at bdcdata where matnr eq bdc-matnr

and werks eq bdc-werks

and stlnr eq bdc-stlnr.

field = 'RC29P-POSTP'.

indx = '01'.

concatenate field '(' INDX ')' into FINAL .

perform bdc_field using 'BDC_CURSOR'

FINAL.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

  • then increase INDX and clear FIELD and FINAL.

  • Do the same steps for other fields as well.

ENDLOOP.

call transaction 'CS01'.

endloop.

0 Kudos

Hi Naga,

Thanks for ur soln.

I m trying with it. If u dont mind tell me how to clear fields and final.

i m confused.

0 Kudos

Hi Dilip,

Once the below step is over,

field = 'RC29P-POSTP'.

indx = '01'.

concatenate field '(' INDX ')' into FINAL .

perform bdc_field using 'BDC_CURSOR'

FINAL.

Just put the command

CLEAR: FINAL, FIELD.

then pass new values.

Thanks & Regards,

Nagaraj Kalbavi

0 Kudos

Hi Nagaraj,

I tried with ur suggestion,but i m not getting the req. result.

So can u check my coding once again.I dont know where i mistaken.

report ZBOM1

no standard page heading line-size 255.

*include bdcrecx1.

DATA: BEGIN OF header OCCURS 0,

matnr(18),

werks(4),

stlan(1),

END OF header.

DATA: BEGIN OF item OCCURS 0,

posnr(4),

idnrk(18),

MENGE(18),

MEINS(3),

postp(1),

END OF item.

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 = 'X'

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

LOOP AT bdcdata.

move bdcdata-matnr to header-matnr.

move bdcdata-werks to header-werks.

move bdcdata-stlan to header-stlan.

append header.

ENDLOOP.

*perform open_group.

loop at header.

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'

header-matnr.

perform bdc_field using 'RC29N-WERKS'

header-werks.

perform bdc_field using 'RC29N-STLAN'

header-stlan.

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

endloop.

data: field(11) type c,

indx(2) type c,

final(17) type c.

Loop at bdcdata where matnr eq header-matnr and

werks eq header-werks and

stlan eq header-stlan.

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.

0 Kudos

Hi Dilip,

Have a look into below code, But it may work differently in your system. Check the logic How I did. I did not uplaod as an example I created a append file.

report ZTEST_NAG

no standard page heading line-size 255.

include bdcrecx1.

DATA: BEGIN OF I_HEADER OCCURS 0,

MATNR LIKE RC29N-MATNR,

WERKS LIKE RC29N-WERKS,

STLAN LIKE RC29N-STLAN,

END OF I_HEADER.

DATA: BEGIN OF I_ITEM OCCURS 0,

MATNR LIKE RC29N-MATNR,

WERKS LIKE RC29N-WERKS,

STLAN LIKE RC29N-STLAN,

IDNRK LIKE RC29P-IDNRK,

MENGE TYPE C,

MEINS LIKE RC29P-MEINS,

POSTP LIKE RC29P-POSTP,

END OF I_ITEM.

start-of-selection.

I_HEADER-MATNR = 'MYSAP.COM'.

I_HEADER-WERKS = '3161'.

I_HEADER-STLAN = '5'.

APPEND I_HEADER.

I_ITEM-MATNR = 'MYSAP.COM'.

I_ITEM-WERKS = '3161'.

I_ITEM-STLAN = '5'.

I_ITEM-IDNRK = '7001127'.

I_ITEM-MENGE = '1'.

I_ITEM-MEINS = 'USR'.

I_ITEM-POSTP = 'N'.

APPEND I_ITEM.

I_ITEM-MATNR = 'MYSAP.COM'.

I_ITEM-WERKS = '3161'.

I_ITEM-STLAN = '5'.

I_ITEM-IDNRK = '7001126'.

I_ITEM-MENGE = '1'.

I_ITEM-MEINS = 'USR'.

I_ITEM-POSTP = 'N'.

APPEND I_ITEM.

I_ITEM-MATNR = 'MYSAP.COM'.

I_ITEM-WERKS = '3161'.

I_ITEM-STLAN = '5'.

I_ITEM-IDNRK = '7001128'.

I_ITEM-MENGE = '1'.

I_ITEM-MEINS = 'PC'.

I_ITEM-POSTP = 'N'.

APPEND I_ITEM.

perform open_group.

*HEADER LOOP

LOOP AT I_HEADER.

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'

I_HEADER-MATNR.

perform bdc_field using 'RC29N-WERKS'

I_HEADER-WERKS.

perform bdc_field using 'RC29N-STLAN'

I_HEADER-STLAN.

perform bdc_field using 'RC29N-DATUV'

'19.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_field using 'RC29K-LABOR'

'027'.

  • Looping at Item data with PositionIncrement

Data: POSNR(4) TYPE C.

POSNR = '0010'.

LOOP AT I_ITEM WHERE MATNR EQ I_HEADER-MATNR

AND WERKS EQ I_HEADER-WERKS

AND STLAN EQ I_HEADER-STLAN.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

POSNR.

perform bdc_field using 'BDC_OKCODE'

'=FCNP'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSTP(02)'.

perform bdc_field using 'BDC_OKCODE'

'=FCNP'.

perform bdc_field using 'RC29P-IDNRK(02)'

I_ITEM-IDNRK.

perform bdc_field using 'RC29P-MENGE(02)'

I_ITEM-MENGE.

perform bdc_field using 'RC29P-MEINS(02)'

I_ITEM-MEINS.

perform bdc_field using 'RC29P-POSTP(02)'

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

POSNR.

perform bdc_field using 'RC29P-IDNRK'

I_ITEM-IDNRK.

perform bdc_field using 'RC29P-MENGE'

I_ITEM-MENGE.

perform bdc_field using 'RC29P-MEINS'

I_ITEM-MEINS.

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

'X'.

perform bdc_dynpro using 'SAPLCSDI' '0133'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-EKORG'.

perform bdc_field using 'RC29P-MATKL'

'ZV01'.

  • iNCREAMETING posnr BY 0010

POSNR = POSNR + '0010'.

ENDLOOP.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR(02)'.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

perform bdc_transaction using 'CS01'.

ENDLOOP.

perform close_group.

Thanks & Regards,

Nagaraj Kalbavi

0 Kudos

Hi Naga,

Thankkkss. This time i clearly understand the logic.

I try with it this time and come back to u.