2008 Mar 25 12:47 PM
Hi Gurus,
here i hav some complication for displaying data in output of a sap script form .In output I have to show characteristics(ysd-characteristics,,,, ysd is a customized tablehaving fields vbeln, matnr, posnr, characteristics......) of material with respect to sales document number(vbap-vbeln).
I am below SELECT statement for arry fetching----
________________________________________________
select distinct
ysd~vbeln
ysdposnr ysdmatnr
ysd~characteristic
vbapposnr vbapmatnr
vbap~arktx
vbap~kwmeng
into corresponding fields of table itab1
from ysd_famd_chrctcs as ysd inner join vbap
on ysdvbeln = vbapvbeln
and ysdposnr = vbapposnr
where vbap~vbeln = p_vbeln.
_______________________________________________
For data to be write in the form's output im using below code
LOOP AT itab1.
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
ENDLOOP.
_______________________________________________
using perform write_form i am calling function module " WRITE_FORM" for script.
_______________________________________________
After looping itab1 it is giving output like below.
-->>
-
Sr | MatNum | MatDesc | Charecteristics | Quantity
no | | | |
-
1 | 00000012 | CCslab | Moisture | 50
1 | 00000012 | CCslab | over size | 50
1 | 00000012 | CCslab | under size | 50
1 | 00000012 | CCslab | phos percnt | 50
1 | 00000012 | CCslab | chrome | 50
1 | 00000012 | CCslab | Ferrous | 50
-
but I want the output should be like below
-->>
-
Sr | MatNum | MatDesc | Charecteristics | Quantity
no | | | |
-
1 | 00000012 | CCslab | Moisture | 50
over size |
under size |
phos percnt | chrome |
Ferrous |
-
I tried using DELETE ADJACENT after PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'....... but it is deletin all characteristics from output.
______________________________________________
I tried using below format -
At new arktx
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
ENDAT.
but it is keeping data upto arktx sfter that it is showing "*********" for characteristic field and all other remaining field.
________________________________________________
I want to know what approach i should use before/after PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
to get my output like above
________________________________________________
pls help...
Regard
Saifur rahaman
2008 Mar 25 12:58 PM
Hi Rahaman,
Data i_tmp type itab1.
LOOP AT itab1.
if itab1-srnum = i_tmp-srnum.
clear itab1-srnum.
endif.
*Do the same for all fields
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
clear i_tmp.
i_tmp = itab1.
ENDLOOP.
This will clear ur problem.
Reward if helpful.
Regards,
Subbu
Hi Gurus,
here i hav some complication for displaying data in output of a sap script form .In output I have to show characteristics(ysd-characteristics,,,, ysd is a customized tablehaving fields vbeln, matnr, posnr, characteristics......) of material with respect to sales document number(vbap-vbeln).
I am below SELECT statement for arry fetching----
________________________________________________
select distinct
ysd~vbeln
ysdposnr ysdmatnr
ysd~characteristic
vbapposnr vbapmatnr
vbap~arktx
vbap~kwmeng
into corresponding fields of table itab1
from ysd_famd_chrctcs as ysd inner join vbap
on ysdvbeln = vbapvbeln
and ysdposnr = vbapposnr
where vbap~vbeln = p_vbeln.
_______________________________________________
For data to be write in the form's output im using below code
LOOP AT itab1.
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
ENDLOOP.
_______________________________________________
using perform write_form i am calling function module " WRITE_FORM" for script.
_______________________________________________
After looping itab1 it is giving output like below.
-->>
-
Sr | MatNum | MatDesc | Charecteristics | Quantity
no | | | |
-
1 | 00000012 | CCslab | Moisture | 50
1 | 00000012 | CCslab | over size | 50
1 | 00000012 | CCslab | under size | 50
1 | 00000012 | CCslab | phos percnt | 50
1 | 00000012 | CCslab | chrome | 50
1 | 00000012 | CCslab | Ferrous | 50
-
but I want the output should be like below
-->>
-
Sr | MatNum | MatDesc | Charecteristics | Quantity
no | | | |
-
1 | 00000012 | CCslab | Moisture | 50
over size |
under size |
phos percnt | chrome |
Ferrous |
-
I tried using DELETE ADJACENT after PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'....... but it is deletin all characteristics from output.
______________________________________________
I tried using below format -
At new arktx
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
ENDAT.
but it is keeping data upto arktx sfter that it is showing "*********" for characteristic field and all other remaining field.
________________________________________________
I want to know what approach i should use before/after PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
to get my output like above
________________________________________________
pls help...
Regard
Saifur rahaman
2008 Mar 25 12:58 PM
Hi Rahaman,
Data i_tmp type itab1.
LOOP AT itab1.
if itab1-srnum = i_tmp-srnum.
clear itab1-srnum.
endif.
*Do the same for all fields
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
clear i_tmp.
i_tmp = itab1.
ENDLOOP.
This will clear ur problem.
Reward if helpful.
Regards,
Subbu
2008 Mar 25 1:24 PM
Hi
Everything is fine, jst change a little bit in your script where you are printing the details and in the loop.
Use some counter variable to identify the first line of the internal table or whatever condition you want to put for displaying the first line.
Use this variable in the script as below.
IF &COUNT_VAR& = '1'
<< DISPLAY ALL THE DETAILS USING ALL MATNO DISCRIPTION e.t.c>>
ELSE
<<Jst use the &characteristics& for display>>
ENDIF.
Try this it will work else revert.
Regards,
Mayank
2008 Mar 26 12:19 PM
Thnx all for your kind co operation
i hav solved this problem just adding following code before ferform write_form using '' 'SET' 'BODY' 'MAIN'
DATA : lv_matnr LIKE mara-matnr.
DATA : itab2 LIKE itab1 OCCURS 0 WITH HEADER LINE .
DATA : itab3 LIKE itab1 OCCURS 0 WITH HEADER LINE .
DATA : index TYPE sy-index .
LOOP AT itab1 .
AT NEW matnr .
APPEND itab1 TO itab2 .
ENDAT .
ENDLOOP .
LOOP AT itab2 .
READ TABLE itab1 WITH KEY matnr = itab2-matnr .
IF sy-subrc = 0 .
index = sy-tabix .
index = index + 1 .
APPEND itab1 TO itab3 .
LOOP AT itab1 FROM index .
IF itab1-matnr <> itab2-matnr .
EXIT .
ENDIF .
CLEAR : itab1-posnr ,
itab1-matnr ,
itab1-arktx ,
itab1-kwmeng .
APPEND itab1 TO itab3 .
ENDLOOP .
ENDIF .
ENDLOOP .
REFRESH : itab1 .
itab1[] = itab3[] .
LOOP AT itab1.
PERFORM write_form USING 'ITEM_HEADER' 'SET' 'TOP' 'MAIN'.
SHIFT itab1-posnr LEFT DELETING LEADING '0'.
PERFORM write_form USING 'ITEM_LINE' 'SET' 'BODY' 'MAIN'.
ENDLOOP.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |