cancel
Showing results for 
Search instead for 
Did you mean: 

Updating fields on ACDOCA from BSEG

galindo
Explorer
0 Kudos

Hi,

I'm working on a project where there is an EXIT implemented on the F-02 transaction on a legacy system. This EXIT move some custom information to the field BSEG-SGTXT.

Since the client is moving to a new S/4HANA system, and the document splitting option is enabled in the system configuration, all the documents created on F-02 that have a different cost center are splitting into separeted documents on the table ACDOCA, together with the regular ones on BSEG. This is the standard behaviour.

The problem is, we were asked to repeat the same process from the legacy system on the new one. And on our tests, some fields from BSEG, such as BSEG-SGTXT, are not moving to the corresponding fields of ACDOCA (SGTXT, for instance) for the new entries created after the split.

I couldn't find any information online about it. Neither an EXIT or enhancement point on the program. I would like to keep an elegant solution, without having to implement mysterious logic on the standard.

Does anyone have faced a similar problem? Or does anyone knows if this a configuration problem, like all the data from BSEG should also be copied to the splitted docs?

Thank you

Accepted Solutions (0)

Answers (3)

Answers (3)

galindo
Explorer

Hi,

I already solved the issue. For those interested, the solution is the following:

1) I added my business logic inside the first enhancement point (beginning of code) of the method UPDATE_CLEARING_INFO, from the class CL_FINS_ACDOC_POSTING_EVENTS.

2) In order to manipulate the ACDOCA registers, you have to make use of the internal table CT_ACDOC_CLEARING (this is a changing parameter). In this internal table, you will find all the split records together with the regular ones from BSEG.

2.1) The CT_ACDOC_CLEARING is your ACDOCA table. If you change some values here, keep in mind that due to standard processes, some fields may change in the end, others don't. The one that I was looking for was the ACDOCA-SGTXT, which luckily is not changed during the next steps.

2.2) The code on the enhancement point, will look like this:

METHOD update_clearing_info.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
*$*$-Start: (1 )--------------------------------------------------------
ENHANCEMENT 1  ZZABC123.    "active version
* DATA declarations...

* Loop at internal table:
  LOOP AT ct_acdoc_clearing ASSINGING FIELD_SYMBOL(<fs_acdoc_clearing>).

*   Business logic here...

*   Example of data manipulation:
    MOVE 'Test' TO <fs_acdoc_clearing>-sgtxt.

  ENDLOOP.

ENDENHANCEMENT.
*$*$-End:   (1 )----------------------------------------------------------

3) This method is called on F-02, after document splitting, for example. This one is more suitable for enhancement code than the "POST" method of the same class, because on POST method, there is a CLEAR ACDOC_ITAB[] on the beginning, that will clear all the logic you have made before. And after the process, the INSERT is already done. So, you lose the opportunity of manipulating ACDOCA registers.

4) The method UPDATE_CLEARING_INFO is called in the middle of ~POST method.

Sijin_Chandran
Active Contributor

Hi,

Your detailed answer here helped me in finding solution for one of my requirement.

But for your requirement i.e. updating ACDOCA~SGTXT SAP has already provided a perfect BADI which will serve the purpose. I would like to mention it here so that anyone facing similar requirement can make use of this BADI instead of going with this IMPLICIT Enhancement.

BADI is FIN_ACDOC_ITEM_SUBSTITUTION , just write you code for filling variable "accountingdocitemout-documentitemtext"

* Use case 1:Foreign Currency Valuation:FAGL_FCV,
* Substitute Item Text
 IF accountingdocheader-transactioncode = 'FBB1'.
 accountingdocitemout-documentitemtext = 'FAGL_FCV'.
 substitutiondone = abap_true.
 ENDIF.

The above code snippet is from its Example implementation "CL_FIN_ACDOC_ITEM_SUB_IMPL_EX"

Thanks,

Sijin

galindo
Explorer

Hi,

Thank you for the info. It's good to know that there is a BADI for it. I don't remember exactly what was the client requirement, nor have access to this specific system nowadays. But a BADI implementation is always better than an enhancement solution.

Thank you

0 Kudos

Thank you galindo,this class helped to change the ACDOCA based on the requirement.

gerald_fuller
Explorer
0 Kudos

In fact we just created a Hana view for our need and just linked it to the cube.

gerald_fuller
Explorer
0 Kudos

Hi,

I have a similar case: I need to add a BSEG field in ACDOCA table: FDLEV.

What is the right way to process?

As the purpose is to get the ACDOCA data to the virtual BW cube, I could create a HANA view joining ACDOCA and required fields of BSEG, but I cannot think there is no standard way to enhance ACDOCA with BSEG fields. I think coding block (OXK3) is for custom fields?

Thx for any help!

regards,

Gerald.

galindo
Explorer
0 Kudos

As mentioned above, probably the BADI FIN_ACDOC_ITEM_SUBSTITUTION is your best bet. Otherwise, you could go to an enhancement solution (which is, in most of cases, worst than using a BADI).