10-25-2007 3:38 AM
Hi experts:
my code:
data: gs_iihttpnvp TYPE IHTTPNVP,
gt_tihttpnvp TYPE TIHTTPNVP,
sname type string.
sname = 'sname1'.
read table gt_tihttpnvp into gs_iihttpnvp with key name = 'sname1'.
read table gt_tihttpnvp into gs_iihttpnvp with key name = sname.
The first read can get the right value and the second can't. I don't know why,someone knows please help me, thanks.
Allen
10-25-2007 3:44 AM
Welcome to SDN Allen
IHTTPNVP should be having a field called NAME which is of type of SNAME as declared.
In your 1st READ since you are checking with some value it returns SY-SUBRC = 0.
In your 2nd READ you are trying yo match it with some variable of type STRING.
This might be the reason. So declare the SNAME of type IHTTPNVP-NAME
Hope this solves.
Happy Coding
Regards
Gopi
10-25-2007 3:45 AM
Hi,
If you see field type for TIHTTPNVP-NAME, it is a string whose length varies. It has unlimited length.
When you compare the same with string, it matches exact characters so it is working. But when you compare with the variables, characters to compare are not matching so it is not working.
If it had been of TYPE CHAR length 10 and also SNAME would have been type char and length 10 then second read also would have worked.
Hope this helps.
ashish
10-25-2007 4:33 AM
data: gs_iihttpnvp TYPE IHTTPNVP,
gt_tihttpnvp TYPE standard table of TIHTTPNVP,
sname type string.
clear gs_iithttpnvp.
gs_iihttpnvp-sname = 'sname1'.
append gs_iihttpnvp to gt_tihttpnvp.
clear gs_iihttpnvp.
read table gt_tihttpnvp into gs_iihttpnvp with key sname = 'sname1'.
write 😕 gs_iihttpnvp-sname.