Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Table conversion

Hi,

I have a screen maintained in the following format.

CCD          CCR
------------------------
XXX            1111
YYY           3333
ZZZ             7777

But it is maintained in the table as follows

Key      CCD1   CCR1    CCD2 CCR2  CCD3  CCR3
-----------------------------------------------------------------------------
k           XXX       1111      yyy   3333    zzz    7777 

how do i access these values in an internal table, in the follwing format

   xxx 1111
   yyy  3333 

and so on

Tags:
replied
DATA: BEGIN OF text, 
        word1 TYPE c LENGTH 4 VALUE 'AAAA', 
        word2 TYPE c LENGTH 4 VALUE 'BBBB', 
        word3 TYPE c LENGTH 4 VALUE 'CCCC', 
        word4 TYPE c LENGTH 4 VALUE 'DDDD', 
      END OF text. 

DATA: word  TYPE c LENGTH 4, 
      char1 TYPE c LENGTH 1, 
      char2 TYPE c LENGTH 1, 
      leng TYPE i. 

FIELD-SYMBOLS <word> LIKE text-word1. 
DATA inc TYPE i. 

DESCRIBE FIELD text LENGTH leng IN CHARACTER MODE. 
leng = leng / 2. 

DO leng TIMES VARYING char1 FROM text(1) 
                            NEXT text+2(1) RANGE text 
              VARYING char2 FROM text+1(1) 
                            NEXT text+3(1) RANGE text. 
  WRITE: char1, char2. 
  char1 = 'x'. 
  char2 = 'y'. 
ENDDO. 

DO 4 TIMES VARYING word FROM text-word1 NEXT text-word2. 
  WRITE / word. 
ENDDO. 

DO. 
  inc = sy-index  - 1. 
  ASSIGN text-word1 INCREMENT inc TO <word> RANGE text. 
  IF sy-subrc = 0. 
    WRITE / <word>. 
  ELSE. 
    EXIT. 
  ENDIF. 
ENDDO. 

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question