cancel
Showing results for 
Search instead for 
Did you mean: 

Delete a record in table control during validation

0 Kudos

I am validating the data in table control.my requirement is during validation process if the wrong record is in 100 line then it will show as a first record.I have done this process but it is showing a wrong record two times as show in the figure.now I want to delete 2nd record.can you please tell me what is the process.

former_member617564
Participant
0 Kudos

Share your code.

Regards,

Chitme

0 Kudos

LOOP AT gt_r01 into /pweaver/r01.

      IF /pweaver/r01-kunnr IS NOT INITIAL.

            PERFORM check_mandatory_fields2.

    ELSEIF /pweaver/r01-kunnr IS INITIAL.

      MESSAGE 'enter customer number' TYPE 'E'.

    EXIT.

    ENDIF.

    ENDLOOP.
former_member617564
Participant
0 Kudos

Hi Amani,

You should write your code in PBO event once loop completed you should sort your internal table where customer field is initial.

0 Kudos
    TYPES: BEGIN OF ty_kna1,
               kunnr TYPE kna1-kunnr,
               name  TYPE kna1-name1,
           END OF ty_kna1.
     DATA:gt_kna1 TYPE TABLE OF ty_kna1.
     DATA:gt_r03 TYPE TABLE OF /pweaver/r01.

     gt_r03[] = gt_r01[].
  SORT gt_r03 BY kunnr.
  DELETE ADJACENT DUPLICATES FROM gt_r03 COMPARING kunnr.
  IF gt_r03[] IS NOT INITIAL.
    SELECT kunnr name1 FROM kna1 INTO TABLE gt_kna1 FOR ALL ENTRIES IN gt_r03 WHERE kunnr = gt_r03-kunnr.
  ENDIF.


  LOOP AT gt_r01 into /pweaver/r01.
      IF /pweaver/r01-kunnr IS NOT INITIAL.
            PERFORM check_mandatory_fields2.
    ELSEIF /pweaver/r01-kunnr IS INITIAL.
      MESSAGE 'enter customer number' TYPE 'E'.
    EXIT.
    ENDIF.
    ENDLOOP.
former_member617564
Participant
0 Kudos

Hi Amani,

What exactly your displaying.

Are you using MPP or ALV Report?

Regards,

Chitme

raymond_giuseppi
Active Contributor
0 Kudos

Could you post the actual code related to the table control in the PBO.

  • Should contain at least one statement LOOP ... WITH CONTROL ... Else this is not a table control and change your question(s)

Could you post the code that detected the error.

  • Can be in PAI with a LOOP AT same table than in PBO, can also be executed on whole table before first display or in a module executed at end of PAI (after PAI LOOP updated the internal table if user allowed to input) be precise, please.

Accepted Solutions (0)

Answers (1)

Answers (1)

Rajkadthala
Explorer
0 Kudos

Do you mean , you want to delete duplicate?

If my understand is right, then sort the IT based on key fields then delete adjucent duplicates using key fields.

If my understand is wrong ..

can you please elaborate your requirement

0 Kudos

I did that one also but didn't delete the second record.