on 04-22-2008 9:07 AM
Hi all
Im trying to do a loop in program lines in smartforms. This is my code in program lines:
DATA: BEGIN OF IT_COMP OCCURS 0,
matnr LIKE resb-matnr,
bdmng LIKE resb-bdmng,
ebeln LIKE resb-ebeln,
ebelp LIKE resb-ebelp,
baugr LIKE resb-baugr,
END OF IT_COMP.
DATA: p_BDMNG TYPE BSTMG,
p_menge TYPE BSTMG,
umrez LIKE MARM-UMREZ, "B.UOM qty
umren LIKE MARM-UMREN. "A.UOM qty
select * into CORRESPONDING FIELDS OF IT_COMP
from resb
where baugr = <FS>-MATNR
AND EBELN = <FS>-EBELN
AND EBELP = <FS>-EBELP.
ENDSELECT.
LOOP AT IT_COMP.
WA_RESULT-MATNR = IT_COMP-MATNR.
"PART DESC FROM MAKT
select single maktx from makt
into (WA_RESULT-p_maktx)
where matnr = WA_RESULT-MATNR.
"NET WEIGHT FROM MARA
select single NTGEW from MARA
into (WA_RESULT-P_NTGEW)
where matnr = WA_RESULT-MATNR.
"cal total qty
p_BDMNG = IT_COMP-BDMNG.
p_menge = <fs>-menge.
wa_result-t_qty = p_menge * p_BDMNG.
"cal total packs
SELECT SINGLE UMREZ UMREN
INTO (umrez, umren)
FROM MARM
WHERE MATNR = wa_result-MATNR
AND MEINH = 'BAG'.
wa_result-t_packs = ( wa_result-t_qty / umrez ) * umren.
ENDLOOP.
APPEND wa_result to it_result.
CLEAR wa_result.
And this is my definition in global definitions types tab.
TYPES: BEGIN OF s_result,
MATNR LIKE RESB-MATNR,
P_MAKTX LIKE MAKT-MAKTX,
T_QTY LIKE ekpo-MENGE,
T_PACKS LIKE ekpo-MENGE,
P_NTGEW LIKE MARA-NTGEW,
END OF s_result.
Types: t_result TYPE STANDARD TABLE OF s_result INITIAL SIZE 0.
In global data I define, "it_result type t_result" and "wa_result type s_result"
When I try to display the it_result in text node, "&IT_RESULT-MATNR&" , I get this error " "IT_RESULT" is a table without a header line and therefore has no component called "P_MAKTX". "
Please advise.
Thanks in advance
az
Edited by: alawiyah zakaria on Apr 22, 2008 10:17 AM
A little correction in my first post.
The error msg is " "IT_RESULT" is a table without a header line and therefore has no component called "MATNR"."
Same error msg appear when I use other fields in it_result
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
loop it_result into wa_result
and display wa_result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The best way is to read the itab it_result into work area i.e wa_result based on some key values and use that work area in the text element. ( like this - &wa_result-matnr&).
Close previous threads once u move to new threads.
Regards,
Prabhu
Edited by: Prabhuraj Krishnan on Apr 22, 2008 4:09 PM
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.