Application Development and Automation 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: 
Read only

Urgent - Check data exist

Former Member
0 Likes
771

Hi Everyone,

I having an upload file which contains following fields in internal table. I wanna to check the Functional Location in upload file whether is exist in system database. If that record does not exist......i want to display the name of functional location which does not found.

Below are the code....but i still not manage to check the existance of it. Please help to correct the code as i require it urgently. Appreciate ur help. Thanks.

<u><b>Internal Table:</b></u>

DATA : BEGIN OF i_input OCCURS 0,

tplnr LIKE iflo-tplnr, "Functional Location

dokar LIKE draw-dokar, "Document Type

doknr LIKE draw-doknr, "Document

doktl LIKE draw-doktl, "Document Part

dokvr LIKE draw-dokvr, "Document Version

END OF i_input.

data: lwa_input like i_input,

lv_tplnr like iflot-tplnr.

loop at i_input into lwa_input.

select single

tplnr

into lv_tplnr

from iflot

where tplnr = lwa_input-tplnr.

if sy-subrc <> 0 and lv_tplnr is initial.

write 😕 'Functional Location', lwa_input-tplnr, 'Does Not exist'.

else.

write:/ 'records found'.

endif.

clear: lwa_input, lv_tplnr.

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
679

Hi Sweet,

Your code is absolutely correct. But i think you are getting all values as does not exist. Just try this conversion exit Function Module 'CONVERSION_EXIT_TPLNR_INPUT'. it should work fine.

&----


*& Report ZGS_TEST1

*&

&----


*&

*&

&----


REPORT ZGS_TEST1.

DATA : BEGIN OF i_input OCCURS 0,

tplnr LIKE iflo-tplnr, "Functional Location

dokar LIKE draw-dokar, "Document Type

doknr LIKE draw-doknr, "Document

doktl LIKE draw-doktl, "Document Part

dokvr LIKE draw-dokvr, "Document Version

END OF i_input.

data: lwa_input like i_input,

lv_tplnr like iflot-tplnr.

loop at i_input into lwa_input.

CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'

EXPORTING

input = lwa_input-tplnr

  • I_FLG_CHECK_INTERNAL = 'X'

IMPORTING

OUTPUT = lwa_input-tplnr

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

select single

tplnr

into lv_tplnr

from iflot

where tplnr = lwa_input-tplnr.

if sy-subrc <> 0 and lv_tplnr is initial.

write 😕 'Functional Location', lwa_input-tplnr, 'Does Not exist'.

else.

write:/ 'records found'.

endif.

clear: lwa_input, lv_tplnr.

endloop.

Please reward sweet points,

Aleem.

Hi Everyone,

I having an upload file which contains following fields in internal table. I wanna to check the Functional Location in upload file whether is exist in system database. If that record does not exist......i want to display the name of functional location which does not found.

Below are the code....but i still not manage to check the existance of it. Please help to correct the code as i require it urgently. Appreciate ur help. Thanks.

<u><b>Internal Table:</b></u>

DATA : BEGIN OF i_input OCCURS 0,

tplnr LIKE iflo-tplnr, "Functional Location

dokar LIKE draw-dokar, "Document Type

doknr LIKE draw-doknr, "Document

doktl LIKE draw-doktl, "Document Part

dokvr LIKE draw-dokvr, "Document Version

END OF i_input.

data: lwa_input like i_input,

lv_tplnr like iflot-tplnr.

loop at i_input into lwa_input.

select single

tplnr

into lv_tplnr

from iflot

where tplnr = lwa_input-tplnr.

if sy-subrc <> 0 and lv_tplnr is initial.

write 😕 'Functional Location', lwa_input-tplnr, 'Does Not exist'.

else.

write:/ 'records found'.

endif.

clear: lwa_input, lv_tplnr.

endloop.

3 REPLIES 3
Read only

Former Member
0 Likes
679

hi,

you can change internal table tabale field and try.............

DATA : BEGIN OF i_input OCCURS 0,

<b> tplnr LIKE iflo-tplnr, "Functional Location</b>

dokar LIKE draw-dokar, "Document Type

doknr LIKE draw-doknr, "Document

doktl LIKE draw-doktl, "Document Part

dokvr LIKE draw-dokvr, "Document Version

END OF i_input.

you decalre that field of type <b>iflot-tplnr</b> not like t iflo-tplnr.

DATA : BEGIN OF i_input OCCURS 0,

<b> tplnr LIKE iflot-tplnr, "Functional Location</b>

dokar LIKE draw-dokar, "Document Type

doknr LIKE draw-doknr, "Document

doktl LIKE draw-doktl, "Document Part

dokvr LIKE draw-dokvr, "Document Version

END OF i_input.

if possible create structure with TYPES statement insted of creating with DATA.

regards,

Ashok Reddy

Read only

0 Likes
679

Hi Ashok,

It seem like all floc from input file (internal table)are displayed as 'does not exist'.

Is it the correct way to check the data exist against database?

I only want check against my input file to determine the floc whether exist in db.

if does not exist......display that records as error.

Read only

Former Member
0 Likes
680

Hi Sweet,

Your code is absolutely correct. But i think you are getting all values as does not exist. Just try this conversion exit Function Module 'CONVERSION_EXIT_TPLNR_INPUT'. it should work fine.

&----


*& Report ZGS_TEST1

*&

&----


*&

*&

&----


REPORT ZGS_TEST1.

DATA : BEGIN OF i_input OCCURS 0,

tplnr LIKE iflo-tplnr, "Functional Location

dokar LIKE draw-dokar, "Document Type

doknr LIKE draw-doknr, "Document

doktl LIKE draw-doktl, "Document Part

dokvr LIKE draw-dokvr, "Document Version

END OF i_input.

data: lwa_input like i_input,

lv_tplnr like iflot-tplnr.

loop at i_input into lwa_input.

CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'

EXPORTING

input = lwa_input-tplnr

  • I_FLG_CHECK_INTERNAL = 'X'

IMPORTING

OUTPUT = lwa_input-tplnr

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

select single

tplnr

into lv_tplnr

from iflot

where tplnr = lwa_input-tplnr.

if sy-subrc <> 0 and lv_tplnr is initial.

write 😕 'Functional Location', lwa_input-tplnr, 'Does Not exist'.

else.

write:/ 'records found'.

endif.

clear: lwa_input, lv_tplnr.

endloop.

Please reward sweet points,

Aleem.