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: 

problem in bdc ca02

Former Member
0 Kudos

Hi,

i am working on bdc for the deletion of the operations of a material i.e. 11,21,15,25,35,45,55. i had posted a post before and i got some awnser but itried it and it didn't work. i wan to delete the operations but it is deleting only those which are recorded. i had tried to modify the code but it is not selecting the specified liens in the file. plz provide me guidelines to solve this problem.

here's d code:-

report ZNEW02

no standard page heading line-size 255.

include bdcrecx1.

data: begin of record OCCURS 0,

MATNR_001(018),

WERKS_002(004),

FLG_SEL_003(010),

end of record.

PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME default'C:\Users\Administrator\Desktop\CA02(UPLOAD).txt'.

initialization.

CTUMODE = 'A'.

CUPDATE = 'A'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

MASK = ',. '

MODE = 'O'

IMPORTING

FILENAME = P_FILNAM

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

start-of-selection.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = P_FILNAM

FILETYPE = 'DAT'

TABLES

DATA_TAB = RECORD

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

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

ON CHANGE OF RECORD-MATNR_001.

perform bdc_dynpro using 'SAPLCPDI' '1010'.

perform bdc_field using 'BDC_CURSOR'

'RC271-PLNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC27M-MATNR'

record-MATNR_001.

perform bdc_field using 'RC27M-WERKS'

record-WERKS_002.

perform bdc_dynpro using 'SAPLCPDI' '1400'.

perform bdc_field using 'BDC_CURSOR'

'PLPOD-VORNR(12)'.

perform bdc_field using 'BDC_OKCODE'

'=LOE'.

perform bdc_field using 'RC27X-ENTRY_ACT'

'1'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(record-FLG_SEL_003)'

'X'.

perform bdc_dynpro using 'SAPLSPO1' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_dynpro using 'SAPLCPDI' '1400'.

perform bdc_field using 'BDC_CURSOR'

'RC27X-ENTRY_ACT'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'RC27X-ENTRY_ACT'

'1'.

perform bdc_transaction using 'CA02'.

ENDON.

ENDLOOP.

4 REPLIES 4

Former Member
0 Kudos

Hi,

First step is, get the PLNNR (Key for Task List Group) from MAPL for the given material and LOEKZ ne 'X'.

after getting the PLNNR, write a INNER JOIN on PLAS and PLPO to get the position of the Operation Number (VORNR), in CA02. get the entries where PLPO-LOEKZ NE 'X' and Operaion (VORNR) as you required.

Now, you loop the JOIN table and delete one by one operation by passing the PLAS-PLNKN as the operation selection flag (sel_flag).

Hope it helps!!

let me know for any clarifications!!

Regards,

Pavan

0 Kudos

hi,

is it possible to do little modification in the above code rahter than using the inner joins or other itab.

0 Kudos

Hi,

Could you let me know how your input will be?

would it be only for one material or for multiple materials??

Regards,

Pavan

0 Kudos

Hi,

What i want to do is ,i have to delete the previous operations which are present in the item id's and i want to insert new operations among the different materials in CA02. i am having a BDC which allows me to insert new operations for the items but the problem is i have to remove the existing operations in some materials.

I had performed the recording and when i had done modifications in the code it is selecting only those which i had done in recording,but when i don't mention the any of the operation id in the txt fiel it is selecting the operation.

*plzz provide me guidelines to solve this problem. *

my format of the file is :-

221925 MFPL PAT 0011 QP02 First Pc Inspection For Turning

and the code which i am using right now:-

report ZNEW02

no standard page heading line-size 255.

include bdcrecx1.

data: begin of record OCCURS 0,

MATNR_001(018),

WERKS_002(004),

end of record.

PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME default 'C:\Users\Administrator\Desktop\CA02(UPLOAD).txt'.

initialization.

CTUMODE = 'A'.

CUPDATE = 'A'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

MASK = ',. '

MODE = 'O'

IMPORTING

FILENAME = P_FILNAM

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

start-of-selection.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = P_FILNAM

FILETYPE = 'DAT'

TABLES

DATA_TAB = RECORD

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

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

ON CHANGE OF RECORD-MATNR_001.

perform bdc_dynpro using 'SAPLCPDI' '1010'.

perform bdc_field using 'BDC_CURSOR'

'RC271-PLNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC27M-MATNR'

record-MATNR_001.

perform bdc_field using 'RC27M-WERKS'

record-WERKS_002.

*perform bdc_field using 'RC271-PLNNR'

  • ''.

*perform bdc_field using 'RC271-STTAG'

  • '28.03.2009'.

*perform bdc_field using 'RC271-PLNAL'

  • ''.

perform bdc_dynpro using 'SAPLCPDI' '1400'.

perform bdc_field using 'BDC_CURSOR'

'PLPOD-VORNR(12)'.

perform bdc_field using 'BDC_OKCODE'

'=LOE'.

perform bdc_field using 'RC27X-ENTRY_ACT'

'1'.

perform bdc_field using 'RC27X-FLG_SEL(02)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(03)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(05)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(06)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(08)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(10)'

'X'.

perform bdc_field using 'RC27X-FLG_SEL(12)'

'X'.

perform bdc_dynpro using 'SAPLSPO1' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_dynpro using 'SAPLCPDI' '1400'.

perform bdc_field using 'BDC_CURSOR'

'RC27X-ENTRY_ACT'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'RC27X-ENTRY_ACT'

'1'.

perform bdc_transaction using 'CA02'.

ENDON.

ENDLOOP.

Edited by: ricx .s on Mar 31, 2009 10:47 AM