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

XK02 screen values BDC problem

Former Member
0 Likes
2,400

Hello Friends,

I am performing a BDC recording on the transaction XK02 to update or change vendor details, which i will be using in a RFC enabled FM so that it can be called from a external system and change the vendor details.

The problem i am facing is that after recording the transaction through SHDB and changing the hardcoded screen values to the import parameters of the FM in the BDC coding, while executing, the already available vendor details such as name1, name2, city, region etc.. are getting cleared off if i dont enter the relevant import parameters.

Any pointers as to how to retain the already available vendor details while BDC recording execution in XK02?

Regards,

Vikranth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,863

HI Vikranth,

use this link.

Regards,

Vijay

10 REPLIES 10
Read only

Former Member
0 Likes
1,863

Fill you BDC table first and then pass the table to FM .

Read only

Former Member
0 Likes
1,864

HI Vikranth,

use this link.

Regards,

Vijay

Read only

GauthamV
Active Contributor
0 Likes
1,863

The screen values might have not been captured properly in recording.

Try recording again and check.

Read only

Former Member
0 Likes
1,863

Hi Gautham,

I did try recording 2 to 3 times. In order to capture all the fields in the BDC coding, i just enter some garbage values and clear them off for blank fields or set it to original values for non empty fields while recording. Does this has to do anything as to why the already available screen value are getting cleared off?

Read only

Former Member
0 Likes
1,863

when you perform recording a lot of fields captures. If you do not want to change these fields do not attach into the BDC table. This mean that it is not enough only to delete the value, you should not show these into your recording (BDC table). If this is not working, then try to pass the values again (create a copy of them), but this is not a nice looking programming or alternative use a BAPI to perform the modification to your master data. The BAPI is more secure way and protecting you from a lot of bad things that comes with the BDC.

With Regards

Giorgos

Read only

Former Member
0 Likes
1,863

Hi Vikranth,

As already mentioned previously if you dont want blank values , dont write the perform for that screen field.

If you are still not clear with the solution . Pls paste the code and someone will be able to guide you better.

TC

Sajimon Chandran

Read only

0 Likes
1,863

Hi Sajimon/Asha,

The fields for which i dont want blank values is dynamic. For eg, for one vendor the name1 might be avaliable and i have to update name 2. For another vendor name 1 and name2 may already be maintained and i have to update the city. Thats the reason why am trying to capture all the fields. Am also sending the sample code am using



perform bdc_dynpro      using 'SAPMF02K' '0101'.
perform bdc_field       using 'BDC_CURSOR'
                              'USE_ZAV'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF02K-LIFNR'
                               wa_vend-lifnr.
perform bdc_field       using 'RF02K-D0110'
                               wa_addr.
perform bdc_field       using 'RF02K-D0120'
                               wa_con.
perform bdc_field       using 'RF02K-D0130'
                               wa_pay.
perform bdc_field       using 'RF02K-D0210'
                               wa_acct.

perform bdc_field       using 'USE_ZAV'
                              'X'.
perform bdc_dynpro      using 'SAPMF02K' '0111'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BDC_CURSOR'
                              'ADDR1_DATA-REMARK'.
perform bdc_field       using 'ADDR1_DATA-NAME1'
                               wa_vend-name1.
perform bdc_field       using 'ADDR1_DATA-NAME2'
                               wa_vend-name2.
perform bdc_field       using 'ADDR1_DATA-NAME3'
                               wa_vend-name3.
perform bdc_field       using 'ADDR1_DATA-NAME4'
                               wa_vend-name4.
perform bdc_field       using 'ADDR1_DATA-SORT1'
                               wa_vend-sortl.
perform bdc_field       using 'ADDR1_DATA-SORT2'
                              ''.
perform bdc_field       using 'ADDR1_DATA-STR_SUPPL1'
                                 wa_str_suppl1.

 call transaction 'XK02' using t_bdcdata    mode          c_mode
                                            update           c_update
                                          messages  into   t_errtrans.

Read only

Former Member
0 Likes
1,863

Hi,

As per my understanding you need to change some vendor details(excluding few details like Name1, Name2, city) and all.

If you dont want to change those details, better dont use those fields while doing BDC recording. Similarly, do not inlcude any export parameters related to these fields to the FM.

I guess this will help you in retaining these values.

Thanks,

Asha

Read only

Former Member
0 Likes
1,863

Hi,

Fine.. Now.. i got a little better understanding of your requirement...

As per your code now... you are directly giving the following piece of code:

perform bdc_field using 'ADDR1_DATA-NAME1'

wa_vend-name1.

perform bdc_field using 'ADDR1_DATA-NAME2'

wa_vend-name2.

if you use these, then in the case of a vendor that has already some values for NAME1 and NAME2 -> then when ur program executes these lines, since there are no values maintained in WA_VEND-NAME1 and WA_VEND-NAME2.. so only its giving a blank...

so, as per me.... the solution lies in the usage of simple IF.. ENDIF statements...

First check if any value is maintained for these fields of a particular vendor in the database table (Use select queries and read).

if values are there, ignore, these above statements... else.. execute these statements.

let me know if you have any doubts.

thanks,

Asha

Read only

0 Likes
1,863

Hi Asha,

Thats a better idea which dint click for me. I will make a try and check if it works.

Regards,

Vikranth