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: 

bdc for deletion of operation CA02

Former Member
0 Kudos

Hi,

I am working on bdc for the tcode CA02 in which i want to delete the operations such as 10,20,11,21,25,35,45 and 45. the problem is this when i execute it it selects all the operations which were there in the recording (mentioned above) and i want to select only thoes operations(among the above metioned ) which are present for the material routing.

plzz provide me guidelines for it.

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

END OF RECORD.

PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME.

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

7 REPLIES 7

Former Member
0 Kudos

You have not passed the values for cell selection.So its taking the same values that were selected at recording.

perform bdc_field using 'RC27X-FLG_SEL(10)'               " Change the numbers in the bracket
'X'.
perform bdc_field using 'RC27X-FLG_SEL(20)'               " Change the numbers in the bracket
'X'.

regards,

Gurpreet

0 Kudos

hi,

i had tried to do it ,but it is not working,please provide me guidelines to solve this problem.

Edited by: ricx .s on Mar 30, 2009 7:05 AM

0 Kudos
FLG_SEL_003  is this field referring to operation for a material.

If yes use:

LOOP AT RECORD.
perform bdc_field using 'RC27X-FLG_SEL(record-flg_sel_003)'             
'X'
ENDLOOP.

Can you also tell where how are you getting the operation number(Table name).

regards,

Gurpreet

0 Kudos

Hi,

I am had modified the code as u had siad but it worked for once only and now i had tried to execute it is not working.

here's d code:-

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

The table name from where i am getting the operation no. is PLPO.

Please provide me guidelines to solve this problem.

0 Kudos
Data: w_matnr type matnr.
LOOP AT RECORD.
IF w_matnr ne record-matnr.
If sy-tabix Gt 1.
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'.
CLEAR BDC_DATA.                              " Clear BDC TABLE
ENDIF.

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

ELSE.

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

ENDIF.

w_matnr = record-matnr.
ENDLOOP.

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

Try these codes and clear BDCTABLE after updation.

Regards,

Gurpreet

0 Kudos

HI,

U said clear BDCTABLE but i had not used that table.

0 Kudos

You need to clear the internal table that is being use in call transaction fro uploading BDC data.

After every call transaction statement.

Ex:

Call Transaction 'XXX' using BDCDATA.

Clear BDCDATA.

Regards,

gurpreet