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

problem generating material code.

Former Member
0 Likes
401

Dear all ,

i have a problem where i have to display a WBS number and its corresponding WBS's , each WBS under the main WBS has to be displayed with a two character identifier attached to it.like

1. HES-00100----


main WBS

2. HES-00100.01AA-----next WBS under it with AA attached.

3. HES-00100.02AB-----next WBS under it with AB attached.

4. HES-00100.02AC-----next WBS under it with AC attached.

Now i know how to display the list but how to concatenate an increasing character AA ,AB,AC....AZ and again BA,BB,BC.....BZ and CA,CB,CC.............CZ and so on under each main WBS.........any help wud be greatfull.

Thanks in advance,

Naren

1 ACCEPTED SOLUTION
Read only

former_member222860
Active Contributor
0 Likes
375

Hi,

You can try like this:

DATA: STR TYPE STRING VALUE 'HES-00100.01A'.
data: letter type c.
DATA: len type I.

  DO 26 TIMES.
    sy-index = sy-index - 1.
  letter = sy-abcde+sy-index(1).
   concatenate STR LETTER into STR.
WRITE: / STR.
  len = strlen( str ).
  len = len - 1.
  str = str+0(len).
ENDDO.

Mahesh

2 REPLIES 2
Read only

former_member222860
Active Contributor
0 Likes
376

Hi,

You can try like this:

DATA: STR TYPE STRING VALUE 'HES-00100.01A'.
data: letter type c.
DATA: len type I.

  DO 26 TIMES.
    sy-index = sy-index - 1.
  letter = sy-abcde+sy-index(1).
   concatenate STR LETTER into STR.
WRITE: / STR.
  len = strlen( str ).
  len = len - 1.
  str = str+0(len).
ENDDO.

Mahesh

Read only

Former Member
0 Likes
375

types: BEGIN OF t_alp,

c1 TYPE c,

END OF t_alp.

data: itab type TABLE OF t_alp,

wa_itab type t_alp,

wa_itab_1 type t_alp,

i type i.

wa_itab-c1 = 'A'.

APPEND wa_itab to itab.

wa_itab-c1 = 'B'.

APPEND wa_itab to itab.

wa_itab-c1 = 'C'.

APPEND wa_itab to itab.

wa_itab-c1 = 'D'.

APPEND wa_itab to itab.

wa_itab-c1 = 'E'.

APPEND wa_itab to itab.

wa_itab-c1 = 'F'.

APPEND wa_itab to itab.

wa_itab-c1 = 'G'.

APPEND wa_itab to itab.

wa_itab-c1 = 'H'.

APPEND wa_itab to itab.

wa_itab-c1 = 'I'.

APPEND wa_itab to itab.

wa_itab-c1 = 'J'.

APPEND wa_itab to itab.

data: stringe TYPE string.

do 50 times. ---> ur main loop

READ TABLE itab into wa_itab_1 INDEX sy-index.

loop at itab into wa_itab.

i = sy-tabix mod 10.

CONCATENATE : 'x' wa_itab_1 wa_itab-c1 into stringe. --> x is ur value ... H.xxx

write : / stringe.

endloop.

enddo.

Edited by: Veeranji Reddy on May 7, 2009 11:21 AM