‎2010 Feb 04 1:46 PM
I am still stuggling with the subjet !!
Within a secatt; how can I get the number of entries in a table (se16/enter/CtrlF+F7) and export this in an E_parameter !?
Sorry sound stupid but 'DBCount' (Value out in Dynpro 450) is not open for a insertion of E_param_test_out !
Tks for any hints
(yes i also user command CHETAB in parrallel)
Etienne
‎2010 Feb 04 3:27 PM
Hi!
You might check out the SELECT COUNT ... ABAP statement for this.
An example:
TABLES: SCUSTOM, SBOOK.
DATA: COUNT TYPE I.
SELECT SCUSTOM~NAME SCUSTOM~POSTCODE SCUSTOM~CITY
COUNT( DISTINCT SBOOK~LOCCURAM )
INTO (SCUSTOM-NAME, SCUSTOM-POSTCODE, SCUSTOM-CITY,
COUNT)
FROM SCUSTOM INNER JOIN SBOOK
ON SCUSTOM~ID = SBOOK~CUSTOMID
WHERE SBOOK~FLDATE BETWEEN '19950101' AND '19951231' AND
SBOOK~CARRID = 'LH ' AND
SBOOK~CONNID = '0400'
GROUP BY SCUSTOM~NAME SCUSTOM~POSTCODE SCUSTOM~CITY
ORDER BY SCUSTOM~NAME.
WRITE: / SCUSTOM-NAME, SCUSTOM-POSTCODE, SCUSTOM-CITY, COUNT.
ENDSELECT.
Regards
Tamá
‎2010 Feb 04 1:54 PM
you can get database table count using FM, CATT_GET_TABLE_ENTRIES
‎2010 Feb 04 2:51 PM
Hi,
how nice of you for the quick hint.
Yes indeed - this is working (workaround) but i am struggling with the 'where'. I did also check via the se37
for instance /se37 on the famous table t003
t003
mandt=030
BLART=10
>>> not working !! (even if i drop the mandt or if i add
t003
t003-mandt=030
t003-BLART=10
Any idea !?
have a good day
‎2010 Feb 04 5:54 PM
chk system field SY_DBCNT to get records of the database table.
you can use
SELECT COUNT( * ) ... FROM ... WHERE ...
sy-dbcnt will give you the number of entries.
in this case, if you need the total number in the DB table:
SELECT COUNT( * ) ...
FROM MARA.
‎2010 Feb 05 9:49 AM
Hi,
the complete answer is
ABAP.
SELECT COUNT(*) FROM <TABLE> INTO <eCATT_local_param>.
ENDABAP.
<eCATT_export_param> = <eCATT_local_param>.
Best regards
Sebastian
‎2010 Feb 05 10:19 PM
Hi,
I tried with the SAPGUI mode recording of SE16 to find the total count and used the GETGUI to read the values from the pop-up when it is displayed if you click the number of entries button. It worked fine. In the log I can see the total count.
I tried to export the same and it worked.
SAPGUI ( SE16_230_STEP_1 ).
SAPGUI ( SE16_1000_STEP_1 ).
GETGUI ( SE16_450_STEP_1 ).
e_count = i_count.
LOG ( i_COUNT ).
thanks
Venkat
‎2010 Feb 04 3:27 PM
Hi!
You might check out the SELECT COUNT ... ABAP statement for this.
An example:
TABLES: SCUSTOM, SBOOK.
DATA: COUNT TYPE I.
SELECT SCUSTOM~NAME SCUSTOM~POSTCODE SCUSTOM~CITY
COUNT( DISTINCT SBOOK~LOCCURAM )
INTO (SCUSTOM-NAME, SCUSTOM-POSTCODE, SCUSTOM-CITY,
COUNT)
FROM SCUSTOM INNER JOIN SBOOK
ON SCUSTOM~ID = SBOOK~CUSTOMID
WHERE SBOOK~FLDATE BETWEEN '19950101' AND '19951231' AND
SBOOK~CARRID = 'LH ' AND
SBOOK~CONNID = '0400'
GROUP BY SCUSTOM~NAME SCUSTOM~POSTCODE SCUSTOM~CITY
ORDER BY SCUSTOM~NAME.
WRITE: / SCUSTOM-NAME, SCUSTOM-POSTCODE, SCUSTOM-CITY, COUNT.
ENDSELECT.
Regards
Tamá
‎2010 Feb 09 3:11 AM
Hello Member,
You can achieve this by using a dynamic ABAP statement in an eCATT script. Declare an variable and export structure parameter of type table(table[ ]). You can concatenate as many conditions and append it to structure V_COND(is of type catpaval[ ] ). The dynamic ABAP statements retrieves values for the condition in V_COND and stores it in V_TABLE structure parameter. Finally the GETLEN gets the count in local parameter V_NUMBER. Depending on the V_COUNT you can therefore export the local structure into an exporting parameter(structure).
take conditions in a variable since ABAP block does not identify Import and export view
V_MATNR = 'raw_material'.
V_MANDT = &CLIENT.
ABAP.
DATA : cond(132) TYPE C.
build condition dynamically.
IF ( '' = '' ).
set client
CONCATENATE 'MANDT = ''' V_MANDT '''' INTO cond.
APPEND cond TO V_COND.
read values from tables
SELECT *
INTO CORRESPONDING FIELDS OF TABLE V_TABLE
FROM TABLE
WHERE (V_COND).
ENDIF.
ENDABAP.
GETLEN ( V_TABLE , V_NUMBER ).
IF ( V_NUMBER > 0 ).
E_TABLE = V_TABLE.
E_NUMBER = V_NUMBER.
ENDIF.
Hope this helps.
Thanks and Kind Regards
-
Mohan
‎2010 Feb 09 10:36 AM
Fabulous
and many thks too all of you.
Very promising in our Competence center 'public sector specifiq.
tks from Brussel,