11-28-2007 6:40 AM
Hi friends,
Lat me know how to write the select query to get the fields PLANS and ENAME from table PA0001 by checking the field PERNR = IHPA-PARNR .
Because pernr and parnr are not same type and same length.
Thanks in advancce.
11-28-2007 6:50 AM
Hi, try like this:
DATA: BEGIN OF lt_ihpa OCCURS 0
, parnr LIKE pa0001-pernr
if need other fields
, END OF lt_ihpa.
DATA lt_pa0001 LIKE pa0001 OCCURS 0.
REFRESH lt_ihpa[].
REFRESH lt_pa0001[].
SELECT parnr
if need other fields
INTO TABLE lt_ihpa
FROM ihpa.
CHECK NOT lt_ihpa[] IS INITIAL.
SELECT *
INTO TABLE lt_pa0001
FROM pa0001
FOR ALL ENTRIES IN lt_ihpa
WHERE pernr = lt_ihpa-parnr
if need other fields conditions
.
11-28-2007 7:51 AM
It is giving the dump.
in select query what should i mention in where condition to get teh field parnr FROM table ihpa table.
11-28-2007 7:56 AM
Thanks for your reply.
But i am getting the dump.
Let me know what should i mention in WHERE condition in the following query.
SELECT parnr
if need other fields
INTO TABLE lt_ihpa
FROM ihpa.
11-28-2007 7:57 AM
DATA: BEGIN OF lt_ihpa OCCURS 0
, parnr LIKE ihpa-parnr
, parnr_2 LIKE pa0001-pernr
, END OF lt_ihpa.
DATA lt_pa0001 LIKE pa0001 OCCURS 0.
FIELD-SYMBOLS <fs> LIKE LINE OF lt_ihpa.
REFRESH lt_ihpa[].
REFRESH lt_pa0001[].
SELECT parnr
INTO CORRESPONDING FIELDS OF TABLE lt_ihpa
FROM ihpa.
LOOP AT lt_ihpa ASSIGNING <fs>.
<fs>-parnr_2 = <fs>-parnr(8).
ENDLOOP.
CHECK NOT lt_ihpa[] IS INITIAL.
SELECT *
INTO TABLE lt_pa0001
FROM pa0001
FOR ALL ENTRIES IN lt_ihpa
WHERE pernr = lt_ihpa-parnr_2.
11-28-2007 9:59 AM
11-28-2007 10:03 AM
07-16-2013 5:22 PM
11-28-2007 6:53 AM
Hi
you need to get the PARNR number from IHPA
select PARNR from IHPA into itab1 where some condition
if itab1 is not initial
select data from PA0001 into itab2 for allentries in itab1 where pernr = itab1-PARNR
endif.
<b>Reward if usefull</b>
11-28-2007 6:53 AM
11-28-2007 6:57 AM
Hi Praveen,
I think PERNR is for Partner name and PARNR is for personal number.So you can't check with this condition.Better clarify with functionals for the checking of these two fields really needed or not.
If is it so..please take an internal table and declare both the fields with type C and fetch the corresponding values and check in your select statement.
Reward if helpful.
11-28-2007 7:15 AM
Hi Praveen,
you can try this.
Make a table say 'it_ihpa' only field PARNR but of type PERNR .
Now loop at IHPA and get all PARNR in your table 'it_ihpa' .
Now select PLANS and ENAME from table PA0001 by checking the field PERNR = IT_IHPA-PARNR .
Rewards pts if helpful
Regards,
Manish
11-28-2007 10:50 AM