Application Development and Automation 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: 
Read only

URGENT, bdc uploaded wrong data

Former Member
0 Likes
673

Dear all SAP-ABAP consulatants,

i would request you people to kindly help me out from my scenario.

i need to delete records from transaction 'cs02' , where in by validating the field so that it wont delete the existing records.

the fields are matnr,werks,stlan,idnrk,meng,meins,postp

From all d fields above i need to delete the record for field stlan,idnkr meng,meins &postp.

MY BDC ISNT WORKING IN A PROPER MANNER ITS DELETING ALL D RECORDS FOR DIFFERENT MATERIAL NUMBERS.

ths code is

report Z_PP_BOM_DEL_SCRAP

no standard page heading line-size 255.

include bdcrecx1.

start-of-selection.

data:begin of it_data occurs 0,

matnr(18), "Material

  • idnrk(18), "Component

end of it_data.

Parameters:p_file type IBIPPARMS-PATH.

data:p1_file type string.

at selection-screen on value-request for p_file.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = p_file

.

start-of-selection.

p1_file = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = p1_file

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 = it_data.

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

Refresh bdcdata.

perform pro_data.

endloop.

perform close_group.

form pro_data.

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'

it_data-matnr. "'S_HIFUH2A1A1A1A-02'.

perform bdc_field using 'RC29N-WERKS'

'sm01'.

perform bdc_field using 'RC29N-STLAN'

'1'.

perform bdc_field using 'RC29N-DATUV'

'28.11.2007'.

perform bdc_dynpro using 'SAPLCSDI' '0150'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR(01)'.

perform bdc_field using 'BDC_OKCODE'

'=SETP'.

perform bdc_dynpro using 'SAPLCSDI' '0708'.

perform bdc_field using 'BDC_OKCODE'

'=CLWI'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-SELID'.

perform bdc_field using 'RC29P-SELID'

'scrap100002'.

perform bdc_dynpro using 'SAPLCSDI' '0150'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-AUSKZ(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FCDL'.

perform bdc_field using 'RC29P-AUSKZ(01)'

'X'.

*if sy-subrc <> 0.

perform bdc_dynpro using 'SAPLCSDI' '0150'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

*endif.

perform bdc_transaction using 'CS02'.

endform.

3 REPLIES 3
Read only

Former Member
0 Likes
624

Hi Santosh.

According to ur requirement,are u going to delete a particular record after validating???Please let me know the exact requirement so that i will try to solve ur prob...

If u wanna del particular record for the material number u have to give the condition before the loop of BDC..

regards,

sandeep.

Read only

0 Likes
624

Thanks for the reply sandeep, actually wt happen is by mistake I have uploaded wrong line item for the material in my first BDC so I have to delete those records that is the line items which were entered wrong.

the fieds of the line items are IDNRK,meng, meins & postp.

I am able to delete the records using the program I have posted but the problem is if that particular line item(which I need to delete) is not available in that material the BDC stuck saying the line item not found or else its deleting some other line item which is not right .

so I need some help in writing the logic to this BDC so that it only deletes the required line items and if not found it has to go to the next material.

Thanks for your time and appreciate your help

Read only

0 Likes
624

Hi Santosh,

After ur reply wat i felt is better u retrieve the data from Database into a internal table...u will get all the data including wrong data....then use the transaction for changing the current one i think it CS02 which ur using....pass that internal table to bdc...but plz validate the data b4 passing to bdc...