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

BDC code - Delete Customer Fax number

Former Member
0 Likes
3,096

Hello Experts,

I'm using BDC code to delete the Fax number of Customer (table KNA1 / ADRC) - Field TELFX.

But it is not deleting the Fax number.

The same code is working for 'Change / Add' operations but not 'Delete'.

Here's my code:

PERFORM bdc_dynpro      USING 'SAPMF02D' '0101'.

  PERFORM bdc_field       USING 'BDC_CURSOR'

                                'RF02D-D0110'.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                '/00'.

  PERFORM bdc_field       USING 'RF02D-KUNNR'

                                p_kunnr.

  PERFORM bdc_field       USING 'RF02D-D0110'

                                'X'.

  PERFORM bdc_dynpro      USING 'SAPMF02D' '0110'.

  PERFORM bdc_field       USING 'BDC_CURSOR'

                                'KNA1-TELFX'.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.

  PERFORM bdc_field       USING 'KNA1-TELFX'

                                ' '.

    test-dismode = 'N'.

  test-updmode = 'S'.

 

  CALL TRANSACTION 'XD02' USING g_t_bdcdata OPTIONS FROM test

  MESSAGES INTO tab_mess AND SKIP FIRST SCREEN .

Please do let me know why DELETE is not working.

Please help.

Thanks & Regards,
Sowmya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,993

Hello Experts,

It's not working now

I don't understand why

Here's my BDC Code:

PERFORM bdc_dynpro      USING 'SAPMF02D' '0101'.

  PERFORM bdc_field       USING 'BDC_CURSOR'

                                'RF02D-D0110'.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                '/00'.

  PERFORM bdc_field       USING 'RF02D-KUNNR'

                                p_g_wa_custfax_kunnr.

  PERFORM bdc_field       USING 'RF02D-D0110'

                                'X'.

  PERFORM bdc_dynpro      USING 'SAPMF02D' '0110'.

  PERFORM bdc_field USING 'SZA1_D0100-FAX_NUMBER'  ' '.

*  PERFORM bdc_field USING 'SZA1_D0100-FAX_EXTENS'  ' '.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                  '=UPDA'.

  test-dismode = 'N'.

  test-updmode = 'S'.

  CALL TRANSACTION 'XD02' USING g_t_bdcdata OPTIONS FROM test

  MESSAGES INTO tab_mess.

Even with

PERFORM bdc_field USING 'SZA1_D0100-FAX_EXTENS'  ' '.

it is not working now.

Please help.

-Sowmya

Hello Experts,

I'm using BDC code to delete the Fax number of Customer (table KNA1 / ADRC) - Field TELFX.

But it is not deleting the Fax number.

The same code is working for 'Change / Add' operations but not 'Delete'.

Here's my code:

PERFORM bdc_dynpro      USING 'SAPMF02D' '0101'.

  PERFORM bdc_field       USING 'BDC_CURSOR'

                                'RF02D-D0110'.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                '/00'.

  PERFORM bdc_field       USING 'RF02D-KUNNR'

                                p_kunnr.

  PERFORM bdc_field       USING 'RF02D-D0110'

                                'X'.

  PERFORM bdc_dynpro      USING 'SAPMF02D' '0110'.

  PERFORM bdc_field       USING 'BDC_CURSOR'

                                'KNA1-TELFX'.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.

  PERFORM bdc_field       USING 'KNA1-TELFX'

                                ' '.

    test-dismode = 'N'.

  test-updmode = 'S'.

 

  CALL TRANSACTION 'XD02' USING g_t_bdcdata OPTIONS FROM test

  MESSAGES INTO tab_mess AND SKIP FIRST SCREEN .

Please do let me know why DELETE is not working.

Please help.

Thanks & Regards,
Sowmya

36 REPLIES 36
Read only

Former Member
0 Likes
2,993

Hi,

Use this

  PERFORM bdc_field       USING 'KNA1-TELFX'

                                ' '.

PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.

Instead of

PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.

  PERFORM bdc_field       USING 'KNA1-TELFX'

                                ' '.


Read only

0 Likes
2,993

Hi Rahul,

I tried as per your suggestion.

It is still not working.

Thanks & Regards,
Sowmya

Read only

0 Likes
2,993

Hi,

Try to run this report in mode 'A' (instead of 'N') to see what's going on.

My first shot would be that transaction is calling commit work twice (when you run bdc after first commit transaction ends). If that's the case then use addition OPTIONS FROM and set in field RACOMMIT value 'X'.

Best Regards

Marcin Cholewczuk

Read only

0 Likes
2,993

Hi Marcin,


Thanks for the reply.

I checked by changing the mode to 'A'. It just saves by setting Fax number = ' '.

But when I go and see using XD03, it has not deleted the Fax number.

I also tried RACOMMIT = 'X' as per your suggestion. But still it's not working.

Thanks & Regards,
Sowmya

Read only

0 Likes
2,993

The best way is to do a small recording for the same via SHD and then compare the existing code with the new program and just replace the code sequence of deletion of tel number with new code.

Read only

0 Likes
2,993

Rahul,

This code is taken from SHDB recording itself.

-Sowmya

Read only

0 Likes
2,993

Dear Sowmya,

What happen if you run the recording in test mode ? Does this delete this fax Number or not.

Regards,

Rahul

Read only

0 Likes
2,993

Hi Rahul,

In test mode, it is deleting the fax.

-Sowmya

Read only

0 Likes
2,993

This means the error is in your code. Try to debug the same and run the program in foreground i hope this could be the error where "Screen field KNA1-TELFX does not exist" .This is my assumption .

Better to debug the same.

Read only

former_member193464
Contributor
0 Likes
2,993

try giving default size in your options as blank.....
test-defsize = space.

Read only

0 Likes
2,993

I tried giving test-defsize = space.

It's not deleting the fax number.

-Sowmya

Read only

0 Likes
2,993

delete that line AND SKIP FIRST SCREEN.

Read only

0 Likes
2,993

I removed the line AND SKIP FIRST SCREEN. Still not working.

Read only

0 Likes
2,993

PERFORM bdc_dynpro      USING 'SAPMF02D' '0401'.

PERFORM bdc_field       USING 'BDC_CURSOR'

                                'KNA1-TELFX'.

PERFORM bdc_field       USING 'KNA1-TELFX'

                                ' '.

PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.

please try above code i think it will solve your query

Read only

0 Likes
2,993

try giving a value like 'test' in KNA1-TELFX....

see if it updates a value... looks like it is not updating a blank value....

Read only

0 Likes
2,993

Hi Gaurav,

The above code is not working.

-Sowmya

Read only

0 Likes
2,993

Hi Maverick,

If I give any test value like '12345', then it is updating. If I give ' ' (space), then it doesn't.

So, BDC doesn't work here?

Thanks & Regards,

Sowmya

Read only

0 Likes
2,993

try to use

PERFORM bdc_field       USING 'KNA1-TELFX'

                                space.

or

PERFORM bdc_field       USING 'KNA1-TELFX'

                                '  '.

Read only

0 Likes
2,993

I tried both space and ' '. It's not deleting Fax number

Read only

0 Likes
2,993

afraid so... if you reiterate your recording steps , and save you will definitely see that the blank value was not saved in KNA1... so not a problem in BDC , the values are not changing in recording too....
may be you need to find a BAPI(something like BAPI_CUSTOMER_CHANGEFROMDATA or CHANGEFROMDATA1 (not sure if you can update the fax through this)) for modifying the address details of customer , there  you can set fax as blank.

OR
if your analyst is fine then you can put a 0 in the field...
Also can you change your recording inputs , like ticking the default size , and no batch input , and then do the recording and try to delete the fax number by that way ,(you need to change your program for that)  it will definitely work...

Message was edited by: Maverick Manoj

Read only

0 Likes
2,993

Hi Sowmya!

Im not sure, but does field 'TELFX' have any transitive dependency on another field?

Regards,

KS

Read only

0 Likes
2,993

PERFORM bdc_dynpro      USING 'SAPMF02D' '0401'.

PERFORM bdc_field       USING 'BDC_CURSOR'

                                'SZA1_D0100-FAX_NUMBER'.

PERFORM bdc_field USING 'SZA1_D0100-FAX_NUMBER'  ' '. 


PERFORM bdc_field USING 'SZA1_D0100-FAX_EXTENS'  ' '. 

PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.


Read only

0 Likes
2,993

Hi,

Try recording with ECATT and see if it works.

Regards,

Swarna

Read only

0 Likes
2,993

Thanks Gaurav.

It worked.

Read only

0 Likes
2,993

This message was moderated.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,993

Did you try to also erase the extension number

  PERFORM bdc_field USING 'SZA1_D0100-FAX_NUMBER'  ' '.

  PERFORM bdc_field USING 'SZA1_D0100-FAX_EXTENS'  ' '.

Regards,

Raymond

Read only

0 Likes
2,993

It's not working Raymond

Read only

Former Member
0 Likes
2,993

Kindly share the code of your original recording and current program.

Regards,

Rahul

Read only

Former Member
0 Likes
2,993

You need to change the recording.

In first screen of XD02, check checkbox 'Use central address management'.

Your code would then be something like this.

PERFORM bdc_dynpro      USING 'SAPMF02D' '0101'.
PERFORM bdc_field       USING 'BDC_OKCODE'
                               '/00'.
PERFORM bdc_field       USING 'RF02D-KUNNR'
                               p_kunnr.
PERFORM bdc_field       USING 'RF02D-D0110'
                               'X'.
PERFORM bdc_field       USING 'USE_ZAV'
                               'X'.
PERFORM bdc_dynpro      USING 'SAPMF02D' '0111'.
PERFORM bdc_field       USING 'BDC_OKCODE'
                               '=UPDA'.
PERFORM bdc_field       USING 'SZA1_D0100-FAX_NUMBER'
                               ''.
PERFORM bdc_transaction USING 'XD02'.

Read only

Former Member
0 Likes
2,994

Hello Experts,

It's not working now

I don't understand why

Here's my BDC Code:

PERFORM bdc_dynpro      USING 'SAPMF02D' '0101'.

  PERFORM bdc_field       USING 'BDC_CURSOR'

                                'RF02D-D0110'.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                '/00'.

  PERFORM bdc_field       USING 'RF02D-KUNNR'

                                p_g_wa_custfax_kunnr.

  PERFORM bdc_field       USING 'RF02D-D0110'

                                'X'.

  PERFORM bdc_dynpro      USING 'SAPMF02D' '0110'.

  PERFORM bdc_field USING 'SZA1_D0100-FAX_NUMBER'  ' '.

*  PERFORM bdc_field USING 'SZA1_D0100-FAX_EXTENS'  ' '.

  PERFORM bdc_field       USING 'BDC_OKCODE'

                                  '=UPDA'.

  test-dismode = 'N'.

  test-updmode = 'S'.

  CALL TRANSACTION 'XD02' USING g_t_bdcdata OPTIONS FROM test

  MESSAGES INTO tab_mess.

Even with

PERFORM bdc_field USING 'SZA1_D0100-FAX_EXTENS'  ' '.

it is not working now.

Please help.

-Sowmya

Read only

0 Likes
2,993

I thing you are using wrong screen  "SAPMF02D" '0111' instead of '0110'. Check !!!

Read only

0 Likes
2,993

Hi Rahul,

I changed the screen to 0110. Not working.

Read only

0 Likes
2,993

changed it to 0111 not to 0110.

Read only

0 Likes
2,993

Not working Rahul..

Read only

0 Likes
2,993

In order to understand why it is not working, create fresh BDC recording.

In first screen of XD02 where customer number is entered, check checkbox 'Use central address management'.

Read only

0 Likes
2,993

Thanks so much Manish..

At last it worked now.

Here's my code:

PERFORM bdc_dynpro      USING 'SAPMF02D' '0101'.

PERFORM bdc_field          USING 'BDC_CURSOR'

                                'USE_ZAV'.

PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field       USING 'RF02D-KUNNR'

                                p_g_wa_custfax_kunnr.

PERFORM bdc_field       USING 'RF02D-D0110'

                                'X'.

PERFORM bdc_field       USING 'USE_ZAV'

                                'X'.

PERFORM bdc_dynpro      USING 'SAPMF02D' '0111'.

PERFORM bdc_field       USING 'BDC_OKCODE'

                                '=UPDA'.

PERFORM bdc_field       USING 'BDC_CURSOR'

                                'SZA1_D0100-FAX_NUMBER'.

PERFORM bdc_field       USING 'SZA1_D0100-FAX_NUMBER'

                                ''.

PERFORM bdc_field       USING 'SZA1_D0100-FAX_EXTENS'

                                ''.