Displaying multiple table in same alv screen - abap

Hello Sorry for asking the silly question since I am very new to abap programming.
I am trying to display multiple display in the same ALV screen. I have created the custom container and named properly still I am not able to get the display screen.
Can anyone please check my codes below and let me know what's the mistake I have did.
Report Z1_TEST3 NO STANDARD PAGE HEADING.
TABLES: LIKP, LIPS, VEKP, VEPO.
TYPES: BEGIN OF ty_likp,
vbeln TYPE likp-vbeln,
vkorg TYPE likp-vkorg,
vstel TYPE likp-vstel,
END OF ty_likp,
BEGIN OF ty_vekp,
vbeln TYPE lips-vbeln,
posnr TYPE lips-posnr,
matnr TYPE lips-matnr,
bpmng TYPE lips-bpmng,
vrkme TYPE lips-vrkme,
werks TYPE lips-werks,
lgort TYPE lips-lgort,
END OF ty_vekp,
BEGIN OF ty_vepo,
vbeln TYPE lips-vbeln,
xchar TYPE vepo-xchar,
vpmat TYPE lips-vpmat,
brgew TYPE lips-brgew,
ntgew TYPE lips-ntgew,
gewei TYPE lips-gewei,
END OF ty_vepo.
DATA: wa_likp TYPE ty_likp,
wa_vekp TYPE ty_vekp,
wa_vepp TYPE ty_vepo,
it_likp TYPE STANDARD TABLE OF ty_likp,
it_vekp TYPE STANDARD TABLE OF ty_vekp,
it_vepo TYPE STANDARD TABLE OF ty_vepo.
DATA: wa_fcat_likp TYPE lvc_s_fcat,
wa_fcat_vekp TYPE lvc_s_fcat,
wa_fcat_vepo TYPE lvc_s_fcat,
it_fcat_likp TYPE STANDARD TABLE OF lvc_s_fcat,
it_fcat_vekp TYPE STANDARD TABLE OF lvc_s_fcat,
it_fcat_vepo TYPE STANDARD TABLE OF lvc_s_fcat.
DATA: ob_custom1 TYPE REF TO cl_gui_custom_container,
ob_custom2 TYPE REF TO cl_gui_custom_container,
ob_custom3 TYPE REF TO cl_gui_custom_container,
ob_grid1 TYPE REF TO cl_gui_alv_grid,
ob_grid2 TYPE REF TO cl_gui_alv_grid,
ob_grid3 TYPE REF TO cl_gui_alv_grid.
INITIALIZATION.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS s_vbeln FOR likp-vbeln.
SELECTION-SCREEN END OF BLOCK b1.
CLASS delivery DEFINITION.
PUBLIC SECTION.
METHODS: get_likp,
get_vekp,
get_vepo,
fieldcat_likp,
fieldcat_vekp,
fieldcat_vepo.
ENDCLASS.
CLASS delivery IMPLEMENTATION.
METHOD get_likp.
IF s_vbeln[] IS NOT INITIAL.
SELECT vbeln vkorg vstel
FROM likp INTO TABLE it_likp
WHERE vbeln IN s_vbeln.
IF sy-subrc = 0.
SORT it_vekp BY vbeln.
ELSE.
MESSAGE 'Doesn''t exist' TYPE 'I'.
ENDIF.
ELSE.
MESSAGE 'Please select a valid number' TYPE 'I'.
ENDIF.
ENDMETHOD.
METHOD get_vekp.
IF it_vekp IS NOT INITIAL.
SELECT vbeln posnr matnr bpmng werks lgort
FROM lips INTO TABLE it_vekp
FOR ALL ENTRIES IN it_likp
WHERE vbeln = it_likp-vbeln.
IF sy-subrc = 0.
SORT it_vekp BY vbeln.
CALL METHOD: fieldcat_likp,
fieldcat_vekp,
fieldcat_vepo.
CALL SCREEN 9000.
ELSE.
MESSAGE 'Doesn''t exist' TYPE 'I'.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD get_vepo.
IF it_vepo IS NOT INITIAL.
SELECT vbeln xchar vpmat brgew ntgew gewei
FROM lips INTO TABLE it_vepo
FOR ALL ENTRIES IN it_likp
WHERE vbeln = it_likp-vbeln.
IF sy-subrc = 0.
SORT it_vepo BY vbeln.
CALL METHOD: fieldcat_likp,
fieldcat_vekp,
fieldcat_vepo.
CALL SCREEN 9000.
ELSE.
MESSAGE 'Doesn''t exist' TYPE 'I'.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD fieldcat_likp.
CLEAR wa_fcat_likp.
REFRESH it_fcat_likp.
DATA: lv_row TYPE i VALUE 0.
lv_row = 1 + lv_row.
wa_fcat_likp-row_pos = lv_row.
wa_fcat_likp-fieldname = 'VBELN'.
wa_fcat_likp-tabname = 'IT_LIKP'.
wa_fcat_likp-reptext = 'Lieferung'.
wa_fcat_likp-col_opt = 'X'.
APPEND wa_fcat_likp TO it_fcat_likp.
CLEAR wa_fcat_likp.
lv_row = 1 + lv_row.
wa_fcat_likp-row_pos = lv_row.
wa_fcat_likp-fieldname = 'VKORG'.
wa_fcat_likp-tabname = 'IT_LIKP'.
wa_fcat_likp-reptext = 'Verkaufsorganisation'.
wa_fcat_likp-col_opt = 'X'.
APPEND wa_fcat_likp TO it_fcat_likp.
CLEAR wa_fcat_likp.
lv_row = 1 + lv_row.
wa_fcat_likp-row_pos = lv_row.
wa_fcat_likp-fieldname = 'VSTEL'.
wa_fcat_likp-tabname = 'IT_LIKP'.
wa_fcat_likp-reptext = 'Versandstelle'.
wa_fcat_likp-col_opt = 'X'.
APPEND wa_fcat_likp TO it_fcat_likp.
CLEAR wa_fcat_likp.
ENDMETHOD.
METHOD fieldcat_vekp.
CLEAR wa_fcat_vekp.
REFRESH it_fcat_vekp.
DATA: lv_col TYPE i VALUE 0.
lv_col = 1 + lv_col.
wa_fcat_vekp-col_pos = lv_col.
wa_fcat_vekp-fieldname = 'POSNR'.
wa_fcat_vekp-tabname = 'IT_VEKP'.
wa_fcat_vekp-reptext = 'Position'.
wa_fcat_vekp-col_opt = 'X'.
APPEND wa_fcat_vekp TO it_fcat_vekp.
CLEAR wa_fcat_vekp.
lv_col = 1 + lv_col.
wa_fcat_vekp-col_pos = lv_col.
wa_fcat_vekp-fieldname = 'MATNR'.
wa_fcat_vekp-tabname = 'IT_VEKP'.
wa_fcat_vekp-reptext = 'Materialnummer'.
wa_fcat_vekp-col_opt = 'X'.
APPEND wa_fcat_vekp TO it_fcat_vekp.
CLEAR wa_fcat_vekp.
lv_col = 1 + lv_col.
wa_fcat_vekp-col_pos = lv_col.
wa_fcat_vekp-fieldname = 'BPMNG'.
wa_fcat_vekp-tabname = 'IT_VEKP'.
wa_fcat_vekp-reptext = 'Menge'.
wa_fcat_vekp-col_opt = 'X'.
APPEND wa_fcat_vekp TO it_fcat_vekp.
CLEAR wa_fcat_vekp.
lv_col = 1 + lv_col.
wa_fcat_vekp-col_pos = lv_col.
wa_fcat_vekp-fieldname = 'VRKMG'.
wa_fcat_vekp-tabname = 'IT_VEKP'.
wa_fcat_vekp-reptext = 'Mengeneinheit'.
wa_fcat_vekp-col_opt = 'X'.
APPEND wa_fcat_vekp TO it_fcat_vekp.
CLEAR wa_fcat_vekp.
lv_col = 1 + lv_col.
wa_fcat_vekp-col_pos = lv_col.
wa_fcat_vekp-fieldname = 'WERKS'.
wa_fcat_vekp-tabname = 'IT_VEKP'.
wa_fcat_vekp-reptext = 'Werks'.
wa_fcat_vekp-col_opt = 'X'.
APPEND wa_fcat_vekp TO it_fcat_vekp.
CLEAR wa_fcat_vekp.
lv_col = 1 + lv_col.
wa_fcat_vekp-col_pos = lv_col.
wa_fcat_vekp-fieldname = 'LGORT'.
wa_fcat_vekp-tabname = 'IT_VEKP'.
wa_fcat_vekp-reptext = 'Lagerort'.
wa_fcat_vekp-col_opt = 'X'.
APPEND wa_fcat_vekp TO it_fcat_vekp.
CLEAR wa_fcat_vekp.
ENDMETHOD.
METHOD fieldcat_vepo.
CLEAR wa_fcat_vepo.
REFRESH it_fcat_vepo.
DATA: lv_col TYPE i VALUE 0.
lv_col = 1 + lv_col.
wa_fcat_vepo-col_pos = lv_col.
wa_fcat_vepo-fieldname = 'XCHAR'.
wa_fcat_vepo-tabname = 'IT_VEPO'.
wa_fcat_vepo-reptext = 'HU#'.
wa_fcat_vepo-col_opt = 'X'.
APPEND wa_fcat_vepo TO it_fcat_vepo.
CLEAR wa_fcat_vepo.
lv_col = 1 + lv_col.
wa_fcat_vepo-col_pos = lv_col.
wa_fcat_vepo-fieldname = 'VPMAT'.
wa_fcat_vepo-tabname = 'IT_VEPO'.
wa_fcat_vepo-reptext = 'Verpackungsmaterial'.
wa_fcat_vepo-col_opt = 'X'.
APPEND wa_fcat_vepo TO it_fcat_vepo.
CLEAR wa_fcat_vepo.
lv_col = 1 + lv_col.
wa_fcat_vepo-col_pos = lv_col.
wa_fcat_vepo-fieldname = 'BRGEW'.
wa_fcat_vepo-tabname = 'IT_VEPO'.
wa_fcat_vepo-reptext = 'Bruttogewicht'.
wa_fcat_vepo-col_opt = 'X'.
APPEND wa_fcat_vepo TO it_fcat_vepo.
CLEAR wa_fcat_vepo.
lv_col = 1 + lv_col.
wa_fcat_vepo-col_pos = lv_col.
wa_fcat_vepo-fieldname = 'NTGEW'.
wa_fcat_vepo-tabname = 'IT_VEPO'.
wa_fcat_vepo-reptext = 'Nettogewicht'.
wa_fcat_vepo-col_opt = 'X'.
APPEND wa_fcat_vepo TO it_fcat_vepo.
CLEAR wa_fcat_vepo.
lv_col = 1 + lv_col.
wa_fcat_vepo-col_pos = lv_col.
wa_fcat_vepo-fieldname = 'GEWEI'.
wa_fcat_vepo-tabname = 'IT_VEPO'.
wa_fcat_vepo-reptext = 'Gewichtseinheit'.
wa_fcat_vepo-col_opt = 'X'.
APPEND wa_fcat_vepo TO it_fcat_vepo.
CLEAR wa_fcat_vepo.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: delivery TYPE REF TO delivery.
CREATE OBJECT delivery.
CALL METHOD: delivery->get_likp,
delivery->get_vekp,
delivery->get_vepo.
MODULE status_9000 OUTPUT.
SET PF-STATUS 'GUI_9000'.
SET TITLEBAR 'TITLE_9000'.
CREATE OBJECT ob_custom1
EXPORTING
container_name = 'CONTAINER1'.
CREATE OBJECT ob_custom2
EXPORTING
container_name = 'CONTAINER2'.
CREATE OBJECT ob_custom3
EXPORTING
container_name = 'CONTAINER3'.
CREATE OBJECT ob_grid1
EXPORTING
i_parent = ob_custom1.
CREATE OBJECT ob_grid2
EXPORTING
i_parent = ob_custom2.
CREATE OBJECT ob_grid3
EXPORTING
i_parent = ob_custom3.
CALL METHOD ob_grid1->set_table_for_first_display
CHANGING
it_fieldcatalog = it_fcat_likp
it_outtab = it_likp.
CALL METHOD ob_grid2->set_table_for_first_display
CHANGING
it_fieldcatalog = it_fcat_vekp
it_outtab = it_vekp.
CALL METHOD ob_grid3->set_table_for_first_display
CHANGING
it_fieldcatalog = it_fcat_vepo
it_outtab = it_vepo.
ENDMODULE.
MODULE user_command_9000 INPUT.
IF sy-ucomm = 'BACK'
OR sy-ucomm = 'EXIT'
OR sy-ucomm = 'CANCEL'.
FREE: ob_grid1, ob_grid2,ob_grid3, ob_custom1, ob_custom2,ob_custom3.
REFRESH: it_likp, it_vekp,it_vepo.
LEAVE TO SCREEN 0.
ENDIF.
ENDMODULE.

You can't display several GUI controls (ALV in your case) in one container. But you can split a container into several ones by using the "splitter container" (search the many examples in the web which refer to the class CL_GUI_SPLITTER_CONTAINER).

Related

abap count similar row values

IF ls_th_sum_lab_ndt IS not INITIAL.
ls_th_sum_lab_ndt-ndt_flag = 'X'.
ls_th_sum_lab_ndt-zwc_cat = 'NDT'.
if there are more than 2 zwc_cat that equal to NDT change the other one to MH
APPEND ls_th_sum_lab_ndt TO gt_th_sum_lab_ndt.
ENDIF.
Basically what I want to do:
Update ls_th_sum_lab_ndt-zwc_cat=MH if ls_th_sum_lab_ndt-zwc_cat="NDT" >2 set second row to MH
Thank You in Advance!
Try this:
DATA: lv_count type i,
lv_index type sy-tabix.
...
LOOP AT gt_th_sum_lab_ndt INTO ls_th_sum_lab_ndt WHERE zwc_cat = 'NDT'.
lv_count = lv_count + 1.
if lv_count >= 2.
lv_index = sy-tabix.
exit.
endif.
ENDLOOP.
CHECK lv_count >= 2.
READ TABLE gt_th_sum_lab_ndt INTO ls_th_sum_lab_ndt INDEX lv_index.
ls_th_sum_lab_ndt-zwc_cat = 'MH'.
MODIFY gt_th_sum_lab_ndt FROM ls_th_sum_lab_ndt INDEX lv_index.
Hope it helps.

filtering ALV gets fewer lines than expected

I have the following code which is not filtering columsn for radio buttons : btn4 and btn5.For radio buttons btn1 and btn3 is working fine.Do you have any ideea why? Cheers, Julian
SELECTION-SCREEN BEGIN OF BLOCK BLOCK2 WITH FRAME TITLE text-001.
SELECTION-SCREEN COMMENT /1(79) label_4.
PARAMETERS: btn5 RADIOBUTTON GROUP RAD1 USER-COMMAND chk DEFAULT 'X',
btn4 RADIOBUTTON GROUP RAD1,
btn2 RADIOBUTTON GROUP RAD1,
btn1 RADIOBUTTON GROUP RAD1,
btn3 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN END OF BLOCK BLOCK2.
Refresh it_filter.
if btn1 = 'X'.
ls_filter-fieldname = 'COMDEP'. "Filtru data comanda intre doua date calendaristice pentru Depasit radiobuton "
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'EQ'.
ls_filter-valuf_int = 'Depasit'.
APPEND ls_filter TO It_filter.
ELSEIF btn3 = 'X'.
ls_filter-fieldname = 'COMDEP'. "Filtru data comanda intre doua date calendaristice pentru Nedepasit radiobuton "
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'EQ'.
ls_filter-valuf_int = 'Nedepasit'.
APPEND ls_filter TO It_filter.
ELSEIF btn4 = 'X'.
ls_filter-fieldname = 'GMEIN'. "Comenzi vrac
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'EQ'.
ls_filter-valuf_int = 'KG'.
APPEND ls_filter TO It_filter.
ELSEIF btn5 = 'X'.
ls_filter-fieldname = 'MEINH'. "Comenzi bucati
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'EQ'.
ls_filter-valuf_int = 'BUC'.
APPEND ls_filter TO It_filter.
EndIf.
in the mean time i figured out the answer , please find it below :
IF btn4 = 'X'.
ls_filter-fieldname = 'MEINH'. "Comenzi vrac
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'NE'.
ls_filter-valuf_int = 'BUC'.
APPEND ls_filter TO It_filter.
ELSEIF btn5 = 'X'.
ls_filter-fieldname = 'GMEIN'. "Comenzi structura
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'NE'.
ls_filter-valuf_int = 'KG'.
APPEND ls_filter TO It_filter.
ELSEIF btn6 = 'X'.
ls_filter-fieldname = 'GMEIN'. "Comenzi vrac
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'EQ'.
ls_filter-valuf_int = 'KG'.
APPEND ls_filter TO It_filter.
ls_filter-fieldname = 'MEINH'. "Comenzi structura
ls_filter-tabname = 'LT_JOIN'.
ls_filter-sign0 = 'I'.
ls_filter-optio = 'EQ'.
ls_filter-valuf_int = 'BUC'.
APPEND ls_filter TO It_filter.
EndIf.

How to return value to user from a Search Help Exit

I have a Search Help with many fields to be displayed to the user in order to apply values. I want to get 3 fields APOFASI, SKOPOS, KATDANL from the user.
In the CALLCONTROL-STEP = SELECT in the exit FM, I want to get these values in variables and then to make some selects and find another field APOFASISAP.
I am trying to pass back to the selection fields of the search help the field APOFASSISAP, but the APOFASI field seems to be blank.
The code is:
TYPES: BEGIN OF ty_apofasisap_tr,
apofasisap_tr TYPE zglk_sap_afopasi,
END OF ty_apofasisap_tr.
DATA: it_apofasisap_tr TYPE TABLE OF ty_apofasisap_tr,
wa_apofasisap_tr LIKE LINE OF it_apofasisap_tr.
DATA: lv_apofasi TYPE zglk_kyanr_ap,
lv_skopos TYPE zskopos,
lv_katdanl TYPE zsl_cat_dan,
lv_apofasisap_arx TYPE zglk_sap_afopasi.
lv_apofasi = wa_shlp_selopt-low.
ls_result-apofasi = ''.
IF lv_apofasi <> ''.
wa_shlp_selopt-low = ''.
MODIFY shlp-selopt FROM wa_shlp_selopt INDEX sy-tabix.
ENDIF.
READ TABLE shlp-selopt INTO wa_shlp_selopt WITH KEY shlpfield = 'SKOPOS'.
lv_skopos = wa_shlp_selopt-low.
READ TABLE shlp-selopt INTO wa_shlp_selopt WITH KEY shlpfield = 'KATDANL'.
lv_katdanl = wa_shlp_selopt-low.
SELECT SINGLE apofasisap INTO lv_apofasisap_arx
FROM zsl_glk_apof
WHERE apofasi = lv_apofasi.
SELECT * FROM zsl_glk_apof_tr
WHERE apofasisap_trp = lv_apofasisap_arx.
wa_apofasisap_tr-apofasisap_tr = zsl_glk_apof_tr-apofasisap_tr.
APPEND wa_apofasisap_tr TO it_apofasisap_tr.
ENDSELECT.
wa_shlp_selopt-shlpname = 'ZAPOF_TROP'.
wa_shlp_selopt-shlpfield = 'APOFASISAP'.
wa_shlp_selopt-sign = 'I'.
wa_shlp_selopt-option = 'EQ'.
wa_shlp_selopt-low = wa_apofasisap_tr-apofasisap_tr.
APPEND wa_shlp_selopt TO shlp-selopt.
This code does not replace/add the values to the appropriate fields.
Can someone help on this?
PS. Let me add another code that I wrote with the help of internet. It is in the STEP of DISPLAY.
IF callcontrol-step = 'DISP'.
TYPES: BEGIN OF ls_result,
apofasi LIKE zsl_glk_apof-apofasi,
apofasidate LIKE zsl_glk_apof-apofasidate,
apofasisap LIKE zsl_glk_apof-apofasisap,
apofasi_trp_x LIKE zsl_glk_apof-apofasi_trp_x,
apofasi_tr_x LIKE zsl_glk_apof-apofasi_tr_x,
fek LIKE zsl_glk_apof-fek,
katdanl LIKE zsl_glk_apof-katdanl,
reference LIKE zsl_glk_apof-reference,
skopos LIKE zsl_glk_apof-skopos,
thema LIKE zsl_glk_apof-thema,
type_desc LIKE zsl_glk_apof-type_desc,
ya_first LIKE zsl_glk_apof-ya_first,
END OF ls_result.
DATA: lt_result TYPE STANDARD TABLE OF ls_result.
CLEAR: lt_result, record_tab, record_tab[].
* Read the value that user gave
READ TABLE shlp-selopt INTO wa_shlp_selopt
WITH KEY shlpfield = 'APOFASI'.
lv_apofasi = wa_shlp_selopt-low.
IF lv_apofasi <> ''.
* Clear this value
wa_shlp_selopt-low = ''.
MODIFY shlp-selopt FROM wa_shlp_selopt INDEX sy-tabix.
ENDIF.
* Find the number starting APOFASISAP from the APOFASI text
SELECT SINGLE apofasisap INTO lv_apofasisap_arx
FROM zsl_glk_apof
WHERE apofasi = lv_apofasi.
IF sy-subrc = 0.
* Find the APOFASISAPs which changes the starting one and display the
*fields
SELECT a~apofasi a~apofasidate a~apofasisap
a~apofasi_tr_x a~apofasi_trp_x
a~thema a~fek a~reference a~ya_first
INTO CORRESPONDING FIELDS OF TABLE lt_result
FROM zsl_glk_apof AS a INNER JOIN zsl_glk_apof_tr AS b
ON a~apofasisap = b~apofasisap_tr
WHERE b~apofasisap_trp = lv_apofasisap_arx.
IF sy-subrc = 0.
*Pass them to display the result.
CALL FUNCTION 'F4UT_RESULTS_MAP'
EXPORTING
* SOURCE_STRUCTURE =
apply_restrictions = 'X'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_result
CHANGING
shlp = shlp
callcontrol = callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
FREE lt_result.
ENDIF.
It says NO VALUES FOR THIS SELECTION. The table lt_result contains 11 records.
Thanks again.
I agree with the forespeakers, that provided code is a mess, from which nothing can be figured out.
First of all, use DISP event in SHELP FM exit, not SELECT.
Secondly, you fill the wrong table (or do not show us right filling in the snippet above). In order to pass values back to user you should modify a RECORD_TAB table.
Your code should look something like this (joined selections from zsl_glk_apof and zsl_glk_apof_tr tables):
CHECK callcontrol-step = 'DISP'.
DATA: ls_selopt TYPE ddshselopt. "loc str for shlp-selopt
DATA: BEGIN OF ls_record.
INCLUDE STRUCTURE seahlpres.
DATA: END OF ls_record.
DATA: lv_glk_apof_tr TYPE zsl_glk_apof_tr-apofasisap_tr.
LOOP AT shlp-selopt INTO ls_selopt.
* finding SKOPOS and KATDANL values
CASE ls_selopt-shlpfield.
WHEN 'SKOPOS'.
lv_skopos = ls_selopt-low.
WHEN 'KATDANL'.
lv_katdanl = ls_selopt-low.
WHEN OTHERS.
ENDCASE.
* doing smth
* finding some stuff from Z-tables
SELECT SINGLE tr~apofasisap_tr
FROM zsl_glk_apof AS ap
JOIN zsl_glk_apof_tr AS tr
ON ap~apofasisap = tr~apofasisap_trp
INTO lv_glk_apof_tr
WHERE ap~apofasi = lv_apofasi.
ENDLOOP.
* modify record_tab with the found value lv_glk_apof_tr
LOOP AT record_tab INTO ls_record.
ls_record-string+25(5) = lv_glk_apof_tr. "field shift should be based on your values
ENDLOOP.
Hello and thanks all for your valuable help.
Finally I did it as follow:
if callcontrol-step = 'SELECT'.
get parameter id 'ZAP' field p_apofasi.
get parameter id 'ZSK' field p_skopos.
get parameter id 'ZKATDANL' field p_katdanl.
select single apofasisap into lv_apofasisap_arx
from zsl_glk_apof
where apofasi = p_apofasi and
katdanl = p_katdanl and
skopos = p_skopos.
select * into corresponding fields of table it_apofasisap_tr
from zsl_glk_apof_tr
where apofasisap_trp = lv_apofasisap_arx.
* Display the results to the user
types: begin of ls_result,
apofasi like zsl_glk_apof-apofasi,
apofasidate like zsl_glk_apof-apofasidate,
apofasisap like zsl_glk_apof-apofasisap,
apofasi_trp_x like zsl_glk_apof-apofasi_trp_x,
apofasi_tr_x like zsl_glk_apof-apofasi_tr_x,
katdanl like zsl_glk_apof-katdanl,
skopos like zsl_glk_apof-skopos,
type_desc like zsl_glk_apof-type_desc,
end of ls_result.
data: lt_result type standard table of ls_result.
clear: lt_result, record_tab, record_tab[].
* Fill all the fields of the Search-Help with the data according to the
*selections of the user.
select apofasi apofasidate apofasisap
apofasi_tr_x apofasi_trp_x
katdanl skopos type_desc
into corresponding fields of table lt_result
from zsl_glk_apof
for all entries in it_apofasisap_tr
where apofasisap = it_apofasisap_tr-apofasisap_tr and
apofasi_tr_x = 'X'. "lv_apofasi_tr_x.
call function 'F4UT_RESULTS_MAP'
tables
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_result
changing
shlp = shlp
callcontrol = callcontrol
exceptions
illegal_structure = 1
others = 2.
if sy-subrc = 0.
callcontrol-step = 'DISP'.
else.
callcontrol-step = 'EXIT'.
endif.
endif.
Regards
Elias

Modify an itab during looping another itab

I want to do the following
Loop at itab into wa_itab.
wa_itab2-field1 = wa_itab-field1.
wa_itab2-field2 = wa_itab-field2.
wa_itab2-field3 = wa_itab-field3.
wa_itab2-field4 = wa_itab-field4.
*how to insert in itab2 if fields 1,2 & 3 do not exist or update itab2 if fields 1,2 & 3 exist?
EndLoop.
Let me explain more.
I have itab with fields bukrs, kunnr, date, action.
The itab2 with fields bukrs, kunnr, name1 (from kna1),date01 (jan), action01, date02 (Feb), action02 ... date12 (Dec), action12.
During loop of itab I want if the itab2 has a record with bukrs and kunnr then it will update date and action according to the month of itab-date, if it do not exist (bukrs, kunnr) then insert a record to itab2.
I hope that this explains what I want.
Thanks in advance
Elias
PS. Here is the program
*&---------------------------------------------------------------------*
*& Report Z_COLLECTORS_ACTIONS
*&
*&---------------------------------------------------------------------*
*& Description
*&
*&---------------------------------------------------------------------*
*& Change log:
*& Date Author Action
*&
*&---------------------------------------------------------------------*
REPORT z_collectors_actions.
TABLES: zcollectoraction, kna1, t001.
TYPE-POOLS : slis.
TYPES: BEGIN OF ty_totalcollectoractions,
bukrs TYPE zcollectoraction-bukrs,
kunnr TYPE zcollectoraction-kunnr,
name1 TYPE kna1-name1,
date01 TYPE zcollectoraction-dat,
date02 TYPE zcollectoraction-dat,
date03 TYPE zcollectoraction-dat,
date04 TYPE zcollectoraction-dat,
date05 TYPE zcollectoraction-dat,
date06 TYPE zcollectoraction-dat,
date07 TYPE zcollectoraction-dat,
date08 TYPE zcollectoraction-dat,
date09 TYPE zcollectoraction-dat,
date10 TYPE zcollectoraction-dat,
date11 TYPE zcollectoraction-dat,
date12 TYPE zcollectoraction-dat,
action01 TYPE zcollectoraction-action,
action02 TYPE zcollectoraction-action,
action03 TYPE zcollectoraction-action,
action04 TYPE zcollectoraction-action,
action05 TYPE zcollectoraction-action,
action06 TYPE zcollectoraction-action,
action07 TYPE zcollectoraction-action,
action08 TYPE zcollectoraction-action,
action09 TYPE zcollectoraction-action,
action10 TYPE zcollectoraction-action,
action11 TYPE zcollectoraction-action,
action12 TYPE zcollectoraction-action,
END OF ty_totalcollectoractions.
DATA: wa_collectoraction LIKE zcollectoraction,
it_collectoraction LIKE TABLE OF zcollectoraction,
wa_totalcollectoractions TYPE ty_totalcollectoractions,
it_totalcollectoractions TYPE TABLE OF ty_totalcollectoractions WITH KEY kunnr.
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
field_catalog TYPE lvc_t_fcat,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid,
g_save TYPE c VALUE 'X',
g_variant TYPE disvariant,
gx_variant TYPE disvariant,
g_exit TYPE c.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
PARAMETERS: variant LIKE disvariant-variant.
PARAMETERS p_bukrs TYPE bukrs OBLIGATORY.
SELECT-OPTIONS: so_kunnr FOR kna1-kunnr OBLIGATORY,
so_date FOR sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK bl1.
INITIALIZATION.
gx_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
variant = gx_variant-variant.
ENDIF.
START-OF-SELECTION.
SELECT bukrs kunnr dat MAX( time ) AS time
FROM zcollectoraction INTO CORRESPONDING FIELDS OF TABLE it_collectoraction
WHERE bukrs = p_bukrs AND
kunnr IN so_kunnr AND
dat IN so_date
GROUP BY bukrs kunnr dat.
LOOP AT it_collectoraction INTO wa_collectoraction.
SELECT SINGLE * FROM zcollectoraction INTO CORRESPONDING FIELDS OF wa_collectoraction
WHERE bukrs = wa_collectoraction-bukrs AND
kunnr = wa_collectoraction-kunnr AND
dat = wa_collectoraction-dat AND
time = wa_collectoraction-time.
MODIFY it_collectoraction FROM wa_collectoraction.
wa_totalcollectoractions-bukrs = wa_collectoraction-bukrs.
wa_totalcollectoractions-kunnr = wa_collectoraction-kunnr.
SELECT SINGLE name1 FROM kna1 INTO wa_totalcollectoractions-name1
WHERE kunnr = wa_collectoraction-kunnr.
DATA lv_month TYPE n LENGTH 2.
lv_month = wa_collectoraction-dat+4(2).
CASE lv_month.
WHEN '01'.
wa_totalcollectoractions-date01 = wa_collectoraction-dat.
wa_totalcollectoractions-action01 = wa_collectoraction-action.
WHEN '02'.
wa_totalcollectoractions-date02 = wa_collectoraction-dat.
wa_totalcollectoractions-action02 = wa_collectoraction-action.
WHEN '03'.
wa_totalcollectoractions-date03 = wa_collectoraction-dat.
wa_totalcollectoractions-action03 = wa_collectoraction-action.
WHEN '04'.
wa_totalcollectoractions-date04 = wa_collectoraction-dat.
wa_totalcollectoractions-action04 = wa_collectoraction-action.
WHEN '05'.
wa_totalcollectoractions-date05 = wa_collectoraction-dat.
wa_totalcollectoractions-action05 = wa_collectoraction-action.
WHEN '06'.
wa_totalcollectoractions-date06 = wa_collectoraction-dat.
wa_totalcollectoractions-action06 = wa_collectoraction-action.
WHEN '07'.
wa_totalcollectoractions-date07 = wa_collectoraction-dat.
wa_totalcollectoractions-action07 = wa_collectoraction-action.
WHEN '08'.
wa_totalcollectoractions-date08 = wa_collectoraction-dat.
wa_totalcollectoractions-action08 = wa_collectoraction-action.
WHEN '09'.
wa_totalcollectoractions-date09 = wa_collectoraction-dat.
wa_totalcollectoractions-action09 = wa_collectoraction-action.
WHEN '10'.
wa_totalcollectoractions-date10 = wa_collectoraction-dat.
wa_totalcollectoractions-action10 = wa_collectoraction-action.
WHEN '11'.
wa_totalcollectoractions-date11 = wa_collectoraction-dat.
wa_totalcollectoractions-action11 = wa_collectoraction-action.
WHEN '12'.
wa_totalcollectoractions-date12 = wa_collectoraction-dat.
wa_totalcollectoractions-action12 = wa_collectoraction-action.
WHEN OTHERS.
ENDCASE.
READ TABLE it_totalcollectoractions INTO wa_totalcollectoractions
WITH TABLE KEY kunnr = wa_collectoraction-kunnr.
IF sy-subrc = 0.
MODIFY it_totalcollectoractions INDEX sy-tabix FROM wa_totalcollectoractions.
ELSE.
INSERT wa_totalcollectoractions INTO TABLE it_totalcollectoractions.
ENDIF.
ENDLOOP.
PERFORM build_fieldcatalog_agreggate.
PERFORM display_alv_report.
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_alv_report .
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fieldcatalog[]
i_save = 'X'
is_variant = g_variant
TABLES
t_outtab = it_totalcollectoractions
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*-------------------------------------------------------------------*
* Form TOP-OF-PAGE *
*-------------------------------------------------------------------*
* ALV Report Header *
*-------------------------------------------------------------------*
FORM top-of-page.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c,
lv_butxt TYPE butxt.
SELECT SINGLE butxt INTO lv_butxt FROM t001
WHERE bukrs = p_bukrs.
* Title
wa_header-typ = 'H'.
wa_header-info = 'Collectors'' Action Report'.
APPEND wa_header TO t_header.
CLEAR wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
APPEND wa_header TO t_header.
CLEAR: wa_header.
* Bukrs
wa_header-typ = 'S'.
wa_header-key = 'Company: '.
CONCATENATE p_bukrs lv_butxt INTO wa_header-info SEPARATED BY space.
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "top-of-page
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG_AGREGGATE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM build_fieldcatalog_agreggate .
fieldcatalog-fieldname = 'KUNNR'.
fieldcatalog-seltext_m = 'Customer ID'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NAME1'.
fieldcatalog-seltext_m = 'Customer Name'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION01'.
fieldcatalog-seltext_m = 'January'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION02'.
fieldcatalog-seltext_m = 'February'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION03'.
fieldcatalog-seltext_m = 'March'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION04'.
fieldcatalog-seltext_m = 'April'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION05'.
fieldcatalog-seltext_m = 'May'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION06'.
fieldcatalog-seltext_m = 'June'.
fieldcatalog-col_pos = 7.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION07'.
fieldcatalog-seltext_m = 'July'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION08'.
fieldcatalog-seltext_m = 'August'.
fieldcatalog-col_pos = 9.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION09'.
fieldcatalog-seltext_m = 'September'.
fieldcatalog-col_pos = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION10'.
fieldcatalog-seltext_m = 'Octomber'.
fieldcatalog-col_pos = 11.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION11'.
fieldcatalog-seltext_m = 'Noveber'.
fieldcatalog-col_pos = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ACTION12'.
fieldcatalog-seltext_m = 'December'.
fieldcatalog-col_pos = 11.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG_AGREGGATE
If itab is not too big, then you can do like below.
clear: itab2[].
Loop at itab into wa_itab.
wa_itab2-field1 = wa_itab-field1.
wa_itab2-field2 = wa_itab-field2.
wa_itab2-field3 = wa_itab-field3.
wa_itab2-field4 = wa_itab-field4.
...
read table itab2 into data(ls_itab2) with key field1 = wa_itab2-field1
field2 = wa_itab2-field2
field3 = wa_itab2-field3
...
binary search.
if sy-subrc = 0 .
" modify the line
modify itab2 from wa_itab2 index sy-tabix.
else.
" append the line
append wa_itab2 to itab2.
sort itab2 ascending by field1 field2 field3 ... . "the key fields.
endif.
EndLoop.
FIELD-SYMBOLS: <fs_itab2> TYPE wa_itab2.
SORT itab2 BY bukrs kunnr.
LOOP AT itab INTO wa_itab.
***CHECK IF DATES EXIST***
READ TABLE itab2 ASSIGNING <fs_itab2> WITH KEY bukrs = wa_itab-bukrs
kunnr = wa_itab-kunnr
BINARY SEARCH.
if sy-subrc = 0 . "if the record are founded
<fs_itab2>-field1 = wa_itab-field1.
<fs_itab2>-field2 = wa_itab-field2.
<fs_itab2>-field3 = wa_itab-field3.
...
else.
APPEND INITIAL LINE TO itab2 ASSIGNING <fs_itab2>.
IF <fs_itab2> IS ASSIGNED.
<fs_itab2>-field1 = wa_itab-field1.
<fs_itab2>-field2 = wa_itab-field2.
<fs_itab2>-field3 = wa_itab-field3.
...
ENDIF.
ENDLOOP.
Thats is all with field symbols.
You do not need looping here, MOVE-CORRESPONDING do this for internal tables like a charm:
MOVE-CORRESPONDING src_tab TO target.
Here is the sample where MWST price conditions are selected into two itabs, then the currently valid ones are made invalid, then couple of additional invalid conditions with new key are added, and finally the second itab lt_upd_konh is updated, so that all MWST conditions in it gets invalidated with adding extra ones.
SELECT * FROM konh INTO TABLE #DATA(lt_konh) WHERE kschl = 'MWST'.
DATA(lt_upd_konh) = lt_konh.
LOOP AT lt_konh ASSIGNING FIELD-SYMBOL(<fs_konh>) WHERE datbi > sy-datum.
<fs_konh>-datbi = sy-datum - 1.
ENDLOOP.
<fs_konh>-knumh = 1000.
APPEND <fs_konh> TO lt_konh.
<fs_konh>-knumh = 1001.
APPEND <fs_konh> TO lt_konh.
<fs_konh>-knumh = 1002.
APPEND <fs_konh> TO lt_konh.
MOVE-CORRESPONDING lt_konh TO lt_upd_konh.

SAP SLT into HANA not updating date field

I would like to SLT data into our HANA Data warehouse. That is the easy part, I can move data that is a one to one match (type 1 table). But I would like to make it type 2 and preserve history. I have the following code in the transform, and it will not populate the update field.
*&---------------------------------------------------------------------*
*& Include ZAUSP_SLT_TRANSFORM
*&---------------------------------------------------------------------*
STATICS lv_syn_name TYPE tabname.
DATA con_name TYPE dbcon_name.
DATA lv_timestamp TYPE timestampl.
FIELD-SYMBOLS <lv_operation> TYPE any.
CONCATENATE _mt_id ':R:R' INTO con_name.
ASSIGN COMPONENT 'IUUC_OPERAT_FLAG' OF STRUCTURE <wa_s_AUSP> TO <lv_operation>.
IF sy-subrc = 0 AND
<lv_operation> = 'D'.
IF lv_syn_name IS INITIAL.
CALL METHOD cl_iuuc_tab_ident_access=>get_ident
EXPORTING
iv_mt_id = _mt_id
iv_tabname = _cobj_alias
iv_system_type = cl_iuuc_tab_ident_access=>co_system_receiver
iv_ident_type = cl_iuuc_tab_ident_access=>co_ident_synonym
IMPORTING
ev_full_name = lv_syn_name.
IF lv_syn_name IS INITIAL.
allog_msg 'E' 'DMC_RT_MSG' '000'
'Get Synonym Error' space space space 'IL '.
RAISE stopped_by_rule.
ENDIF.
ENDIF.
GET TIME STAMP FIELD lv_timestamp.
UPDATE (lv_syn_name) CLIENT SPECIFIED CONNECTION (con_name)
SET ZDELETE_FLAG = 'X'
ZUPD_DATETIME = lv_timestamp
WHERE mandt = <wa_s_AUSP>-mandt
AND objek = <wa_s_AUSP>-objek
AND atinn = <wa_s_AUSP>-atinn
AND atzhl = <wa_s_AUSP>-atzhl
AND mafid = <wa_s_AUSP>-mafid
AND klart = <wa_s_AUSP>-klart
AND adzhl = <wa_s_AUSP>-adzhl.
IF sy-subrc <> 0.
allog_msg 'E' 'DMC_RT_MSG' '000'
'Update Error' space space space 'IL '.
RAISE stopped_by_rule.
ENDIF.
skip_record.
ENDIF.
"Code for timestamp outside of delete.
IF lv_syn_name IS INITIAL.
CALL METHOD cl_iuuc_tab_ident_access=>get_ident
EXPORTING
iv_mt_id = _mt_id
iv_tabname = _cobj_alias
iv_system_type = cl_iuuc_tab_ident_access=>co_system_receiver
iv_ident_type = cl_iuuc_tab_ident_access=>co_ident_synonym
IMPORTING
ev_full_name = lv_syn_name.
IF lv_syn_name IS INITIAL.
allog_msg 'E' 'DMC_RT_MSG' '000'
'Get Synonym Error' space space space 'IL '.
RAISE stopped_by_rule.
ENDIF.
ENDIF.
GET TIME STAMP FIELD lv_timestamp.
UPDATE (lv_syn_name) CLIENT SPECIFIED CONNECTION (con_name)
SET ZUPD_DATETIME = lv_timestamp "slt_update is the name in your slt strucure!
WHERE MANDT = <wa_s_AUSP>-MANDT "key_1 = pk of your table
AND OBJEK = <wa_s_AUSP>-OBJEK
AND ATINN = <wa_s_AUSP>-ATINN
AND ATZHL = <wa_s_AUSP>-ATZHL
AND MAFID = <wa_s_AUSP>-MAFID
AND KLART = <wa_s_AUSP>-KLART
AND ADZHL = <wa_s_AUSP>-ADZHL.
IF sy-subrc <> 0.
allog_msg 'E' 'DMC_RT_MSG' '000'
'Update Error' space space space 'IL '.
RAISE stopped_by_rule.
ENDIF.
Why don't the time field get updated for all rows inserted into target? When I try and set a break point to debug during replication, I get the following error:
So I click one, and get the following for each one:
So I go to SE38 and try to activate each one individually:
I did not write the code in these additional programs, and do not understand how they relate to the INCLUDE I wrote. I am left thinking the INCLUDE transform I wrote is not being executed due to the background programs not being active?
The below code resolved my issue.
STATICS lv_syn_name TYPE tabname.
DATA con_name TYPE dbcon_name.
DATA lv_timestamp TYPE timestampl.
FIELD-SYMBOLS <lv_operation> TYPE any.
FIELD-SYMBOLS: <lt_log_tab> TYPE table,
<ls_log_tab> TYPE any,
<lv_primary_key_1> TYPE any,
<lv_primary_key_2> TYPE any,
<lv_primary_key_3> TYPE any,
<lv_primary_key_4> TYPE any.
*
*
*
** get operation flag
ASSIGN COMPONENT 'IUUC_OPERAT_FLAG' OF STRUCTURE <wa_s_ausp> TO <lv_operation>.
*
*
IF sy-subrc = 0 AND
<lv_operation> = 'D'.
*
*
**** replication mode and record was deleted
IF lv_syn_name IS INITIAL.
* get synonym name in case of multi use active
CALL METHOD cl_iuuc_tab_ident_access=>get_ident
EXPORTING
iv_mt_id = _mt_id
iv_tabname = _cobj_alias
* iv_tabname = 'AUSP'
iv_system_type = cl_iuuc_tab_ident_access=>co_system_receiver
iv_ident_type = cl_iuuc_tab_ident_access=>co_ident_synonym
IMPORTING
ev_full_name = lv_syn_name.
IF lv_syn_name IS INITIAL.
* set message
allog_msg 'E' 'DMC_RT_MSG' '000'
'Get Synonym Error' space space space 'IL '.
RAISE stopped_by_rule.
ENDIF.
ENDIF.
*
*
*
**** set additional target fields
GET TIME STAMP FIELD lv_timestamp.
CONCATENATE _mt_id ':R:R' INTO con_name.
UPDATE (lv_syn_name) CLIENT SPECIFIED CONNECTION (con_name)
SET deleted = 'X'
delete_time = lv_timestamp
WHERE mandt = <wa_s_ausp>-mandt
AND objek = <wa_s_ausp>-objek
AND atinn = <wa_s_ausp>-atinn
AND atzhl = <wa_s_ausp>-atzhl
AND mafid = <wa_s_ausp>-mafid
AND klart = <wa_s_ausp>-klart
AND adzhl = <wa_s_ausp>-adzhl.
IF sy-subrc <> 0.
DATA(lc_subrc) = sy-subrc.
DATA lc_ausp TYPE c LENGTH 100.
CONCATENATE <wa_s_ausp>-mandt <wa_s_ausp>-objek <wa_s_ausp>-atinn <wa_s_ausp>-atzhl <wa_s_ausp>-mafid <wa_s_ausp>-klart <wa_s_ausp>-adzhl
INTO lc_ausp SEPARATED BY ','.
* set message
allog_msg 'E' 'DMC_RT_MSG' '000'
'Update Error' space space space 'IL '.
allog_msg 'E' 'DMC_RT_MSG' '000'
'Error Details:' lv_syn_name _cobj_alias lc_subrc 'IL '.
allog_msg 'E' 'DMC_RT_MSG' '000'
'Table Details:' lc_ausp space space 'IL '.
RAISE stopped_by_rule.
ENDIF.
**** do not replicate delete
skip_record.
ELSEIF sy-subrc = 0 AND <lv_operation> = 'I'.
GET TIME STAMP FIELD <wa_r_ausp>-insert_time.
ELSEIF sy-subrc = 0 AND <lv_operation> = 'U'.
GET TIME STAMP FIELD <wa_r_ausp>-update_time.
ELSE.
*Initial load branch
GET TIME STAMP FIELD <wa_r_ausp>-insert_time.
ENDIF.