Problem with converting data types

Advertisement
November 30

Hi Experts,
I am stuck up with a little problem, i need your help
i am converting all the data types to CHAR but i am not getting the expected data out.........
My code is as below...where do i go wrong...
LOOP AT <T_ITAB> ASSIGNING <FIELD>.
DO.
   ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FIELD> TO <RECORD>.
   IF SY-SUBRC = 0.
      LV_FIELD = <RECORD>.
      N = STRLEN( LV_FIELD ).
      IF N = '8'.
           IF LV_FIELD IS NOT INITIAL.
                  LV_DATE = LV_FIELD.
                  CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
                          EXPORTING
                          DATE                     = LV_DATE
                         EXCEPTIONS
                                PLAUSIBILITY_CHECK_FAILED = 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.
                     IF SY-SUBRC EQ 0.
                        CONCATENATE LV_FIELD+6(2) LV_FIELD+4(2) LV_FIELD+0(4) INTO LV_FIELD SEPARATED BY '.'.
                    ENDIF.
            ENDIF.
         ENDIF.
            IF LV_RECORD IS INITIAL.
                     LV_RECORD = LV_FIELD.
            ELSE.
                   CONCATENATE LV_RECORD LV_FIELD INTO LV_RECORD SEPARATED BY '  * '.
           ENDIF.
       ELSE.
     EXIT." DO
    ENDIF.
   ENDDO.
  APPEND LV_RECORD TO LT_OUTPUT.
CLEAR LV_RECORD.
ENDLOOP.
THE TABLE LT_OUTPUT     LIKE     THENV(CHAR 255)
My output looks some thing like this:
04  36876   15.09.2011  39600   1999
06  36960   15.09.2011  39600   2632
07  36874   15.09.2011  39541   9232
My expected output
04    36.876  15.09.2011    39.600  1.999
06    36.960  15.09.2011    39.600  2.632
07    36.874  15.09.2011    39.541  9.232
Regards
sam

Advertisement

Replay

At run time you can see all the data........ like what i have shown...
but if you clearly see, DATE will be in the internal format..but if you print it, it will be in dd:mm:yyyy
can you suggest me if i have a dynamic field symbol (table data) ,,,, How can i convert data types dynamically..
if it is a static internal table i am achieving with WRITE TO statement.....but i have huge data in field symbols...
Instead of all these , please specify the exact problem your are facing . What is it with date field ? . In SAP while printing the internal format will be converted to external. What is your requirement with this date field?
My output looks some thing like this:
04 36876 15.09.2011 39600 1999
06 36960 15.09.2011 39600 2632
07 36874 15.09.2011 39541 9232
My expected output
04 36.876 15.09.2011 39.600 1.999
06 36.960 15.09.2011 39.600 2.632
07 36.874 15.09.2011 39.541 9.232
I dont see any problems mentioned in your date field. Both your actual and expected outputs reflects the same in date field.
In SCN you will only get solutions if your question is precise.
Kesav

View 11 Replies

Tags:

  1. inbound delivery gr
  2. itunes error code 13014 mac os 10.5.8
  3. Neha jpx pothos
  4. cisco wlc dynamic interface
  5. swimmingxgn
  6. thumb4nm
  7. meangdl
  8. notp8z
  9. carriedz2s
  10. grainoh6
Copyrights 2019 Fcffair BigData Resource, All rights reserved