‎2022 Jun 07 3:54 PM
From the installation number(ANLAGE) go to ETRG where ABVORG equals 01 or 03 then get ADATSOLL
Please help me in writing the code in SAP ABAP. Thanks in advance
‎2022 Jun 07 3:55 PM
‎2022 Jun 07 4:24 PM
You should learn ABAP.
SELECT ADATSOLL FROM ETRG where ANLAGE = ... AND ABVORG in ('01','03') into ...Or do you have a specific question?
‎2022 Jun 07 4:37 PM
Hi,
Please try below code.
PARAMETERS:anlage type anlage.
data:it_etrg type table of etrg,
wa_etrg type etrg.
SELECT
adatsoll
from
etrg
into CORRESPONDING FIELDS OF table it_etrg
where abrvorgu in ('01','03')
and anlage = anlage.
loop at it_etrg into wa_etrg.
write:/ wa_etrg-adatsoll.
ENDLOOP.Regards,
Anuja Kawadiwale
‎2022 Jun 08 6:33 AM
anujawani2426 when you create an internal table type table of an ABAP dictionary table, you use a big quantity of memory, you have a lot of unused fields available in this internal table. Second point, there is new way of writing SELECT statement with @ before variables.
PARAMETERS anlage type anlage.
SELECT adatsoll
FROM etrg
INTO TABLE @DATA(it_etrg)
WHERE abrvorgu IN ('01','03') "<-- should be constants with human readable name
AND anlage EQ @anlage.
LOOP AT it_etrg INTO DATA(wa_etrg).
WRITE: / wa_etrg-adatsoll.
ENDLOOP.
‎2022 Jun 08 6:46 AM
Hi Frederic,
Yes i know. I just shared sample code to run and check the result. And as per requirement we can create a structure with limited fields and can declare internal table of type structure also we can use inline declaration. But as of know dont know exact requirement thats why i shared this sample code. We can do so many things for optimization when we have exact requirement.
Regards,
Anuja Kawadiwale