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

Getting next number in specific format.

Former Member
0 Likes
1,837

Hello experts,

I am currently working on the Product Management System hierarchy. In which we are maintaining

                         

  •    PRODUCT
    • SUBPRODUCT
      • VERSION
        • PACKAGE

I am getting a bit problem while creating version. We have a screen like   

               

From which we used to create version. Logic behind the screen is 

                       VERSION = LATEST VERSION

Next what i want to do is get next version to latest version in the box near VERSION. In this case the box should display 0.0.4 instead of 0.0.3. For this I have used logic as

                         VERSION = LATEST VERSION + 1.

Its working absolutely fine, just getting problem on the screen as below

                

The box displaying ..4 instead of 0.0.4. If you have any idea how to achieve this please share it with me.

Thanks,

Avadhut

1 ACCEPTED SOLUTION
Read only

adrian_mejido
Contributor
0 Likes
1,796

Hi Avadhut,

Could you tell us what are your fields VERSION and LATEST VERSION type?

Best Regards

Hello experts,

I am currently working on the Product Management System hierarchy. In which we are maintaining

                         

  •    PRODUCT
    • SUBPRODUCT
      • VERSION
        • PACKAGE

I am getting a bit problem while creating version. We have a screen like   

               

From which we used to create version. Logic behind the screen is 

                       VERSION = LATEST VERSION

Next what i want to do is get next version to latest version in the box near VERSION. In this case the box should display 0.0.4 instead of 0.0.3. For this I have used logic as

                         VERSION = LATEST VERSION + 1.

Its working absolutely fine, just getting problem on the screen as below

                

The box displaying ..4 instead of 0.0.4. If you have any idea how to achieve this please share it with me.

Thanks,

Avadhut

8 REPLIES 8
Read only

adrian_mejido
Contributor
0 Likes
1,797

Hi Avadhut,

Could you tell us what are your fields VERSION and LATEST VERSION type?

Best Regards

Read only

0 Likes
1,796

Hi Adrián Mejido ,

Both are CHAR 6. I have debugged the code i observed that when I retrieve LATEST VERSION from table then its value is like 000001 (e.g.). But when i add 1 to this value means for step

VERSION = LATEST VERSION + 1. then it will become 2 and so on. I want 000002 instead of just 2. Do you have any idea what is to be done?

Thanks,

Avadhut

Read only

0 Likes
1,796

Hi Advadhut,

After add 1 to the version, use the FM 'CONVERSION_EXIT_ALPHA_INPUT' .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
   EXPORTING
     INPUT         = VERSION
   IMPORTING
    OUTPUT        = VERSION.



Best Regards

Read only

0 Likes
1,796

Hi Adrián Mejido,

Thanks for info its working but not absolutely. If LATEST VERSION is 0.0.9 then it should propose 0.1.0 in the box but instead its displaying 0.0.10. 

Read only

0 Likes
1,796

Hi Avadhut,

Obviously, that is a bit difficult, this code should work.

DATA: LASTVERSION_h(2),
       LASTVERSION_m(2),
       LASTVERSION_l(2),
       VERSION_h(2),
       VERSION_m(2),
       VERSION_l(2).





   SHIFT LASTVERSION RIGHT DELETING TRAILING SPACE.

   CLEAR: LASTVERSION_h,
          LASTVERSION_m,
          LASTVERSION_l,
          VERSION_h,
          VERSION_m,
          VERSION_l.

   LASTVERSION_h = LASTVERSION(2).
   LASTVERSION_m = LASTVERSION+2(2).
   LASTVERSION_l = LASTVERSION+4(2).


   IF LASTVERSION_l <= 8.

     VERSION_L = LASTVERSION_l + 1.
     VERSION_M = LASTVERSION_M.
     VERSION_H = LASTVERSION_H.


   ELSEIF LASTVERSION_m <= 8.


     VERSION_M = LASTVERSION_m + 1.
     VERSION_H = LASTVERSION_H.

   ELSEIF LASTVERSION_h < 8.

     VERSION_h = LASTVERSION_h + 1.

   ENDIF.




   IF VERSION_L IS INITIAL.
     VERSION_l = '0'.
   ENDIF.

   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       INPUT  = VERSION_L
     IMPORTING
       OUTPUT = VERSION_L.

   IF VERSION_m IS INITIAL.
     VERSION_m = '0'.
   ENDIF.
   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       INPUT  = VERSION_M
     IMPORTING
       OUTPUT = VERSION_M.

   IF VERSION_h IS INITIAL.
     VERSION_h = '0'.
   ENDIF.
   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       INPUT  = VERSION_H
     IMPORTING
       OUTPUT = VERSION_H.



   CONCATENATE VERSION_H VERSION_M VERSION_L INTO VERSION.





   SHIFT LASTVERSION RIGHT DELETING TRAILING SPACE.

   CLEAR: LASTVERSION_h,
          LASTVERSION_m,
          LASTVERSION_l,
          VERSION_h,
          VERSION_m,
          VERSION_l.

   LASTVERSION_h = LASTVERSION(2).
   LASTVERSION_m = LASTVERSION+2(2).
   LASTVERSION_l = LASTVERSION+4(2).


   IF LASTVERSION_l <= 8.

     VERSION_L = LASTVERSION_l + 1.
     VERSION_M = LASTVERSION_M.
     VERSION_H = LASTVERSION_H.


   ELSEIF LASTVERSION_m <= 8.


     VERSION_M = LASTVERSION_m + 1.
     VERSION_H = LASTVERSION_H.

   ELSEIF LASTVERSION_h < 8.

     VERSION_h = LASTVERSION_h + 1.

   ENDIF.




   IF VERSION_L IS INITIAL.
     VERSION_l = '0'.
   ENDIF.

   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       INPUT  = VERSION_L
     IMPORTING
       OUTPUT = VERSION_L.

   IF VERSION_m IS INITIAL.
     VERSION_m = '0'.
   ENDIF.
   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       INPUT  = VERSION_M
     IMPORTING
       OUTPUT = VERSION_M.

   IF VERSION_h IS INITIAL.
     VERSION_h = '0'.
   ENDIF.
   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       INPUT  = VERSION_H
     IMPORTING
       OUTPUT = VERSION_H.



   CONCATENATE VERSION_H VERSION_M VERSION_L INTO VERSION.

Best Regards and don't forget to rate me please

Read only

0 Likes
1,796

Hi Adrián Mejido,

I have done with the desired requirement. Thanks for the FM info. 

Read only

ThangaPrakash
Active Contributor
0 Likes
1,796

Hello Avadhut,

1) Try by declaring the VERSION of type NUM06.

                              OR

2) Use a data element in which the domain has a conversion routine in it.

Regards,

TP

Read only

0 Likes
1,796

Hi Thanga Prakash,

Thanks for reply. The version was already defined by other developer in tables. So it would be better to convert it into program instead of replacing in all the tables.