‎2014 Apr 14 12:00 PM
Dear Experts,
I am new to ABAP. I have a very basic question but looks a quite puzzling one to me. Hemnce I am posting it here.
I am facing an unique problem in pulling data from database table and populating that data into internal table for further use.
The data in the database table "Zlt_mita" with fields M1 (Employee Name, Type: Char20) and M2 (Employee Code, Type Char7) are:
Plz refer the screenshot in the attached file:
My Code:
1) When I try to pull data from Dbase table by taking M2 as parameter.
This code is succcessful and I am able to populate data in internal table it_dat.
TYPES: Begin Of ty_DAT,
M1 TYPE Zlt_mita-M1,
M2 TYPE ZLT_mita-M2,
END OF ty_DAT.
DATA: it_dat TYPE STANDARD TABLE OF ty_dat with header line,
wa_dat TYPE ty_dat.
PARAMETERS: p_mitar TYPE Zlt_Mita-M2.
SELECT M1
M2
FROM ZLt_mita
INTO TABLE it_dat
Where M2 = p_mitar.
Loop at it_dat into wa_dat.
WRITE:/2 wa_dat-M1,
10 wa_dat-M2.
ENDLOOP.
2) When I try to pull data from Dbase table by taking M1 as parameter.
This code is NOT succcessful and I am NOT able to populate data in internal table it_dat.
TYPES: Begin Of ty_DAT,
M1 TYPE Zlt_mita-M1,
M2 TYPE ZLT_mita-M2,
END OF ty_DAT.
DATA: it_dat TYPE STANDARD TABLE OF ty_dat with header line,
wa_dat TYPE ty_dat.
PARAMETERS: P_Mita TYPE ZLT_Mita-M1.
SELECT M1
M2
FROM ZLt_mita
INTO TABLE it_dat
Where M1 = P_Mita.
Loop at it_dat into wa_dat.
WRITE:/2 wa_dat-M1,
10 wa_dat-M2.
ENDLOOP.
Why is this happening when both M1 and M2 are Type Character fields.
Looking forward for your replies.
Regards
Chandan Kumar
‎2014 Apr 14 12:15 PM
Hi,
check if the domain of M1 is having the lower case tick or not and enter the name with space as in Database.
hope it helps...
‎2014 Apr 14 12:08 PM
Hi,
as this is character format, while passing m1 use exact characters as there are in ztable. ie. for example m1 = 'Alexander Schmitz'. Try to put exactly this in your selection screen and it should work.
Regards-
Makarand
‎2014 Apr 14 12:15 PM
Hi,
check if the domain of M1 is having the lower case tick or not and enter the name with space as in Database.
hope it helps...
‎2014 Apr 14 12:45 PM
Hi Chandan ,
Database fetch is case sensitive ,So u need to give exact format in where condition.
Make your parameter and database in same case so that you need not worry about case sensitivity .
Check the lowecase check box in the domain .
Then declare your parameter
| PARAMETERS: | P_Mita | TYPE ZLT_Mita-M1 LOWER CASE . |
You can do the vice versa also by unchecking lowercase and giving Upper case instead of lower in parameter declartion .
Regards ,
Juneed Manha
‎2014 Apr 14 1:31 PM
Hi Chandan Kumar,
I got curious, why you where not getting the answer and so I decided to try the same in my system and found no errors.
Hope you have tried it again and it's solved.
PS: If not, please share your error in the code.
‎2014 Apr 15 9:57 AM
Hi all,
Thanks a lot help a biginer like me. Sometimes such small things heat up ur brain.
Thanks, the above suggestions helped me to solve my problem.
Regards
Chandan Kumar