cancel
Showing results for 
Search instead for 
Did you mean: 

Expert routine.

Former Member
0 Kudos

Hi,

I have a question. I need to calculate missing miles in the expert routine.

I'm not good in ABAP, I tried to write the code but i have problem to get continue with 1 record to another record. can please some one help me to write a code.

Thanks,

Master data of Function location

Function location    From miles   To miles

AB0001                 500             600

Transaction data:

FL                MDOC         From miles        Tomiles

AB0001        00001          504                    510

AB0001        00001          522                    526

AB0001        00001          560                    566

In this Case missing miles are

Mismiles From        Mismiles To

500                        504

510                        522

526                        560

566                        600

The Function location lenght could be start from 0 or 80 0r 110.....

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Pria

Don't use the 'READ INTERNAL TABLE' because it only reads one (1) record.

Instead, do in a loop and append the records to another internal table, and at the end, set the

contents of the sp to = the appended internal table.

Former Member
0 Kudos

Hi,

I'm not able to do bring second record, can someone please give me the logic.

Thanks

Former Member
0 Kudos

Hi pria,

As said by Gerry you need loop the internal table rather than reading internal table and can you share how many records do have in master data table i.e how many different records are existed for Function location .

Former Member
0 Kudos

Hello,

Could you be a little more precise on what you're trying to do. What do you want to store in your target? Your transactional data and additional lines (the missing ones). If so, you can use a standard transformation and add entries in your source package in the start routine. If you don't feel at ease with ABAP it should be easier than using an expert routine.

Regards

Christophe

Former Member
0 Kudos

Thanks for reply,

I need to add missing miles in internal table and than load in key figures missing from and missing to so it looks like

FL                MDOC         From miles        Tomiles    Missing_from    Missing_to

AB0001        00001          504                    510            510                     600

Former Member
0 Kudos

so i need some code to achive this target.

currently i'm trying to achive like this

Loop source_pakage assigned to <sp>

read internal table abc(which have 3 values for this Mdoc)

i'm stuck on bring second record in sequence.

Please give me some example code .

Thanks

fcorodriguezl
Contributor
0 Kudos

Hi, something like this. Regards.

DATA: T_ABC TYPE TABLE OF STRUCTURE.

            W_ABC LIKE LINE OF T_ABC.

SELECT  FL

                MDOC

                MISSINGFROM

                MISSINGTO

INTO TABLE T_ABC

FOR ALL ENTRIES IN SOURCE_PACKAGE

WHERE FL = SOURCE_PACKAGE-FL AND

               MDOC = SOURCE_PACKAGE-MDOC.

IF SY-SUBRC EQ 0.

    SORT T_ABC BY FL MDOC.

ENDIF.

LOOP SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.

     READ TABLE T_ABC INTO W_ABC WITH KEY FL = <SOURCE_FIELDS>-FL

                                                                                   MDOC = <SOURCE_FIELDS>-MDOC

     BINARY SEARCH.

     IF SY-SUBRC EQ 0.

          <SOURCE_FIELDS>-MISSINGFROM = W_ABC-MISSINGFROM.

         <SOURCE_FIELDS>-MSSINGTO = W_ABC-MISSINGTO.

     ENDIF.

ENDLOOP.

Former Member
0 Kudos

Hi,

Can you please tell me show to calculate missing from an missing to.

Thanks

Former Member
0 Kudos

any reply, any comments


0 Kudos

Hi,

Use Loop statement instead of read,

LOOP SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.

     LOOP T_ABC INTO W_ABC WITH KEY FL = <SOURCE_FIELDS>-FL

                                                                                   MDOC = <SOURCE_FIELDS>-MDOC.

   

          <SOURCE_FIELDS>-MISSINGFROM = W_ABC-MISSINGFROM.

         <SOURCE_FIELDS>-MSSINGTO = W_ABC-MISSINGTO.

     ENDLOOP.

ENDLOOP.

Read Statement = Reads only 1st records from the internal table.

Loop Statement = Reads all records form the internal Table.

Regards,

Poomagal S

Former Member
0 Kudos

Please reply me.

Former Member
0 Kudos

any reply