Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue with the code in record display

sri_harsha2
Participant
0 Likes
722

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.

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.

1 REPLY 1
Read only

sri_harsha2
Participant
0 Likes
677

I have made modifications to the code and the code works for most of the records. But for the same fiscal year when 230 and CUM are showing up. I will only need to select 230. I am unable to

determine how to accomplish this. I request you to let me know your valuable suggestions.

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

                            FISCPER       = ls_tab-FISCPER and

                            TRANSTYPE   ca '0123456789'.

       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

                         FISCPER       = ls_tab-FISCPER and

                         ( transtype =    cum  

                    or    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

                     FISCPER       = ls_tab-FISCPER and

                     transtype = 'PLN'  .

       ENDIF.

     ENDLOOP.