Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

This document explains how to restrict the company code popup in FB50 transaction through ABAP code.

SAP has a standard system behavior which enables the user to enter the value in company code popup in FB50 transaction. There may be exceptional cases,

where two different files of the same country has to be uploaded in sequence. This will result in error while processing the BDC sessions,

since same company code is passed as input.


Consider a scenario,where we create two BDC sessions for overall screen processing and company code popup to post a document via FB50.

When two different files of same country are executed in sequence,

Say for India, we will input the same company code value in the popup, which restricts further processing.

In such cases, we need to capture the values of  the recent session created from gthe  table TFBUF.

TFBUF- FI Data Table.

This table acts as a buffer for FI transactions.

Compare the values with current session and make a condition check with respect to the company code value and current user.

We can also include the condition in the query with application type of the document being posted.


Program Code:

     tb_buf   TYPE STANDARD TABLE OF tfbuf,
     wa_buf  TYPE tfbuf.  

Select * from tfbuf
       into table tb_buf
       WHERE usnam = sy-uname AND
                     applk = ‘GL’.    
READ TABLE tb_buf into wa_buf index 1.
if wa_buf-buffr+1(3) = p_code.        “p_code is the Company code value passed
  lv_flag = ‘X’.                               “Condition check to skip the session

Now, based on the company code values used, we can check the condition and skip the BDC session created for Company code popup, thereby allowing the system to continue the process.

Before Changes:

When we try to pass the same company code in the popup, the system will not allow the user to process further, since the previous value is stored in the buffer.

After Changes:

Company code popup is skipped and the session is created successfully.