Skip to Content
author's profile photo Former Member
Former Member

Optimize sap coding

Hi

Tables: PA0008

LGA01 char(4)

BET01 char(13)

LGA02 char(4)

BET02 char(13)

...

LGA32 char(4)

BET32 char(13)

DATA : BEGIN OF gt_paylevel OCCURS 0.

INCLUDE STRUCTURE p0008.

DATA: END OF gt_paylevel.

DATA: plga(20),

pbet(20),

Does anyone know how to optimise this coding instead of doing it this way:-

move pa0008-lga01 to int_lga01

move pa0008-lga02 to int_lga02

Try below coding but cannot work as it move the data item's name instead of the

value of pa0008-lga01:-

LOOP AT gt_paylevel.

DO 32 TIMES.

MOVE sy-index TO count.

CONCATENATE 'gt_Paylevel-LGA' count INTO plga.

WRITE:/ plga.

ENDDO.

APPEND gt_masktab.

CLEAR gt_masktab.

ENDLOOP.

Thank you in advance.

Anisah

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jan 11, 2007 at 08:09 AM

    Hi,

    I don't know if you want to print the fields or to append them in a second internal table, but at least this example of assign should give you an idea of getting a generic move:

    DATA spfli_wa TYPE spfli. 
    
    FIELD-SYMBOLS: <wa>   TYPE ANY, 
                   <comp> TYPE ANY. 
    
    ASSIGN spfli_wa TO <wa>. 
    
    SELECT SINGLE * 
           FROM spfli 
           INTO spfli_wa 
           WHERE carrid = 'LH' AND 
                 connid = '400'. 
    
    WHILE sy-subrc = 0. 
      ASSIGN COMPONENT sy-index OF STRUCTURE <wa> TO <comp>. 
      WRITE / <comp>. 
    ENDWHILE.

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.