2024 Sep 06 11:18 AM - edited 2024 Sep 06 1:55 PM
Dear all,
Could someone help me to optimize this ABAP CODE? It works in dev System however, after I move it to the live; Thi
REPORT ZBI0005.
tables: vbap , zbi_vbap_atwrt .
DATA: lt_zbi_vbap TYPE TABLE OF zbi_vbap_atwrt,
ls_zbi_vbap TYPE zbi_vbap_atwrt.
TYPES: BEGIN OF gty_list,
vbeln TYPE VBELN_VA,
posnr TYPE POSNR_VA,
cuobj TYPE CUOBJ_VA,
ATWRT TYPE atwrt,
END OF gty_list.
DATA: iv_cuobj TYPE inob-cuobj,
lt_data TYPE TABLE OF conf_out,
ls_data TYPE conf_out,
lt_atwrt TYPE TABLE OF char20
.
DATA: gt_data TYPE TABLE OF gty_list,
gs_data TYPE gty_list.
select p~vbeln , p~posnr, p~cuobj
from vbap as p inner join vbak as k on p~vbeln = k~vbeln
INTO CORRESPONDING FIELDS OF TABLE @GT_data
where p~erdat >= '20240101'
and k~VBTYP = 'C'.
DELETE FROM zbi_vbap_atwrt.
LOOP AT gt_data INTO gs_data.
CLEAR: lt_data, lt_atwrt.
iv_cuobj = gs_data-cuobj.
CALL FUNCTION 'VC_I_GET_CONFIGURATION'
EXPORTING
instance = iv_cuobj
TABLES
configuration = lt_data
EXCEPTIONS
instance_not_found = 1
internal_error = 2
no_class_allocation = 3
instance_not_valid = 4
others = 5.
IF sy-subrc = 0.
DELETE lt_data WHERE atnam <> 'H_FYT_KTG_KON'.
LOOP AT lt_data INTO ls_data.
READ TABLE gt_data WITH KEY vbeln = gs_data-vbeln posnr = gs_data-posnr cuobj = gs_data-cuobj INTO gs_data.
IF sy-subrc = 0.
gs_data-atwrt = ls_data-atwrt.
CLEAR ls_zbi_vbap.
ls_zbi_vbap-mandt = sy-mandt.
ls_zbi_vbap-vbeln = gs_data-vbeln.
ls_zbi_vbap-posnr = gs_data-posnr.
ls_zbi_vbap-cuobj = gs_data-cuobj.
ls_zbi_vbap-atwrt = gs_data-atwrt.
APPEND ls_zbi_vbap TO lt_zbi_vbap.
ENDIF.
ENDLOOP.
ELSE.
ENDIF.
ENDLOOP.
INSERT zbi_vbap_atwrt FROM TABLE lt_zbi_vbap.
COMMIT WORK.
s program doesn't finish.
I think you want this pic.
Thank you for your support. I am waiting for your answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.