‎2007 Jun 27 8:29 AM
hi experts,
i am developing a report to display details of equipment number(transaction ie03).
in that to get the partner function details (parvw ' vw ' person responsible)
we have partner (PARNR I_PARNR CHAR 12 0 Partner) and name of that person.
so based on parnr we get details from table pa0001 .
here we have PERNR (PERNR PERSNO NUMC 8 0 Personnel number)
(here pernr is equivalent to parnr of ihpa but data elements differ) so we get the details that is ename(employee name ).
but when i write select query i get the following error
&----
*& Report Z9VNK_EQUIPMENT_DISPLAY
*&
&----
*&
*&
&----
REPORT Z9VNK_EQUIPMENT_DISPLAY
MESSAGE-ID z9vnk_msg
NO STANDARD PAGE HEADING
LINE-COUNT 70.
----
AUTHOR OF REPORT : V.N.KULKARNI.
DATE OF REPORT : 25/06/2007.
DESC. OF REPORT :
----
M O D I F I C A T I O N - L O G
----
DATE USER-NAME TRANSPORT DESCRIPTION
*
*
----
----
S T R U C T U R E D E C L A R A T I O N
----
types : begin of t_equi,
equnr type equi-equnr,
eqtyp type equi-eqtyp,
matnr type equi-matnr,
sernr type equi-sernr,
objnr type equi-objnr,
end of t_equi.
types : begin of t_eqkt,
equnr type eqkt-equnr,
eqktx type eqkt-eqktx,
end of t_eqkt.
types : begin of t_equz,
equnr type equz-equnr,
hequi type equz-hequi,
end of t_equz.
types : begin of t_itab,
equnr type equi-equnr,
eqtyp type equi-eqtyp,
matnr type equi-matnr,
sernr type equi-sernr,
objnr type equi-objnr,
eqktx type eqkt-eqktx,
hequi type equz-hequi,
end of t_itab.
types : begin of t_ihpa,
objnr type ihpa-objnr,
parvw type ihpa-parvw,
parnr type ihpa-parnr,
end of t_ihpa.
types : begin of t_pa0001,
pernr type pa0001-pernr,
ename type pa0001-ename,
end of t_pa0001.
types : begin of t_jest,
objnr type jest-objnr,
stat type jest-stat,
inact type jest-inact,
end of t_jest.
types : begin of t_tj02t,
istat type tj02t-istat,
txt04 type tj02t-txt04,
txt30 type tj02t-txt30,
end of t_tj02t.
types : begin of t_tj30t,
STSMA type tj30t-stsma,
ESTAT type tj30t-estat,
SPRAS type tj30t-spras,
TXT04 type tj30t-txt04,
TXT30 type tj30t-txt30,
end of t_tj30t.
types : begin of t_final,
equnr type equi-equnr, "equipment number
eqtyp type equi-eqtyp, "equipment category
matnr type equi-matnr, "material number
sernr type equi-sernr, "serial number
objnr type equi-objnr, "object number
eqktx type eqkt-eqktx, "equpment description
hequi type equz-hequi, "superior equipment
parvw type ihpa-parvw, "partner function(vw)
parnr type ihpa-parnr, "personnel number
ename type pa0001-ename,"emp name
stat type jest-stat, "system status
txt04 type tj02t-txt04, "status short text
txt30 type tj02t-txt30, "status long text
STSMA type tj30t-stsma, "status profile
ESTAT type tj30t-estat, "user status
TXT40 type tj30t-txt04, "user status code
TXT50 type tj30t-txt30, "user status desc
end of t_final.
----
W O R K A R E A D E C L A R A T I O N
----
data : wa_equi type t_equi,
wa_eqkt type t_eqkt,
wa_equz type t_equz,
wa_ihpa type t_ihpa,
wa_pa0001 type t_pa0001,
wa_jest type t_jest,
wa_tj02t type t_tj02t,
wa_tj30t type t_tj30t,
wa_final type t_final.
----
I N T E R N A L T A B L E D E C L A R A T I O N
----
data : it_equi TYPE STANDARD TABLE OF t_equi,
it_eqkt TYPE STANDARD TABLE OF t_eqkt,
it_equz TYPE STANDARD TABLE OF t_equz,
it_itab type standard table of t_itab,
it_ihpa TYPE STANDARD TABLE OF t_ihpa,
it_pa01 TYPE STANDARD TABLE OF t_pa0001,
it_jest TYPE STANDARD TABLE OF t_jest,
it_tj2t TYPE STANDARD TABLE OF t_tj02t,
it_tj3t TYPE STANDARD TABLE OF t_tj30t,
it_finl TYPE STANDARD TABLE OF t_final.
----
G L O B A L D E C L A R A T I O N
----
DATA : gv_equnr TYPE equi-equnr, "constant for equipment number
gv_eqtyp TYPE equi-eqtyp, "constant for equpment type
gv_stop TYPE c VALUE '0',
gv_const TYPE c VALUE '0',
gv_repid TYPE sy-repid,
v_parnr type pa0001-pernr.
----
C O N S T A N T S D E C L A R A T I O N
----
CONSTANTS : c_vw TYPE parvw VALUE 'VW', " CONSTANTS DECLARATION
c_x TYPE c VALUE '1',
c_v type c value 'X',
c_p(8) type c value '00000003'.
----
S E L E C T I O N S C R E E N
----
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1.
SELECT-OPTIONS : s_equnr FOR gv_equnr OBLIGATORY. "equipment number
"range
PARAMETERS : p_eqtyp type equi-eqtyp. "equpment category
SELECTION-SCREEN END OF BLOCK bl1.
----
*I N I T I A L I Z A T I O N ( I N I T I A L I Z E V A R I A B L E S )
----
INITIALIZATION.
clear : wa_equi,
wa_eqkt,
wa_equz,
wa_ihpa,
wa_pa0001,
wa_jest,
wa_tj02t,
wa_tj30t,
wa_final.
refresh : it_equi,
it_eqkt,
it_equz,
it_ihpa,
it_pa01,
it_jest,
it_tj2t,
it_tj3t,
it_itab,
it_finl.
----
A T S E L E C T I O N S C R E E N ( V A L I D A T I O N S )
----
AT SELECTION-SCREEN.
SELECT SINGLE equnr eqtyp matnr sernr objnr
FROM equi
INTO wa_equi
WHERE equnr IN s_equnr.
IF sy-subrc <> 0.
MESSAGE e001.
ENDIF.
----
S T A R T O F S E L E C T I O N
----
START-OF-SELECTION.
if it_itab[] is initial.
select aequnr aeqtyp amatnr asernr aobjnr beqktx c~hequi
into table it_itab
from equi as a join eqkt as b on aequnr = bequnr
join equz as c on aequnr = cequnr
where a~equnr in s_equnr.
IF sy-subrc <> 0.
gv_stop = c_x.
STOP.
ELSE.
**-- sort internal table
SORT it_itab BY equnr.
ENDIF.
ENDIF.
if it_ihpa is initial.
select objnr parvw parnr
from ihpa
into table it_ihpa
for all entries in it_itab
where objnr = it_itab-objnr
and parvw = c_vw.
IF sy-subrc <> 0.
ELSE.
endif.
ENDIF.
loop at it_ihpa into wa_ihpa.
**
if ( wa_ihpa-parnr co '0123456789').
**
wa_ihpa-parnr = v_parnr.
if not it_ihpa[] is initial.
select pernr ename
from pa0001
into table it_pa01
for all entries in it_ihpa
where pernr = it_ihpa-parnr.
endif.
else.
endif.
endloop.
if it_jest is initial.
select objnr stat inact
from jest
into table it_jest
for all entries in it_ihpa
where objnr = it_ihpa-objnr
and inact ne c_v.
IF sy-subrc <> 0.
ELSE.
endif.
endif.
if it_tj2t is initial.
select istat txt04 txt30
from tj02t
into table it_tj2t
for all entries in it_jest
where istat = it_jest-stat
and spras = sy-langu.
IF sy-subrc <> 0.
ELSE.
endif.
ENDIF.
if it_tj3t is initial.
select stsma estat txt04 txt30
from tj30t
into table it_tj3t
for all entries in it_jest
where estat = it_jest-stat
and spras = sy-langu
and stsma = c_p.
IF sy-subrc <> 0.
ELSE.
endif.
ENDIF.
error : when using the addition "for all entries in itab",
the field pernr and it_ihpa-parnr must have same type and length.
how would i overcome that since i will get data from pa0001.
‎2007 Jun 27 8:37 AM
Hi,
If your PARNR value from IHPA table will not exceed more than 8 char length,then you can declare the follwong PARNR as numc of 8.This will solve your problem.
TYPES : BEGIN OF t_ihpa,
objnr TYPE ihpa-objnr,
parvw TYPE ihpa-parvw,
<b>parnr(8) TYPE n, </b> " ihpa-parnr,
END OF t_ihpa.
‎2007 Jun 27 9:11 AM
Hi,
try this...
just change the data type
types : begin of t_ihpa,
objnr type ihpa-objnr,
parvw type ihpa-parvw,
<b><b>parnr type pa0001-pernr,</b></b>
end of t_ihpa.
this will help... Reward points if useful.