Home > Default > Select on MARA resulting into # values in internal table for one field

Select on MARA resulting into # values in internal table for one field

October 11Hits:2
Advertisement
Hi Team,
I have written a SELECT statement on MARA table as below.
TRY.
        SELECT matnr zzwftag FROM mara CLIENT SPECIFIED
          INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE
          mandt = sy-mandt AND
          zzwftag NE space
          AND zzwftag IS NOT NULL
          AND zzwftag NE '#'
          AND zzwftag NE '%#%'
          AND zzwftag NE '  '
          AND zzwftag NOT LIKE '%/%'(012).
      CATCH cx_sy_dynamic_osql_error.
        MESSAGE 'Error While Fetching Data from MARA'(044) TYPE 'S'(040)  DISPLAY LIKE 'W'(041).
    ENDTRY.
    IF NOT gt_mara[] IS INITIAL.
      DELETE gt_mara[] WHERE zzwftag EQ '#'
      OR zzwftag IS INITIAL
      OR zzwftag EQ space
      OR zzwftag EQ ' '.
    ENDIF.
Observations: 1. In
the resulting internal table I am seeing '#' values for fields zzwftag which are actually empty when I see the record in SE11 in MARA(ALV display). It shows '#' in it in SE16 display(We can choose User parameters and hence mode of display in SE11)
The requirement is to avoid those records where zzwftag is initial i.e. blank. I tried to delete invalid records but to no avail.
Please suggest any way where I can get the Select correct.
Regards,
Amit

Answers

Please do not use so many not conditions in one query....
Using so many negative conditions results in bad data.
Instead use delete statements later this would not confuse the system.
Also if you are using sy-mandt then i think you should not use client specified system will take care of it.
TRY.
SELECT matnr zzwftag FROM mara CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE
mandt = sy-mandt AND
zzwftag NE space.
CATCH cx_sy_dynamic_osql_error.
MESSAGE 'Error While Fetching Data from MARA'(044) TYPE 'S'(040) DISPLAY LIKE 'W'(041).
ENDTRY.
IF NOT gt_mara[] IS INITIAL.
DELETE gt_mara[] WHERE zzwftag EQ '#'
OR zzwftag IS INITIAL
OR zzwftag EQ space
OR zzwftag EQ ' '.
delete gt_mara[] where zzwflag eq '%#%'.
ENDIF.

Read other 7 answers

Tags:

Related Articles

  • Select on MARA resulting into # values in internal table for one fieldOctober 11

    Hi Team, I have written a SELECT statement on MARA table as below. TRY.         SELECT matnr zzwftag FROM mara CLIENT SPECIFIED           INTO CORRESPONDING FIELDS OF TABLE gt_mara WHERE           mandt = sy-mandt AND           zzwftag NE space      

  • How to select set of unique data records from internal tableNovember 30

    Hi I am looking for a command in order to select all unique data-records from an internal table without using a loop. Does anybody know a command that could do this? <b><u>An illustrating example:</u></b> <i>Example: Table co

  • How to convert internal table with dynamic fields to XMLOctober 11

    Dear all, I met a problem like the following: The aim is to transform the following parameter to XML IT_FIELD stores the dynamic filed name of the internal table,with these fields, the dynamic internal can be created by cl_abap_tabledescr=>create(it_

  • Dynamic internal table and dynamic field catalogNovember 30

    hi i need to decide the number of fields of the internal table at runtime and then need to pass value to this internal table. then i need to create the field catalog for this internal table (so here field catalog is also dynamic) to display in alv. h

  • How do I select a range of rows from an internal table in the debugger?October 11

    Hi, I have a case where I wanted to delete a range of rows (several thousand) from an internal table using the debugger. It seems that rows can only be selected one at a time by selecting (clicking) on the far left side of the row. This is cumbersome

  • SELECT .... INTO CORRESPONDING  - Internal tableOctober 11

    How do everyone, I have the following work areas and internal table defintion: TYPES: BEGIN OF equi_rec,            equnr,                  " Registration            herst,                  " Make            typbz,                  " Model

  • Dynamic Internal Table with Dynamic FieldsNovember 30

    Hi all, My scenario is fairly simple---- --> End user clicks a button on screen and he gets the list of HR tables. --> Then selects a table and list of all the fields for that table gets displayed. --> He/she selects the fields they want data to

  • Unable to modify the final internal table with month fieldNovember 30

    hi everybody I am having one material which has a qty  in different months lets say that jan feb mar apr may june..... now i have caluculated the total of the material monthly wise and i have to display in the output. if the material of the first mon

  • Internal Table with variable field lengthsNovember 30

    Hi Guys, I have a requirement to populate an internal table whose structure is as follows. Internal Table will have 5 lines. Line1: 050 char Line2: 100 char Line3: 100 char Line4: 100 char Line5: 050 char. I have all the required data with me. I just

  • Count No of records in an internal table using 4 fieldsOctober 11

    Hi All, I have an internal table with about 50,000 records. I need to group these (sort) based on 4 fields and then provide the count for each combination of the 4 fields. For eg, if I have 3 records in the table which have the same values for all th

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 2.836 s.