Skip to Content
author's profile photo Former Member
Former Member

Updating zfield of table BSEG using BTE

Hello guys,

here is our issue:

Our business requirement is to modify BSEG fields of accounting documents when reversing them using Tcode FB08.

For that, first, we thought of using a substution rule but in our SAP solution, based on our previous experience, such solution has huge impact. Therefore we thought of using the BTE solution of the following guideline:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/207835fb-0a01-0010-34b4-fef1240ba9b7?QuickLink=index&overridelayout=true&5003637741507

We used the sample SAMPLE_PROCESS_00001120. You will find below the code we implemented:

IF t_bkpf-tcode = 'FB08'.
LOOP AT t_bseg INTO i_bseg .

IF NOT i_bseg-zzidoc_gen IS INITIAL AND NOT i_bseg-zzidoc_num IS INITIAL.

READ TABLE t_bsegsub WITH KEY tabix = sy-tabix.
CLEAR t_bsegsub-zzidoc_gen.
CLEAR t_bsegsub-zzidoc_num.
MODIFY t_bsegsub INDEX sy-tabix.

ENDIF.
ENDLOOP.

The fields which are supposed to be modified (BSEG-zzidoc_num and BSEG-zzidoc_gen) should be blank at the end of the process.

To test this code, we created an accounting document which we reversed using FB08. In debug mode, we see that we pass through our BTE code and the table t_bsegsub is properly updated in the end of our function module (the two fields in question are blank) but when we check the two fields in SE16n, we see that they are not blank in the table BSEG.

Therefore, we wonder whether:

- There is a step missing in the implementation of our BTE ?

- the BTE solution is adapted to our business requirement?

Thanks for helping 😀

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Aug 22, 2016 at 09:43 AM

    Hi,

    Can you please elaborate on your fears about 'huge impact' of substitution in order to achieve your goal?

    By all means, it would be better to use this functionality for this particular issue.


    Regards,


    Eli

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2016 at 08:22 AM

    Hello all,

    thanks for your responses. We will try the BTE and let you guys know if that works.

    Have you guys already implemented BTE in the past?

    If yes, have you managed to create two function modules for a same process, say 1120? It seems that the customization does not authorized it (FIBF --> Settings --> Process module --> To a Customer)

    Regards,

    Aimé

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 02, 2016 at 10:05 AM

    Hi,

    In our company, we have implemented this BTE but in the code we use a workarea to modify the table t_bsegsub like this:

    MODIFY t_bsegsub INDEX l_index FROM lwa_bsegsub.

    I don't know if this is the solution of your issue, but in our company works fine.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2016 at 10:23 AM

    Dear Oscar,

    Could you try the below logic :

    DATA : lv_tabix TYPE sy-tabix.

    IF t_bkpf-tcode = 'FB08'.
    LOOP AT t_bseg INTO i_bseg .

    lv_tabix = sy-tabix.

    IF NOT i_bseg-zzidoc_gen IS INITIAL AND NOT i_bseg-zzidoc_num IS INITIAL.

    READ TABLE t_bsegsub INDEX lv_tabix.

    IF sy-subrc = 0.
    CLEAR t_bsegsub-zzidoc_gen.
    CLEAR t_bsegsub-zzidoc_num.
    MODIFY t_bsegsub INDEX lv_tabix.

    ENDIF.

    ENDIF.
    ENDLOOP.

    ENDIF.

    Regards,

    Yance

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.