2006 Sep 07 3:47 PM
Hi,
My requirement is that whenever a new customer is created, the field KNB1-ALTKN should always be populated. How can I do this?
Thank You,
SB.
2006 Sep 07 4:02 PM
Hi
If you want to populate it automatically, you should use an user-exit (EXIT_SAPMF02D_001);
If you want to make sure user fill that field, you should make it mandatary.
Max
2006 Sep 07 3:55 PM
Hi SB,
You can use this FM <b>CUSTOMER_UPDATE</b> to update field KNB1-ALTKN.
Hope this will help.
Regards,
Ferry Lianto
2006 Sep 07 4:11 PM
Hi Ferry,
Thanks for your reply... can I know where I should you write this code... a new prg... or a sap-script ... or anything else...
Thank You,
SB.
2007 Oct 03 1:24 PM
Requirement -
01. In Create Customer Mode (XD01 & VD01) SAP should check whether the fields are filled in ZZKV_CUSNO & ZZKV_SEQNO are filled in. The expected behaviour is that SAP should not allow to Save a customer master in case the above is not filled.
02. In Change Customer Mode (xd02 & vd02), User exit should first check whether the user has got an authorisation to change this field, only then allow to change.
2006 Sep 07 4:00 PM
Hi SB,
try this:
take spro
goto define account groups with screen layout
select the group
select company code data
select Account management
set in Previous account number the button
than save
Regards, Dieter
2006 Sep 07 4:01 PM
Hi,
You need to make the field in traxn XK01->Companycode data->Account management->Reference data->Prev.acct.no mandatory in SPRO settings,then this will make the field mandatory,
Rgds,
2006 Sep 07 4:02 PM
Hi
If you want to populate it automatically, you should use an user-exit (EXIT_SAPMF02D_001);
If you want to make sure user fill that field, you should make it mandatary.
Max
2006 Sep 07 4:20 PM
Hi Max,
Yes this is what I want that once the user creats the customer... the feild ALTKN "Previous Account number" should be populated automatically... Can you please provide me with more guidenace on how to go forward with the exit EXIT_SAPMF02D_001...
Thanks a lot.
SB.
2006 Sep 07 4:40 PM
Hi SB
You have to create a project by trx CMOD to active the exit EXIT_SAPMF02D_001:
- Run CMODE
- Create a project
- Assign it the enhancement SAPMF02D
- Active your project and its component
Now you can insert abap code you need in fm EXIT_SAPMF02D_001 (by trx SE37).
For example:
FIELD-SYMBOLS: <FS_KNB1> TYPE KNB1.
DATA: C_KNB1(30) VALUE '(SAPMF02D)KNB1'.
IF SY-TCODE+3(1) = '1'. "It means user's creating a customer
ASSIGN (C_KNB1) TO <FS_KNB1>.
<FS_KNB1>-ALTKN = '......'.
ENDIF.
Here I use field-symbols because the exit doesn't allow to change data of KNB1.
Max
2006 Sep 07 5:09 PM
Hi Max,
I was able to find out that in CMOD there already exited a project which had the assingment of SAPMF02D.. & in the componenets it had the user exit EXIT_SAPMF02D_001 ... when I double click EXIT_SAPMF02D_001 ... I get a screen with INCLUDE ZXF04U01... & when I double click INCLUDE ZXF04U01 ... then here is the place where I have to make sure that the field ALTKN is automatically filled...
My query is that here when I see the project attributes the project status is inactive ... but when I see the components screen the function exit EXIT_SAPMF02D_001 ... shows a green check mark saying that it is already implemented... I do not understand this difference...
How can a project be inactive & it's component as implemented at the same time...
Please explain.
2006 Sep 07 5:36 PM
Hi
It means the project is inactive, that's all.
The component screen lists the project components and their status: implemented or not implemented.
The status of component is independent from the project status, but only means which components are used in the project.
Now u've to understand why it's inactive in your development system: check if it's active in production.
Perhaps someone is updating that project.
Max
2006 Sep 10 7:53 PM
Hi,
I got the right place where I need to write the user exit. Thanks to Max for this ... My requirement is that For feild ALTKN ... it should be automatically populate the last 7 digits of customer number... How should I code for this ... and what else should I keep in mind .. for e.g. is the customer locked by some other user ??... how or what should I code so that I can get the correct results ... and after that how can I test??... Any help please.
Thank You,
SB
2006 Sep 10 10:20 PM
Hi,
I am trying to create a customer. But I cannot find in which screen is Previous Account no. feild = ALTKN... can somebody tell me where to find it ??
Thank You,SB.
2006 Sep 10 10:30 PM
Hi
It's in the first tab of company data: Account Management, in Reference data section.
Max
2006 Sep 10 10:51 PM
Hi Max,
I have coded
i_knb1-altkn = i_kna1-kunnr+3(7).
inside the include ZXF04U01 ... so that whenever a customer is createdd or changed the field ALTKN is populate with the last 7 digit of the customer number ... What I have coded is it right ??... & if yes then how do I test it ??
Thank You,
SB.
2006 Sep 10 11:19 PM
Hi
Just as I said in a my previuos answer that exit doesn't allow to change the company data, I_KNB1 is IMPORT PARAMETER and it can't change the value of an import parameter, so you have to use a trick, try this piece of code:
DATA: V_FIELD(30) VALUE '(SAPMF02D)KNB1'.
FIELD-SYMBOLS: <KNB1> TYPE KNB1.
ASSIGN (V_FIELD) TO <KNB1>.
<KNB1>-ALTKN = I_KNA1-KUNNR+3(7).
Anyway remember: if the system assignes the customer number (so you don't use an external range), you can know the number of customer only after saving it, so that exit can work only when user's updating it.
Max
2006 Sep 11 2:41 AM
Ok... that means that when I use XD02 for the existing customer only then the last 7 digits of the customer should come up for the field ALTKN... Am I right ... ??
I tried it this way but it doesn't work ... how do I test it ??
2006 Sep 11 9:25 AM
Hi
What doesn't work? The abap code?
If it's so, you make sure:
- Project is active;
- Component is active;
- insert a break-point
In XD02 that exit is triggered only if a date is changed and after pressing SAVE.
I tried it in 4.7 and worked fine
Max
2006 Sep 12 7:44 PM
Hi Max,
I want the same thing to work once XD01 is saved... so that I can go & see in XD02 and see that ALTKN is correctly populated...
Any responses ... that I want populate the field ALTKN once saved in XD01.... Currently the logic is working.. but only when I save in XD02...
2006 Sep 07 4:20 PM
You can also change the screen attribute for the field ALTKN via SE51 for ABAP SAPMF02D and screen 210.
In that case you make the particular field as required, thereby the user have to enter the particular information.
Also, in the user_exit for customer you can check for the particular field and if it is blank throw an error message
Regards
Anurag
2006 Sep 07 4:26 PM
Hi SB,
It depends on your requirement.
You can create a custom program and call FM CUSTOMER_UPDATE to update field KNB1-ALTKN. This progam can be used to process mass update after customer master created and schedule to run over night.
Also you can use user exit EXIT_SAPMF02D_001 to update automatically as Max mentioned earlier.
Again, hope this will help.
Regards,
Ferry Lianto
Regards,
Ferry Lianto