11-04-2006 9:31 AM
Hello Friends,
I know that this problem is very difficult to solve without looking at my script and its program. But I will try asking anyways.
I have written the following code (Driver program) which uses to tables ZRAMCUSTMAST AND ZRAMCALLMAST.
ZRAMCUSTMAST has customer details like address etc.,
ZRAMCALLMAST has the call details that each
customer has done.
But when I print the details, it prints everything correctly but for each customer it prints some garbage
values as the first row.
Any feedback will be greatly appreciated. You can mail me the response also (singer_ram AT yahoo DOT com)
-
CODE in my driver program (SE38) -
&----
*& Report ZRAMPROJSCRIPT *
*& *
&----
*& *
*& *
&----
REPORT zramprojscript .
TABLES : zramcustmast, zramjuncmast, zramcallmast.
DATA : itabcustmast LIKE zramcustmast OCCURS 1 WITH HEADER LINE,
itabjuncmast LIKE zramjuncmast OCCURS 1 WITH HEADER LINE,
itabcallmast LIKE zramcallmast OCCURS 1 WITH HEADER LINE.
DATA: type_of_call(1),
CALL_CHARGE type i, CALL_CHARGE_STRING(5), TOTAL_CHARGE type i,
hour(2), min(2), sec(2).
SELECT * FROM zramcustmast INTO TABLE itabcustmast.
*SELECT * FROM zramjuncmast INTO TABLE itabjuncmast.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
dialog = 'X'
form = 'ZRAMPROJSCRIPT'
language = sy-langu
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT itabcustmast.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
form = 'ZRAMPROJSCRIPT'
language = sy-langu
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAINPAGE'
function = 'SET'
type = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear itabcallmast.
refresh itabcallmast.
SELECT * FROM zramcallmast INTO TABLE itabcallmast WHERE customerid = itabcustmast-customerid.
SORT itabcallmast by calltype.
TOTAL_CHARGE = 0.
LOOP AT itabcallmast.
Local Call : 1 Rupee per Minute.
STD : 1.5 Rupees Per Minute
International calls : 5 Rupees Per minute
*
hour = itabcallmast-CALLDURATION+0(2).
min = itabcallmast-CALLDURATION+2(2).
sec = itabcallmast-CALLDURATION+4(2).
CASE itabcallmast-calltype.
WHEN 'L'.
CALL_CHARGE = ( ( hour * 60 * 60 ) + ( min * 60 ) + ( sec ) ) / 60.
WHEN 'S'.
CALL_CHARGE = ( ( ( hour * 60 * 60 ) + ( min * 60 ) + ( sec ) ) * 2 ) / 60 .
WHEN 'I'.
CALL_CHARGE = ( ( ( hour * 60 * 60 ) + ( min * 60 ) + ( sec ) ) * 5 ) / 60 .
ENDCASE.
CALL_CHARGE_STRING = CALL_CHARGE.
TOTAL_CHARGE = TOTAL_CHARGE + CALL_CHARGE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAINPAGE'
function = 'SET'
type = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP. " ************ itabCALLmast
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 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.
clear itabcallmast.
ENDLOOP. " ************** itabCUSTmast
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
03-14-2007 12:18 PM
11-06-2006 6:30 AM
It seems like you are printing the customer data first followed by the customer call details. Instead of writing them in the same element define two different elements.
1. CUSTOMER
2. CALLINFO and then while calling write_form write to these elements seperately.
11-06-2006 6:37 AM
hi
good
check the following things-
1- Check the value for the field in the particular table,
2- Check the data you r passing from the driver program and the field that is printing the value in the sapscript screen.
3-check in the debug mode when the value is printing in the first row.
thanks
mrutyu
03-14-2007 12:18 PM