Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module for string

Former Member
0 Kudos

Hello Experts,

I want to uplaod data from excel .I want to put validation that If the name1 already exists in database table LFA1, then that particular record in which that name exists will be fetched in one error internal table.

I want to match full name,irrespective of case.

Suppose We are again uploading Ran Avtar or ram avtar, this record get appended in error internal table

Is any function module exists for this.

or suggest me some other solution.

Aastha

1 REPLY 1

valter_oliveira
Active Contributor
0 Kudos

LOOP AT it_file INTO wa_file.

  SELECT SINGLE name1 FROM lfa1 INTO w_name WHERE lifnr = wa_file-lifnr.

  IF sy-subrc EQ 0.

    CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
      EXPORTING
        i_input  = wa_file-name1
        i_langu  = 'E'
      IMPORTING
        e_output = wa_file-name1.

    CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
      EXPORTING
        i_input  = w_name
        i_langu  = 'E'
      IMPORTING
        e_output = w_name.

    IF wa_file-name1 EQ w_name.
      wa_error-lifnr = wa_file-lifnr.
      wa_error-name1 = wa_file-name1.
      APPEND wa_error TO it_error.
    ELSE.
*     Your action
    ENDIF.
   
  ELSE.

    wa_error-lifnr = wa_file-lifnr.
    wa_error-name1 = wa_file-name1.
    APPEND wa_error TO it_error.

  ENDIF.

ENDLOOP.

Regards,

Valter Oliveira.