Application Development 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: 

user copy an existing record in sm30 then garbage value coming

Former Member
0 Kudos

Hi Experts,

   

Actually I inserted this custom code to sort the table data based on period(MM/YYYY).If i commented this code then everything working fine apart from sorting but when i uncommented this code then we copy an existing record then garbage value coming like below

              

Below is the custom code i have used in PBO of maintanence screen.

data :lt_result TYPE TABLE OF ZHRPYT_PVFTMAP,

         ls_result LIKE LINE OF lt_result,

         lt_temp1 TYPE TABLE OF ZHRPYT_PVFTMAP,

         ls_temp1 LIKE LINE OF lt_temp1.

    if sy-ucomm = 'NEWL' or sy-ucomm = 'KOPE' or sy-pfkey = 'EALX'.

     else.

   SELECT * FROM ZHRPYT_PVFTMAP INTO TABLE lt_result.

   LOOP at lt_result INTO ls_result.

        ls_temp1 = ls_result.

        APPEND ls_temp1 to lt_temp1.

   ENDLOOP.

   SORT lt_temp1 by ZPERIOD+3(4).

   delete ADJACENT DUPLICATES FROM lt_temp1 COMPARING ZPERIOD+3(4).

   Data :lv_lyr(4) TYPE c,lv_hyr(4) type c,lv_line TYPE i.

   READ TABLE lt_temp1 INTO ls_temp1 INDEX 1.

   lv_lyr = ls_temp1-ZPERIOD+3(4).

   clear ls_temp1.

   lv_line = lines( lt_temp1 ).

   READ TABLE lt_temp1 INTO ls_temp1 INDEX lv_line.

   lv_hyr = ls_temp1-ZPERIOD+3(4).

   refresh extract[].

   refresh total[].

   DATA :lv_t(7) TYPE c,lv_count TYPE i VALUE 1,lv_c(2) TYPE c VALUE '00',

         lv_mandt(3) TYPE c, ZEMPAID(10) TYPE c,ZEMEARN(10) TYPE c,ZEMTTL(10) TYPE c,ZCOPAID(10) TYPE c,

         ZCOEARN(10) TYPE c,ZCOTTL(10) TYPE c,ZGRNDTTL(10) TYPE c,lv_aedtm(8) TYPE C,lv_uname(12) TYPE c,str(128) TYPE c.

   LOOP at lt_temp1 INTO ls_temp1.

         WHILE lv_count le 12.

           lv_c = lv_count.

           if lv_count lt 10.

          CONCATENATE '0' lv_c '/' ls_temp1-ZPERIOD+3(4) INTO lv_t.

          ELSE.

          CONCATENATE lv_c '/' ls_temp1-ZPERIOD+3(4) INTO lv_t.

          ENDIF.

         CLEAR total.

         LOOP at lt_result INTO <vim_total_struc> WHERE ZPERIOD = lv_t.

           APPEND total.

          CLEAR :ls_result,str,ZEMPAID,ZEMEARN,ZEMTTL,ZEMTTL,ZCOPAID,ZCOEARN,ZCOTTL,ZGRNDTTL,lv_aedtm,lv_uname.

          CLEAR <vim_total_struc>.

        ENDLOOP.

        lv_count = lv_count + 1.

        ENDWHILE.

        CLEAR: lv_count,ls_temp1.

   ENDLOOP.

    EXTRACT[] = total[].

    endif.

Anyone could you please help me in resolving this..thanks in advance

8 REPLIES 8

former_member202771
Contributor
0 Kudos

Hi Kranthi,

This could be issue with user profile date format in SU01D in under defaults tab.

Use CALL FUNCTION 'FORMAT_DATE_4_OUTPUT' for date conversion into period.

Thanks,

Anil

0 Kudos

Code I wrote recently for sorting based on field and it worked perfect for me.

in SAP internal date format (YYYYMMDD)

For your sort by  required value

0 Kudos

Hi joffy john,

   Thanks for ur rply

  But i wrote the below code but amgetting dump

Data lt_temp1 TYPE TABLE OF ZHRPYT_PVFTMAP,

        

        lt_temp1[] = extract[].

0 Kudos

Hi Kranthi,

Can you please paste the Runtime error what you are getting when using Sort.

Thanks & Regards,

Raghunadh Kodali.

0 Kudos

Hi every one

   Below is the dumb...please see the dumb am getting ... help me joffy john this is on priority

0 Kudos

Hi Kranthi,

From the above Runtime error I observered that the two internal tables are of different type .

Please check the types of below tables.

Extract and temp1.

if you assign the same type for Tem1 as of Extract then you will not get this dump.

Please check the TEMP1 Declaration and declare the TEMP1 as of EXTRACT.

or else.

you can loop the temp1 itab and move the Fill the Extract Itab.

I hope this will be helpful.

Thanks & Regards,

Raghunadh Kodali.

0 Kudos

Hi joffy John,

    You have taken the internal table lt_lcl_table.could you please tell me this internal table is of which type either custom or Extract[].

    THanks in advance...

0 Kudos

your custom table type