cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to make an add-on run AUTOMATICALLY when a user logs in to SAP B1?

leon_laikan
Participant
0 Kudos

Hi, everybody

Please see the attached picture which explains what I want to do.

capture.jpg

Any help, ideas, or suggestions are most welcome.

Thanks

Leon Lai

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor

Hi Leon,

Definitely, You can even set the addon as mandatory.

On the other hand, why don't you set this value each time before your application needs to post this negative amount ?
You can use the property in the AdminInfo.
Do note that user authorization is required to access this.

Regards

Edy

leon_laikan
Participant
0 Kudos

Hi, Edy

Thanks a lot for your very helpful answer.

If I give you more details about my problem, you may help me even more.

So...

In my company, for legal and other reasons, we post all Sales Invoices to the foreign Customer's Account (all our sales are exports. We are not allowed to sell locally.)

But it is not the foreign customer who pays.Rather it's his local agent. So, we must then do a Journal Entry to transfer the Sales Invoice from the foreign customer to his Local Agents' account.

We have developed a VB.NET add-on to do the transfers and then reconcile the Customer's Account (BP Internal Reconciliation). Everything works fine. Except with Credit Memos.

-------

According to the settings in the Company Details > Basic Initialization, a Credit Memo will be posted in either of 2 ways in its Journal Entry. Assume original invoice amount was 500.00

OPTION 1: If Allow -ve amounts for Reversal Transaction Posting:

Dr Cr

Customer A/c xxx (500.00) -

Sales A/c - (500.00)

OPTION 2: If NOT Allow -ve amounts for Reversal Transaction Posting:

Dr Cr

Customer A/c xxx - 500.00

Sales A/c 500.00 -

Our add-on (to transfer the Credit Memos) is much easier to write if the 2nd option is chosen. This is why we wanted to modify settings (in case someone has tampered with them).

Now that you fully understand my problem, what do you think will be the best strategy to follow?

Best Regards,

Leon

leon_laikan
Participant
0 Kudos

ps

Pl see the attached picture:

capture.jpg

leon_laikan
Participant
0 Kudos

ps2

Well! it is not exactly a reversal.

It is the posting of a separate JE based on the details found in the Credit Memo.

-------------------------------------------------

For ex.

If the Original Credit Memo was:

Dr. Sales ........................... 500.00

Cr. Foreign Customer1...........................................500.00

Then the "reversal" would be:

Dr. Foreign Customer1...........500.00

Cr. Local Agent1 ..................................................500.00

This is what our add-on is attempting to do.

---------------------------------------------

If the Original Credit Memo was:

Dr. Foreign Customer1.................(500.00)

Cr. Sales ................................................................ (500.00)

Then the "reversal" would be:

Dr. Local Agent1 ........................(500.00)

Cr. Foreign Customer1...............................................(500.00)

This situation is more difficult to program. So, we are trying to prevent SAP from posting Credit Memos this way.

-------------------------------------------------

Answers (2)

Answers (2)

edy_simon
Active Contributor

Hi Leon,

I may not get the whole situation you are facing, but if it is only as what you decribed, why don't you use the BP Payment consolidation ?
It is the standard feature of SAP B1 and should handle your needs, unless there are other things that complicate this.

Here, I specified X00001 as the payer for X00002, any sales to 02 will be billed to 01.
Hence my AR CN and the JE will be as follow :

I believe this is what you need.

But if you still want to code it, should not be a problem also :
You know that a CN is always Credit BP, so when you read your JE, you should read

JE - BP row = Cr Column - Dr Column => in either case you will get 500-0 = 500 or 0-(-500) = 500.

This way, you don't need to care if SAP allow -ve or not.

Regards
Edy

leon_laikan
Participant
0 Kudos

Hi, Edy

Thanks for your helpful insight.

Many years ago, I considered this solution, but after discussions with our colleagues, we decided that it would not be the most appropriate technique to use (because there are other matters which really complicate the problem).

The most appropriate technique for our business, I still believe is to post all Sales (and Credit Memos) to the Foreign Customer's Account. Then, later do a J.E. to transfer the Debits (or Credits) to the Local Paying Agent.

But to do the J.E. manually would be a tedious daily task. So, this is why we decided to do an add-on to speed up processing.

Our add-on is really easy to use (but tough to write!): It simply lists all invoices (and CNs) which have not yet been reconciled on the left hand side (LHS). On the RHS, there is a column of combo boxes. The user selects the Foreign Paying agent for each row. Then presses a button. And Lo! it's done!

Best Regards,

Leon

edy_simon
Active Contributor
0 Kudos

Hi Leon,

In such case use below query to get the amount (Fill in the correct AR CN Entry)

DECLARE @CNEntry INT = 112
SELECT T0.CardCode, (T2.Credit-T2.Debit) Credit
FROM ORIN T0 JOIN OJDT T1 ON T0.TransId = T1.TransId
           JOIN JDT1 T2 ON T1.TransId = T2.TransId AND T2.ShortName = T0.CardCode
WHERE T0.DocEntry = @CNEntry

Then Create the Reversal Journal Entry as

oJE.Lines.AccountCode = oRS.Fields.Item("CardCode").Value.ToString().Trim 
If oRS.Fields.Item("Credit").Value >= 0 Then oJE.Lines.Debit = oRS.Fields.Item("Credit").Value Else oJE.Lines.Credit = Math.Abs(oRS.Fields.Item("Credit").Value) End If
oJE.Lines.Add() oJE.Lines.AccountCode = "LocalBPCode" If oRS.Fields.Item("Credit").Value >= 0 Then oJE.Lines.Credit = oRS.Fields.Item("Credit").Value Else oJE.Lines.Debit = Math.Abs(oRS.Fields.Item("Credit").Value) End If

Regards

Edy