Skip to Content
0
Jan 28, 2016 at 04:13 PM

Issue with the code in record display

22 Views

Hello Gurus,

I have an issue with the records display in the table. The requirement is that a record is displayed in the table in 3 transfer types.

for example : CUM, PLN and number 230 for asset 100000. When there is a number displaying in transtype then CUM and PLN

recordsshould be deleted. If there is no number diplsaying in Trasntype the 'CUM' should be picked and displayed PLN must

be deleted. The below code is right as per knowledge but it does not give the exact result. In example 1 CUM is also showing

up along with the number 230. I request you to let me know if I can make any changes in the code below.

Example 1

Example 2

data : ls_tab type _ty_s_SC_1,

ls_srs type _ty_s_SC_1,

lt_tab TYPE STANDARD TABLE OF _ty_s_SC_1.

refresh lt_tab .

append LINES OF SOURCE_PACKAGE to lt_tab.

LOOP AT lt_tab into ls_tab.

LOOP at SOURCE_PACKAGE into ls_srs

where COMP_CODE = ls_tab-COMP_CODE and

ASSET_MAIN = ls_tab-ASSET_MAIN and

ASSET = ls_tab-ASSET and

TRANSTYPE ca '0123456789'.

exit.

endloop.

IF sy-subrc = 0.

delete SOURCE_PACKAGE

where COMP_CODE = ls_tab-COMP_CODE and

ASSET_MAIN = ls_tab-ASSET_MAIN and

ASSET = ls_tab-ASSET and

transtype = 'CUM' .

delete SOURCE_PACKAGE

where COMP_CODE = ls_tab-COMP_CODE and

ASSET_MAIN = ls_tab-ASSET_MAIN and

ASSET = ls_tab-ASSET and

transtype = 'PLN' .

.

else.

delete SOURCE_PACKAGE

where COMP_CODE = ls_tab-COMP_CODE and

ASSET_MAIN = ls_tab-ASSET_MAIN and

ASSET = ls_tab-ASSET and

transtype = 'PLN' .

ENDIF.

ENDLOOP.

Attachments

abap asset 1.png (16.8 kB)
abap asset2.png (12.8 kB)
abap asset3.png (16.6 kB)