Search This Blog
Add reversal date in BAPI_ACC_GL_POSTING_POST for FBS1
This can be achieved using table EXTENSION1 of the BAPI. In case EXTENSION1 table is not present in the BAPI - check OSS [Note 487722 - Using EXTENSION1 for accounting BAPIs]
Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1:
Transaction CMOD: Select your project or create one.Assign enhancement ACBAPI01 to the project.You can branch to the source code via "Components".Navigate to function module EXIT_SAPLACC4_001.This function module indicates the parameters that are available to change the document.In INCLUDE ZXACCU15 (Customer namespace), carry out your implementation as an ABAP program.
In INCLUDE - add your code to populate the new field
DATA: wa_ext LIKE extension.
LOOP AT extension INTO wa_ext.
IF wa_ext-field1 = 'STODT'.
LOOP AT t_accit.
t_accit-stodt = wa_ext-field2.
MODIFY t_accit.
ENDLOOP.
ENDIF.
ENDLOOP.
When calling the BAPI - populate t_extension table's FIELD1 with <field name> i.e. STODT in this example and FIELD2 with <field vale> i.e. reversal date in this case
* Add reversal date
w_extension1-field1 = 'STODT'.
w_extension1-field2 = l_date.
APPEND w_extension1 TO t_extension1.
* Calling BAPI to post the document
CALL FUNCTION BAPI_ACC_GL_POSTING_POST
EXPORTING
documentheader = w_documentheader
IMPORTING
obj_key = g_objkey
TABLES
accountgl = t_accountgl
currencyamount = t_currencyamount
return = t_return
extension1 = t_extension1.
Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1:
Transaction CMOD: Select your project or create one.Assign enhancement ACBAPI01 to the project.You can branch to the source code via "Components".Navigate to function module EXIT_SAPLACC4_001.This function module indicates the parameters that are available to change the document.In INCLUDE ZXACCU15 (Customer namespace), carry out your implementation as an ABAP program.
In INCLUDE - add your code to populate the new field
DATA: wa_ext LIKE extension.
LOOP AT extension INTO wa_ext.
IF wa_ext-field1 = 'STODT'.
LOOP AT t_accit.
t_accit-stodt = wa_ext-field2.
MODIFY t_accit.
ENDLOOP.
ENDIF.
ENDLOOP.
When calling the BAPI - populate t_extension table's FIELD1 with <field name> i.e. STODT in this example and FIELD2 with <field vale> i.e. reversal date in this case
* Add reversal date
w_extension1-field1 = 'STODT'.
w_extension1-field2 = l_date.
APPEND w_extension1 TO t_extension1.
* Calling BAPI to post the document
CALL FUNCTION BAPI_ACC_GL_POSTING_POST
EXPORTING
documentheader = w_documentheader
IMPORTING
obj_key = g_objkey
TABLES
accountgl = t_accountgl
currencyamount = t_currencyamount
return = t_return
extension1 = t_extension1.
SAP ABAP Authorization
An authorization group is a group
that can be defined to restrict access to executing/maintaining programs in
SAP. An authorization group can be allocated for each program and users can
then be given access to perform functions for specific
authorization groups only.
The foundation of SAP security.
Objects serve as a template for coding access checks in ABAP programs and for
establishing user access rights. When values are
defined for authorisation objects these are referred to as authorizations.
T-code SU21 Maintain Authorization Objects
T-code SU20 Maintain Authorization Fields
ABAP Code to check authorization -
Authorization Object
|
S_TCODE
|
Field
|
TCD
|
Values
|
Any
transaction code
|
CALL 'AUTH_CHECK_TCODE'
ID 'TCODE' FIELD objectname.
AUTHORITY-CHECK OBJECT 'S_TCODE'
ID 'ACTVT' FIELD '02' "Check display = 2 access
ID 'TCD' FIELD 'VA03'. " for transaction code VA03
ID 'TCD' FIELD 'VA03'. " for transaction code VA03
How to find parameters of READ_TEXT function module
You need to know where to maintain the text to find the input parameters that you want to use for reading that text with function module READ_TEXT. You can ask the functional consultant as to where the text would be maintained by the user.
I am taking an example of maintaining text in billing document.
Go to T-code VF02. Enter the billing document number and press ENTER
Go to Header Texts
Under the tab Head.text, find the text from the left pane that would be maintained. For example, I would be maintaining 'Form Header'. Double click Form Header and maintain the text value in the right pane and SAVE.
Repeat step 1 to 3. Before double clicking 'Form header', activate the debugger by typing '/h' in the command box.
Double click 'Form header' and when the debugger gets triggered, put a breakpoint at function module 'READ_TEXT'
Press F8. The debugger stops in the READ_TEXT function module. Press F7. Scrolling up you will find READ_TEXT function module. Double click the exporting parameters (OBJECT, NAME, ID, LANGUAGE)
These are the values that we will be passing in our code to read the required text.
Subscribe to:
Posts (Atom)