‎2007 May 09 6:59 AM
Belo I am giving the coding of my smartform. But when I am executing my report, it only calling the smart form but not showing data in the form. And plz also check my select statement, whether it is ok or need to be changed. In my select staement i used join earlier but bseg is cluster table so u cant use that. As per i am concern the problem somewhere in select staement. Plz give a look in to it.
&----
*& Report ZFI_FORM_REPORT
*&
&----
*&
*&
&----
REPORT ZFI_FORM_REPORT.
Tables: bseg, bkpf.
DATA: itab LIKE ZFI_FORM_PRINTING_STRUCTURE OCCURS 0 WITH HEADER LINE.
DATA: fm_name TYPE rs38l_fnam.
**************************************************************************
Selection Screen
**************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
select-options : p_belnr for bseg-belnr,
b_bukrs for bseg-bukrs OBLIGATORY DEFAULT '1000',
G_gjahr for bseg-gjahr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: Customer RADIOBUTTON GROUP g1,
vendor RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b2.
*******************************************************************
F4 Help
******************************************************************
at selection-screen on value-request for p_belnr-low.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'FIELD'
dynprofield = 'p_belnr'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = itab.
******************************************************************
Start-of-selection
******************************************************************
START-OF-SELECTION.
SELECT
a~SGTXT
a~HKONT
a~GSBER
a~KOSTL
a~WRBTR
a~BELNR
a~EBELP
a~BUKRS
a~GJAHR
a~LIFNR
a~KUNNR
b~BLDAT
b~XBLNR
lfa1~name1
INTO CORRESPONDING FIELDS OF table it_table
INTO (itab-SGTXT, itab-HKONT, itab-GSBER, itab-KOSTL, itab-WRBTR,
itab-BELNR, itab-EBELP, itab-BUKRS, itab-GJAHR, itab-LIFNR,
itab-KUNNR, itab-BLDAT, itab-XBLNR)
FROM ( bseg AS a INNER JOIN bkpf AS b
ON abelnr = bbelnr and
abukrs = bbukrs and
agjahr = bgjahr )
INNER JOIN lfa1 ON
blifnr = lfa1lifnr )
*
WHERE abukrs = b_bukrs AND abelnr = p_belnr AND a~gjahr = G_gjahr.
*
append itab.
endselect.
*
IF sy-subrc <> 0.
WRITE:/ 'ERROR 1'.
MESSAGE s000(zmess_cash_receipt).
ELSE.
PERFORM display_alv_report.
ENDIF.
*
*END-OF-SELECTION.
*
*
bblart IN ('KR','RE') AND ahkont IN
s_hkont AND abudat IN s_budat AND abschl IN s_bschl.
**
SELECT * FROM bseg INTO CORRESPONDING FIELDS OF itab
WHERE belnr = p_belnr
and bukrs = b_bukrs
and gjahr = g_gjahr.
MOVE-CORRESPONDING bseg TO itab.
append itab.
endselect.
select * from bkpf INTO CORRESPONDING FIELDS OF itab
WHERE belnr = p_belnr
and bukrs = b_bukrs
and gjahr = g_gjahr.
MOVE-CORRESPONDING bkpf TO itab.
append itab.
endselect.
PERFORM display_smartform.
&----
*& Form display_smartform
&----
text
----
--> p1 text
<-- p2 text
----
FORM display_smartform.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZFI_FORM_PRINTING'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
WRITE:/ 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
ITAB = itab
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_SMARTFORM
‎2007 May 09 7:18 AM
hi
good
debug the program and check wheather your data is passing from your driver program to your smartform,change the code accordingly if the data is not moving to your smartform screen.
check wheather you have declare the appropriate field name similar to the field value that you r passing to your smartforms.
thanks
mrutyun^
‎2007 May 09 7:06 AM
Hi Abhay,
Refer this code :
SELECT * FROM bseg INTO CORRESPONDING FIELDS OF table itab
WHERE belnr = p_belnr
and bukrs = b_bukrs
and gjahr = g_gjahr.
append itab.
loop at itab.
select * from bkpf INTO CORRESPONDING FIELDS OF table itab
WHERE belnr = itab-belnr
and bukrs = itab-bukrs
and gjahr = itab-gjahr.
modify itab.
endloop.
Now pass this table itab to ur smartforms.
Reward points if helpful.
Regards,
Hemant
‎2007 May 09 7:07 AM
Hi you have declared the p_belnr and etc as select-options but while selecting you are usinf "="
that is not correct. use IN
SELECT * FROM bseg INTO CORRESPONDING FIELDS OF itab
WHERE belnr IN p_belnr
and bukrs IN b_bukrs
and gjahr IN g_gjahr.
But the problem is you should not use BSEG... instead you have to do this...
Where possible, avoid select statements which read table BSEG. This is an enormous table and reading it can have major performance implications. An alternative is to use one of the index tables instead. These contain most of the fields from the accounting document (BKPF) and the document line (BSEG) and all of the fields are indexed giving major performance advantages. There are 6 index tables which between them cover all of the document lines in BSEG.
BSIS G/L items (uncleared)
BSAS G/L items (cleared)
BSIK A/P items (uncleared)
BSAK A/P items (cleared)
BSID A/R items (uncleared)
BSAD A/R items (cleared)
If you don't know whether an item is cleared or not, it usually pays to do a select on the 'uncleared' table (eg BSIS for G/L lines) and if nothing is found then select from the 'cleared' table(in this case BSAS). This still has major performance advantages over a direct select on BSEG if you don't have the key fields.
On the few occasions where a field is required which is not available in the index it will still usually be faster to read the index to find the Document and Line Item numbers and then read BKPF/BSEG with these key fields.
‎2007 May 09 7:09 AM
Hi
have you designed your samrtform in SMARTFORMS tcode with pages, windows and alligned the data such that it prints the data.
Regarding the requirement, Don't use Bkpf and BSEG tables
For Customer details use BSID and BSAD tables
for Vendor USe BSIK and BSAK tables
BSEG select consumes lot of time.
Even if you use BKPF and BSEG tables first fetch data from BKPf
and for all entries of BKPF fetch the data from BSEG.
select * from bkpf INTO CORRESPONDING FIELDS OF itab
WHERE belnr = p_belnr
and bukrs = b_bukrs
and gjahr = g_gjahr.
if not itab[] is initial.
SELECT * FROM bseg INTO CORRESPONDING FIELDS OF itab1
for all entries in itab
WHERE belnr = itab-belnr
and bukrs = itab-bukrs
and gjahr = itab-gjahr
endif.
then move the entries into ITAB by reading ITAB1.
Reward points if useful
Regards
Anji
‎2007 May 09 7:14 AM
‎2007 May 09 7:25 AM
what is the syntaxt for moving the entries into ITAB by reading ITAB1.
‎2007 May 09 7:18 AM
hi
good
debug the program and check wheather your data is passing from your driver program to your smartform,change the code accordingly if the data is not moving to your smartform screen.
check wheather you have declare the appropriate field name similar to the field value that you r passing to your smartforms.
thanks
mrutyun^