Application Development 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: 

FB60 Enhancement - BADI / User Exit / Substitution

Former Member
0 Kudos

I have the following requirement:

<b>When an invoice is posted using transaction FB60, based on GL Account entered, the line item text should be populated with the vendor name/number.</b>

I searched the forum and found that some of you have recommended to use 'substitutions'. But I am not familar with those and I am not sure if that will provide me a solution. An user exit or BADI would be great. Please help me out!

Thanks,

Sam

1 ACCEPTED SOLUTION

Former Member
0 Kudos

A substitution would be the best way. Go to the IMG (transaction SPRO). Then select:


Financial accounting
 ->Accounts receivable and payable
  -> Business transactions
   ->Down payment received
    ->Carry out and check document settings

Click on the text icon beside 'substitution in accounting documents'. This is the documentation for substitutions.

(There are many other ways to navigate to this function in the IMG. The one I gave is the one I generally use.)

Rob

15 REPLIES 15

LucianoBentiveg
Active Contributor
0 Kudos

Definitly this is for a substitution. Look in google i very easy.

Former Member
0 Kudos

Hi

Hi

You should use a substitution (trx OBBH):

- Create a STEP for item

- The prerequisite:

SYST-TCODE = 'FB60' AND BSEG-KOART = 'S'

- Create anx EXIT where you'll create the text for item.

To create the exit: copy the std program RGGBS000 in your ZGGBS000.

Here insert your exit, for example Z001.

So in the routine GET_EXIT_TITLES insert the name of your routine:

FORM get_exit_titles TABLES etab.

exits-name = 'Z001'.

exits-param = c_exit_param_class.

exits-title = 'MY EXIT'.

APPEND exits.

And the define the exit:

FORM z001.

..............

ENDFORM.

Insert the name of your program in the table T80D

Anyway it should be better you ask a little help from your FI functional

Max

Max

Former Member
0 Kudos

A substitution would be the best way. Go to the IMG (transaction SPRO). Then select:


Financial accounting
 ->Accounts receivable and payable
  -> Business transactions
   ->Down payment received
    ->Carry out and check document settings

Click on the text icon beside 'substitution in accounting documents'. This is the documentation for substitutions.

(There are many other ways to navigate to this function in the IMG. The one I gave is the one I generally use.)

Rob

0 Kudos

Thanks Guys! Substitutions allows you to populate vendor number (BSEG-LIFNR) but how can we bring in the vendor name from master record. Can we do it?

0 Kudos

Since the IMG is used mainly by functional people, I work with one while doing this.

A downside to substitutions is that although the table entries can be transported, In our system at least, the actual rules and steps have to be re-created first in QA, then in production.

Rob

0 Kudos

Hi

Just I said you have to define an exit like this:

- Define LIFNR as global data

DATA: LIFNR TYPE LIFNR.

FROM Z001.

DATA NAME LIKE LFA1-NAME1

IF BSEG-KOART = 'K'.

LIFNR = BSEG-LIFNR

ELSE.

IF NOT LIFNR IS INITIAL.

SELECT SINGLE NAME1 FROM LFA1 INTO NAME

WHERE LIFNR = LIFNR.

CONCATENATE LIFNR '/' NAME INTO bseg-sgtx

ENDIF.

ENDFORM.

In this case use SYST-TCODE = FB60 as prerequisite, so when the item is Vendor item you'll store the Vendor Code and if it's G/L item you'll create the text.

You can also create an substitution at the complete document, in this case:

FROM Z001 bool_data TYPE gb002_015.

DATA: LIFNR LIKE LFA1-LIFNR,

NAME LIKE LFA1-NAME1.

LOOP AT bool_data-bseg INTO bseg where KOART = 'K'.

LIFNR = BSEG-LIFNR.

EXIT.

ENDLOOP.

IF NOT LIFNR IS INITIAL.

SELECT SINGLE NAME1 FROM LFA1 INTO NAME

WHERE LIFNR = LIFNR.

LOOP AT bool_data-bseg INTO bseg where KOART = 'S'.

CONCATENATE LIFNR '/' NAME INTO bseg-sgtx

MODIFY bool_data-bseg FROM BSEG.

ENDLOOP.

ENDIF.

ENDFORM.

Max

0 Kudos

<a href="https://websmp103.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=012006153200000137782005">Note 842318</a> deals with user exits in substitutions.

Rob

0 Kudos

Hey Max, thanks for the detailed info! I will implement this and get back to let you know about it!

0 Kudos

In table T80D I modified the exit-form pool name <b>RGGBS000</b> to the ZRGGBS000 (I have made necessary changes in this program). But, In the substitution screen when I try to drilldown on substitution-exits it won't show the new Zprogram/Zexit I created. Any idea?

0 Kudos

Hi

Have you insert the code to active your exit in the beginning of ZRGGBS000:

FORM get_exit_titles TABLES etab.

DATA: BEGIN OF exits OCCURS 50,

name(5) TYPE c,

param LIKE c_exit_param_none,

title(60) TYPE c,

END OF exits.

....................

exits-name = 'Z001'.

exits-param = c_exit_param_class.

exits-title = <TITLE>

APPEND exits.

Max

0 Kudos

You may need to run program RGUGBR00 (from the note number I posted).

Rob

0 Kudos

I did that again. Now, It is actually showing the Zprogram in dropdown (instead of original program). But it is not showing the exit (Z001) that I added.

I added these lines in form <b>get_exit_titles</b>

<b>exits-name = 'Z001'.

exits-param = c_exit_param_class.

exits-title = 'MY EXIT'.

APPEND exits.</b>

Then I have inserted this form in the main program:

<b>FORM Z001.

....

...

ENDFORM.</b>

0 Kudos

> You may need to run program RGUGBR00 (from the note

> number I posted).

>

> Rob

Yes, I ran it before and now.

0 Kudos

Hi

It's very strange, try to insert a break-point in the routine get_exit_titles: it's called when it presses F4 to search the routine for substitution.

Max

0 Kudos

It is only picking up the <i>U*** exits</i> from the program. So, I renamed my exit - with 'U' as the starting character and it worked fine.

Thanks Max & Rob for all the help!