Old Loop which we can easily debug in any environment step by step using /H - F5 / F6 / F7 / F8.
loop at cs_acc_posting_data-accit assigning field-symbol(<ls_accit>).
assign lt_accit_data[ awtyp = <ls_accit>-awtyp
awref = <ls_accit>-awref
aworg = <ls_accit>-aworg
posnr = <ls_accit>-posnr ] to field-symbol(<ls_accit2>).
check sy-subrc is initial.
<ls_accit>-matnr = <ls_accit2>-Matnr.
<ls_accit>-ps_psp_pnr = <ls_accit2>-ps_psp_pnr.
endloop.
New loop GUI 7.4 and above.
lt_order = VALUE #( LET lo_conversion = NEW lcl_cfin_prg( ) IN FOR ls_cfin_accit IN lt_cfin_accit
WHERE ( awref = <accit_ext>-awref AND
awtyp = <accit_ext>-awtyp AND
( hkont IS NOT INITIAL OR saknr IS NOT INITIAL ) )
( ref_org = ls_cfin_accit-aworg
cost_center = ls_cfin_accit-kostl
material_no = <accit_ext>-matnr
chart_acc = <accit_ext>-ktopl
company_code = <accit_ext>-bukrs
wbs_element = lo_conversion->wbselement_output( lv_element = ls_cfin_accit-ps_posid ) ) ). Method 1:
this method can also be applied in the PROD environment if method 2 is unavailable due to certain restrictions. In the above code, the latet looping technique is demonstrated, where LT_CFIN_ACCIT data is read and appended to "lt_order" based on specific conditions.
To debug and examine LS_CFIN_ACCIT values (the work area of LT_CFIN_ACCIT) line by line, a new method can be implemented and invoked within the same loop, as shown with the WBS_ELEMENT call in the final line.
With this approach, you can set a session breakpoint in the wbselement_output method, allowing the system to stop in this method for simplified debugging.
Note: ensure that the additional method or routine is included within this new loop.
Method 2:
In GUI , there is enhanced funtionality for step-by-step debugging (Step Size).But in some case or in PROD environment we do not have access for this button.
I hope this solution assists you with your debugging process. Thank you!