Skip to Content
0

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

Nov 14, 2016 at 07:18 AM

49

avatar image

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

capture.jpg (209.0 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Edy Simon Nov 14, 2016 at 09:27 AM
1

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


negamount.jpg (34.8 kB)
addonadmin.jpg (43.3 kB)
Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

0

ps

Pl see the attached picture:

capture.jpg

capture.jpg (41.1 kB)
0

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.

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

0
Edy Simon Nov 15, 2016 at 01:28 AM
1

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


Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Edy Simon Nov 15, 2016 at 07:05 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded