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

Displaying PM charecteristics

Former Member
0 Likes
1,267

Hi All ,

I am extracting the PM equipement charecterisics value from AUSP-ATFLV   which is 1,123000000000000E+03, Now I want to display it in the format of TCPA-ATSCH i.e.  1.123 .

Please suggest how to do it.

Regards,

Sagar

Hi All ,

I am extracting the PM equipement charecterisics value from AUSP-ATFLV   which is 1,123000000000000E+03, Now I want to display it in the format of TCPA-ATSCH i.e.  1.123 .

Please suggest how to do it.

Regards,

Sagar

6 REPLIES 6
Read only

Former Member
0 Likes
1,126

Hi Sagar,

Copy 1,123000000000000E+03 into string variable v1 and delete trailing zeros using below command.

SHIFT v1 RIGHT DELETING TRAILING '0'.

Now copy v1 into v2(type TCPA-ATSCH) and then use conversion_exit_alpha_input for v2.

Hope its useful.

Regards,

Rajesh

Read only

Former Member
0 Likes
1,126

1,1230000000000E+03.

it should not b like this, rather it should be 1.1230000000000E+03.

(there shold be decimal(.) in place of comma(,)).

first check the DECIMAL NOTATION assigned to the user id u are using in T-CODE SU01.

Then follow the steps as mentioned by RAJESH.

Read only

Former Member
0 Likes
1,126

In addiion to my query, I want to display the chareceristics value as its geting displayed in CT04 transaction,

Rajesh and Abhishek thanks for ur reply but I tried with all the things which u have mentioned  and no expected output for the same .

Read only

Former Member
0 Likes
1,126

OK, I have tried this logic in my system.

it will definately help u to get the value from this long lenthy string with lots of zeros.

DATA ATFLV TYPE AUSP-ATFLV VALUE '9.856000000000000E+01 '.

DATA: LV_P(15) TYPE P DECIMALS 3."DECIMALS (? HOWEVER MANY YOU NEED),

DATA LV_ATFOR TYPE string.

-------------------------------------------

  LV_P  = 0 + ATFLV.

  MOVE LV_P TO LV_ATFOR.

  CONDENSE LV_ATFOR."lv_atfor will give u the final value.

-------------------------------------------

for ur 2nd query,

if u want ct04 --> characterstics values then all of them u may find in FIELD -> CAWN-ATWRT.

Check for the other fields of this table.

Read only

Former Member
0 Likes
1,126

Hi

Try something like following

CALL FUNCTION 'COC1_CONV_VALUES_FOR_OUTPUT'
  EXPORTING
    CHARACTERISTIC_VALUE_FLOAT  = AUSP-ATFLV
    FORMAT                                         = 'NUM'
    CHARACTERISTIC_ID                      = AUSP-ATINN
  IMPORTING
    VALUE_FOR_OUTPUT                     = LV_VALUE "your value variable
  EXCEPTIONS
    FORMAT_NOT_VALID                     = 1
    CHARACTERISTIC_ID_NOT_VALID  = 2
    OTHERS                                        = 3.

Regards

George

Read only

iftah_peretz
Active Contributor
0 Likes
1,126

Hi Sagar,

Here is an answer to both you questions the scenario assumes a Class named TT in MARA under 001 and it has characteristic, with a numeric value named TT_CHAR:

  "Local vars.

     DATA:

           ALLOCVALUESNUM   TYPE TABLE OF  BAPI1003_ALLOC_VALUES_NUM,
           WA_ALLOCVALUESNUM    LIKE LINE OF ALLOCVALUESNUM,
           ALLOCVALUESCHAR  TYPE TABLE OF BAPI1003_ALLOC_VALUES_CHAR,
           ALLOCVALUESCURR  TYPE TABLE OF BAPI1003_ALLOC_VALUES_CURR,
           STATUS           TYPE  BAPI1003_KEY-STATUS ,
           RETURN           TYPE TABLE OF  BAPIRET2 ,
           OBJECTKEY        TYPE  BAPI1003_KEY-OBJECT,
           WA_RET           LIKE LINE OF RETURN,
           L_VAR            TYPE p DECIMALS 2.

   "Adjust the object key

       OBJECTKEY = Itab-MATNR.

   "Check for the class you are intrested in its char.
       CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
       EXPORTING
         OBJECTKEY              = OBJECTKEY
         OBJECTTABLE            = 'MARA'
         CLASSNUM               = 'TT'
         CLASSTYPE              = '001'

*        KEYDATE                = SY-DATUM
*        UNVALUATED_CHARS       = ' '
*        LANGUAGE               = SY-LANGU

     IMPORTING
        STATUS                 = STATUS

*        STANDARDCLASS          =

      TABLES
       ALLOCVALUESNUM         = ALLOCVALUESNUM
       ALLOCVALUESCHAR        = ALLOCVALUESCHAR
       ALLOCVALUESCURR        = ALLOCVALUESCURR

       RETURN                 = RETURN.



IF SY-SUBRC EQ 0.

   "Check if contains a TT classification

READ TABLE RETURN INTO WA_RET INDEX 1.
IF WA_RET-NUMBER EQ '731'.
"Check for the char of tt with the name tt_char
   LOOP AT ALLOCVALUESNUM INTO WA_ALLOCVALUESNUM

   WHERE CHARACT EQ 'TT_CHAR'.

          L_VAR = WA_ALLOCVALUESNUM-VALUE_FROM.

          WRITE:/ L_VAR.

          L_VAR = WA_ALLOCVALUESNUM-VALUE_TO.

          WRITE:/ L_VAR.

     ENDLOOP.

ENDIF.

ENDIF.

That's it all you have to do is copy and paste the first bold part shows how to get the values and the second how to covert, lets say 1,123000000000000E+03 to a regular one.

Hope you all can use this!!

Let me know if it helped you,

Best,

Iftah