Skip to Content
0
Former Member
Jun 07, 2013 at 01:15 PM

Delete KNVD entries with Change History

283 Views

Hello Experts,

I need to delete KNVD entries based on some Output Type and need to maintain the Change History.

I've checked the field properties of KNVD and found out Change Document is switched on for NA_KSCHL. So BDC will work.

The issue with BDC recording is it selects the record by line number. Here's the BDC code:

perform bdc_dynpro using 'SAPMF02D' '0101'.

perform bdc_field using 'BDC_CURSOR' 'RF02D-D0326'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'RF02D-KUNNR' '000300-001'.

perform bdc_field using 'RF02D-VKORG' 'V001'.

perform bdc_field using 'RF02D-VTWEG' 'V1'.

perform bdc_field using 'RF02D-SPART' 'V1'.

perform bdc_field using 'USE_ZAV' 'X'.

perform bdc_field using 'RF02D-D0326' 'X'.

perform bdc_dynpro using 'SAPMF02D' '0326'.

perform bdc_field using 'BDC_CURSOR' 'KNVD-DOCTP(01)'.

perform bdc_field using 'BDC_OKCODE' '=LDEL'.

perform bdc_dynpro using 'SAPMF02D' '0326'.

perform bdc_field using 'BDC_CURSOR' 'RF02D-KUNNR'.

perform bdc_field using 'BDC_OKCODE' '=UPDA'.

perform bdc_transaction using 'XD02'.

KNVD-DOCTP(01) : Here, how can we pass random line number? I want to select only those records wherein DOCTP = 'ZXY'.

I thought of using 'Search' button ; but it is disabled. 😔

Is there any BAPI to update KNVD entries that also maintains Change History (CDHDR / CDPOS)?

Or how can I solve the line number issue in my above BDC code?

Please do help.

Thanks & Regards,

Sowmya