on 2024 Aug 21 11:34 AM
I have local class(LCL_CUT) created inside function group ZFG_BP.
method get_activity of class lcl_cut, tries to access global variables of ZFG_BP.
METHOD get_activity
IF gv_act_id = 'YCUS'. "this gv_act_id is part of Fn Group ZFG_BP
**logic to calculate*
ENDIF.
ENDMETHOD.
I need to write abap unit for method get_activity, but I don't know how would I set gv_act_id = 'YCUS' for my unit test method call?
As of now gv_act_id = ' ', which makes sense because I am calling this method individually and there is no prior call/screen click to set gv_act_id value.
Request clarification before answering.
Hi sh4il3sh,
If you put the unit test class into the T99 include of the function group, like you should: https://help.sap.com/docs/abap-cloud/abap-development-tools-user-guide/where-to-write-abap-unit-test..., you can directly assign your needed value to the variable of the TOP include before calling your code under test in the unit test method.
BR,
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.