Script (open_form)
i have modified medruck, while executing me23n (PO order), for some documents..
it is giving, <b>error in OPEN_FORM for " " document</b>
what is this ? how to resolve?
and for some documents i am getting,
NO MESSAGES FOUND(CHECK YOUR INPUT)<b></b>
Are you closing the form?
basis program code should look like this.
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
dialog = ' '
form = print_co-forml
language = print_co-spras
options = itcpo
exceptions
canceled = 01
device = 02
form = 03
options = 04
unclosed = 05.
call function 'START_FORM'
exporting
startpage = 'PAGE1'
exceptions
others = 7.
call function 'WRITE_FORM'
exporting
window = 'MAIN'
exceptions
others = 9.
call function 'END_FORM'
exceptions
others = 4.
call function 'CLOSE_FORM'
exceptions
others = 01.
Regards,
Rich Heilman
Similar Messages
-
Values not getting populated in sapscript
Hi,
i have written a subroutine pool with ENTRY form . which is configured in NACE. when i run the T-code VT03N. in debugging mode in the subroutine i am getting the values . But the values are not gettng populated in sap script. open_form , write_form close_form and text elements are all used.
the same code is copied and put in a report without ENTRY form and run directly then we are getting the values in script.
please let me know for any answers.
Thanks
Chetan
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on May 14, 2009 1:06 PMH,
Do as below.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZTEST_SCRIPT'
LANGUAGE = SY-LANGU
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 itab .
call function 'WRITE_FORM'
exporting
element = 'LABEL'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'.
ENDLOOP.
Call Function 'CLOSE_FORM'.
In SE71 'ZTEST_SCRIPT' in main window
add a field like &ITAB-MATNR&.
ex:-
/E LABELS
P1 &ITAB-MATNR&.
Regards
Krishna
Edited by: Bala Krishna on Aug 11, 2008 12:28 PM
Edited by: Bala Krishna on Aug 11, 2008 12:29 PM -
Excise invoice printing by sapscript
Hi All,
Can anyone provide me the details of step by step how to display the sales excise invoice by sapscript?
I had gone to VF02 and then enter the Billing document Number whose excise invoice has already developed. I went to header > output>output type is J1I0 for output type.When I am going to Print preview by ISSUE OUTPUT TYPE no preview is coming...
Hope Connection between driver program and sapscript is not done..
Else if I go V1IP and entering excise invoice number and then tell me how print preview will come with value...
Please do help..Urgently..Go live is forthcoming soon...I remain grateful for the same....
Sikha.Hi,
Please do this....
1.Check the SAP Script : OPEN_FORM should have the option DIALOG = 'X'.Then only the dialog will be appearing.
If this is ok, then go to 2.
2.Go to SE11 and Display the entries of TNAPR by giving the Output Type, Application Type and Print Medium( 1).
If the configuration is done correctly, then the form details are shown.Else, the configuration is not done.
If configuration is not done, then go to NACE.
Select Corresponding application Type and click on output types.All the output will be appearing.Then select the output which you want and click on Processing Routines (on Left hand side).
Then You will get a screen where you need to enter the Subroutine, Form Name etc.
Thanks & Regards,
Vamsi. -
Form output in English for Denmark
Hi Friends,
I have a small requirement that is, i need to display in english language for Danish language, for this the sales org will be 1001.
According to the sales org i need to display the layout in english language even though its for Danish.
Pls advice, in S010 how we will give this condition that means only for sales org 1001.
MohanaHi
Do u have the form in Both Languages or not , if not Translate it and
then write code based on ur Sales Org and then by passing ur LANGUAGE key in the Form if Script --OPEN_FORM - --Language if Smartforms in --CONTROL PARAMETRS lanaguge...
Surya -
Hi All
I am totally new in this field and at present m on training.
i wann study SAPscript and Smartforms.
Can anybody suggest me how to proceed or how to start as at present i don know anything about SAPscript and smartforms
Thanks in advanceHi
As per your question suggest you need some practical classes to know smthing about sapscript and smartforms.
Anyway if you have SAP at your home or institute you follow this process.
SAP SCRIPT
1- GO TO SE71
2- Set the Character format
3- Set the paragraph format
4- Open the layout set.
5- Design the form as per your requirements.
Main window
Constant Window
Variable Window
6-go to se38
7- write a driver program
8- use the minimum function module of the sap script
OPEN_FORM
WRITE_FORM
CLOSE_FORM.
Here is a driver program you can use this for your reference
============
*& Report ZTRIPATHY_SCRIPT *
REPORT ZTRIPATHY_SCRIPT .
TABLES: ZSCRIPT_TAB.
data: itab type standard table of ZSCRIPT_TAB with header line.
select * from ZSCRIPT_TAB into corresponding fields of table itab.
DATA: VALUE TYPE I.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZPS_MROF1'
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
OTHERS = 11
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 = 'TEXT1'
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
OTHERS = 9
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 itab.
VALUE = VALUE + ITAB-MY_INCOME.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TEXT2'
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
OTHERS = 9
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.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TEXT3'
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
OTHERS = 9
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 'CONTROL_FORM'
EXPORTING
command = 'NEW-PAGE'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3
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 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 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.
*FORM ADD_INCOME USING INCOME TYPE ZSHAIL_TAB1-MY_INCOME CHANGING VAL.
*VAL = VAL + INCOME.
*ENDFORM.
SMARTFORMS
1-GO SMARTFORM TCODE
2-GIVE THE APPROPRIATE DATA IN THE
Form attributes
Form interface
Global Definition
3- Use the windows,tables,texts as per your requirements.
4-go to se38
5-write the driver program
here i am giving a sample driver program you can follow this
TABLES : vbrk,
vbrp,
kna1.
TYPES : BEGIN OF t_vbrk,
vbeln TYPE vbrk-vbeln,
fkart TYPE vbrk-fkart,
kunag TYPE vbrk-kunag,
END OF t_vbrk.
TYPES : BEGIN OF t_vbrp,
vbeln TYPE vbrp-vbeln,
fkimg TYPE vbrp-fkimg,
cmpre TYPE vbrp-cmpre,
netwr TYPE vbrp-netwr,
END OF t_vbrp.
TYPES : BEGIN OF t_kna1,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
adrnr TYPE kna1-adrnr,
ort01 TYPE kna1-ort01,
pstlz TYPE kna1-pstlz,
regio TYPE kna1-regio,
END OF t_kna1.
TYPES : BEGIN OF t_final.
INCLUDE STRUCTURE ZINVOICE.
vbeln TYPE vbrk-vbeln,
fkart TYPE vbrk-fkart,
kunag TYPE vbrk-kunag,
fkimg TYPE vbrp-fkimg,
cmpre TYPE vbrp-cmpre,
netwr TYPE vbrp-netwr,
name1 TYPE kna1-name1,
adrnr TYPE kna1-adrnr,
ort01 TYPE kna1-ort01,
pstlz TYPE kna1-pstlz,
regio TYPE kna1-regio,
types: END OF t_final.
DATA : i_vbrk TYPE TABLE OF t_vbrk,
i_vbrp TYPE TABLE OF t_vbrp,
i_kna1 TYPE TABLE OF t_kna1,
i_final TYPE TABLE OF t_final.
data : v_fnam type rs38l_fnam.
DATA : wa_vbrk TYPE t_vbrk,
wa_vbrp TYPE t_vbrp,
wa_kna1 TYPE t_kna1,
wa_final TYPE t_final.
*START-OF-SELECTION
SELECT-OPTIONS : s_vbeln FOR vbrk-vbeln.
START-OF-SELECTION.
SELECT vbeln
fkart
kunag
INTO TABLE i_vbrk FROM vbrk
WHERE vbeln IN s_vbeln.
SELECT vbeln
fkimg
cmpre
netwr
INTO TABLE i_vbrp FROM vbrp
FOR ALL ENTRIES IN i_vbrk
WHERE vbeln = i_vbrk-vbeln.
SELECT kunnr
name1
adrnr
ort01
pstlz
regio
INTO TABLE i_kna1 FROM kna1
FOR ALL ENTRIES IN i_vbrk
WHERE kunnr = i_vbrk-kunag.
LOOP AT i_vbrk INTO wa_vbrk.
wa_final-vbeln = wa_vbrk-vbeln.
wa_final-fkart = wa_vbrk-fkart.
wa_final-kunag = wa_vbrk-kunag.
LOOP AT i_vbrp INTO wa_vbrp WHERE vbeln = wa_vbrk-vbeln.
wa_final-fkimg = wa_vbrp-fkimg.
wa_final-cmpre = wa_vbrp-cmpre.
wa_final-netwr = wa_vbrp-netwr.
ENDLOOP.
LOOP AT i_kna1 INTO wa_kna1 WHERE kunnr = wa_vbrk-kunag.
wa_final-name1 = wa_kna1-name1.
wa_final-adrnr = wa_kna1-adrnr.
wa_final-ort01 = wa_kna1-ort01.
wa_final-pstlz = wa_kna1-pstlz.
wa_final-regio = wa_kna1-regio.
ENDLOOP.
APPEND wa_final TO i_final.
ENDLOOP.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZINVOICE_FORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = V_FNAM
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
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 V_FNAM
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
i_final = i_final.
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.
I hope this will help you to solve your problem
Thanks
Mrutyunjaya Tripathy -
Open_form in SAP script
hi,
I was trying script program for single page. so when I was calling the function 'open_form' ...i mean when i double clicked on it....i was taken to the module page....after executing it i am not getting the module code into my source program......what cud be the possible error.
I get something like this in the module result screen
"close_form is missing for the layout".Are you closing the form?
basis program code should look like this.
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
dialog = ' '
form = print_co-forml
language = print_co-spras
options = itcpo
exceptions
canceled = 01
device = 02
form = 03
options = 04
unclosed = 05.
call function 'START_FORM'
exporting
startpage = 'PAGE1'
exceptions
others = 7.
call function 'WRITE_FORM'
exporting
window = 'MAIN'
exceptions
others = 9.
call function 'END_FORM'
exceptions
others = 4.
call function 'CLOSE_FORM'
exceptions
others = 01.
Regards,
Rich Heilman -
Language OPEN_FORM error in Script
Hi All ,
I have a form for Purchase order which works from ME23N Tcode. Actually this PO form is copied from Standard one and made some changes. So original lang. is DE and we have copied to all lang.'s and i made some changes in Eng. form and activated. As I am working for Korea proj. i need Korean lang. also so i activated form in KO lang. too . If the PO from EKKO table lang. is EN then form is working perfectly .
If the PO from EKKO table lang. is KO it is giving error " Error in OPEN_FORM for the document no." .
I have activated the form in KO lang. too . when i debugged the open_form the ekko-spras is KO and when I executed in SE37 with the same data it is giving message PO form in KO is inactive .
so please help me to solve this one.
Thanks & Regards.Hi,
Try to convert the Language from EN to KO using Tcode SE76 and check it. Do any further translations in that Tcode.
Regards
Bala Krishna -
DOCU WINDOW
This is the window on the top right side
1.Document no (hard coded)
2.Then display the document number for the first document for the current row. Maybe you should check prior to printing if the current row was posted error free
and invoke printing only if this is the case. Then get the first(!!!) document number from the error/message log for this row. ZGF_ICO_RECHR_L-DOCFR
3. Document date (hard coded) it is P_BLDAT on the selection screen, already correct in the form
4. VAT No (hard coded)
5. Then display the EU VAT reg.no of that company. This is in table KNA1, where KUNNR = L_ROW-CUSTFR. The field is KNA1-STCEG, if it is empty, try to populate
KNA1-STCD1.
6. Order number(Hard coded)
7. Just concatenate L_ROW-REF + the last number for that reference from the log table ZGF_ICO_RECHR_L (notice this table has not yet been created!!! and also
the part is missing where we populate that table when posting both documents for a particular row) ZGF_ICO_RECHR_L-REF+NUMBER
report ZG00F_.
Top Include for the data declarations
class LCL_REF definition deferred.
include ZG00F_INT_POST_INVOICE_TOP.
data: G_ALV_TREE type ref to CL_GUI_ALV_TREE,
G_CUSTOM_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER,
G_TEXT_CONTAINER type ref to CL_GUI_CUSTOM_CONTAINER,
G_LOGGER type ref to CL_GUI_TEXTEDIT,
G_TOOLBAR type ref to CL_GUI_TOOLBAR.
data: " gt_zgf_ico_rechr type zgf_ico_rechr occurs 0,
"Output-Table
OKCODE like SY-UCOMM.
CLASS LCL_REF DEFINITION
class LCL_REF definition.
public section.
data : VALID type BOOLEAN,
CAN type BOOLEAN.
methods : CONSTRUCTOR
importing IM_REF type ZGF_ICO_RECHR,
CAN_POST
returning VALUE(CAN) type BOOLEAN,
IS_VALID
returning VALUE(IS_VALID) type BOOLEAN,
GET_DIVA returning VALUE(DIVA) type LVC_S_LAYN,
GET_DIVAC returning VALUE(DIVAC) type LVC_S_LACN,
FILL_BAPI_TABLES,
GET_REF returning VALUE(R_REF) type ZGF_ICO_RECHR-REF,
POST_INVOICE,
PRINT_INVOICE,
GET_ERRORS returning
VALUE(R_ERROR_TAB) type ABAPTXT255_TAB,
GET_PRDATA returning
VALUE(PR_REF) type ZGF_ICO_RECHR.
private section.
data: LINE type ABAPTXT255,
ERROR_TAB type ABAPTXT255_TAB,
FIELD like LINE.
methods : CHECK_VALIDITY.
endclass. "lcl_ref DEFINITION
CLASS lcl_ref IMPLEMENTATION
class LCL_REF implementation.
method GET_ERRORS.
R_ERROR_TAB = ME->ERROR_TAB.
endmethod. "get_errors
method IS_VALID.
IS_VALID = ME->VALID.
endmethod. "is_valid
method GET_PRDATA.
PR_REF = L_REF.
endmethod. "is_valid
method PRINT_INVOICE.
data: L_KUNNR type KNA1-KUNNR.
data: L_ROW type ZGF_ICO_RECHR.
call function 'OPEN_FORM'
exporting
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZGF_INVOICE'
LANGUAGE = SY-LANGU
OPTIONS = is_options
exceptions
CANCELED = 1
DEVICE = 2
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.
call function 'START_FORM'
exporting
ARCHIVE_INDEX =
FORM = 'ZGF_INVOICE'
LANGUAGE = SY-LANGU
exceptions
FORM = 1
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.
IF L_REF-TOTAL >= 0.
IV_INVOICE = 'INVOICE (COMCoE Recharge)'.
ELSE.
IV_INVOICE = 'Credit Memo (COMCoE Recharge)'.
ENDIF.
call method ME->GET_PRDATA
receiving
PR_REF = L_ROW.
L_KUNNR = L_ROW-CUSTFR.
select single RCOMP ADRNR LAND1 ORT01
into (IV_RCOMP, IV_ADRNR, IV_COMPLAND1, IV_COMPORT01)
from T001 where BUKRS = L_ROW-CCFR.
call function 'WRITE_FORM'
exporting
WINDOW = 'INVOICE'
ELEMENT = 'T3'
exceptions
WINDOW = 1
ELEMENT = 2.
IV_DOCDATE = P_BLDAT.
IV_ORDNU = L_ROW-REF.
call function 'WRITE_FORM'
exporting
WINDOW = 'DOCU'
ELEMENT = 'T2'
exceptions
WINDOW = 1
ELEMENT = 2.
select single KUNNR STRAS NAME1 LAND1 ORT01 STCEG
into
(IV_CUSTNO, IV_CUSTADD, IV_CUSTNAME1, IV_CUSTLAND1, IV_CUSTCITY,
IV_DOCVAT)
from KNA1
where KUNNR = L_KUNNR.
call function 'WRITE_FORM'
exporting
WINDOW = 'CUST'
ELEMENT = 'T6'
exceptions
WINDOW = 1
ELEMENT = 2.
IV_CUSTNO = L_KUNNR.
IV_CURR = L_ROW-CURR.
call function 'WRITE_FORM'
exporting
WINDOW = 'CUSTNO'
ELEMENT = 'T4'
exceptions
WINDOW = 1
ELEMENT = 2.
data: L_VAR(21).
concatenate P_DATEFR0(4) '/' P_DATEFR4(2) '/' P_DATEFR+6(2)
'-' P_DATETO0(4) '/' P_DATETO4(2) '/' P_DATETO+6(2)
into L_VAR.
IV_PERDAT = L_VAR.
call function 'WRITE_FORM'
exporting
WINDOW = 'MAIN'
ELEMENT = 'T1'
exceptions
WINDOW = 1
ELEMENT = 2.
call function 'WRITE_FORM'
exporting
WINDOW = 'FOOTER'
ELEMENT = 'T5'
exceptions
WINDOW = 1
ELEMENT = 2.
*CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5.
call function 'END_FORM'
exceptions
UNOPENED = 1.
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 'CLOSE_FORM'
exceptions
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.
endmethod. "is_valid
method GET_REF.
R_REF = REF.
endmethod. "get_ref
method CONSTRUCTOR.
L_REF = IM_REF.
REF = IM_REF-REF.
call method ME->CHECK_VALIDITY.
endmethod. "constructor
method GET_DIVA.
DIVA-ISFOLDER = ''.
if VALID <> 'X'.
DIVA-N_IMAGE = ICON_NEGATIVE.
else.
DIVA-N_IMAGE = ICON_POSITIVE.
endif.
endmethod. "get_diva
method GET_DIVAC.
if V_ERROR1 = 'Y' or V_ERROR2 = 'Y'.
DIVAC-N_IMAGE = ICON_RED_LIGHT.
elseif V_ERROR1 = 'N' and V_ERROR2 = 'N'.
DIVAC-N_IMAGE = ICON_GREEN_LIGHT.
endif.
DIVAC-U_N_IMAGE = 'X'.
endmethod. "get_divac
method CAN_POST.
CAN = 'X'.
call method ME->FILL_BAPI_TABLES.
endmethod. "can_post
method CHECK_VALIDITY.
*Reference field must begin with M, Q, Y or J. Otherwise display an
*error msg with text symbol TEXT-001 (ZGF_ICO_RECHR validation error
*Reference incorrect rec.x) where x ist the numebr of the incorrect
*record.
data: L_CHAR(1),
L_REF1 type ZGF_ICO_RECHR-REF,
L_ERR type OUTTAB_LINE_ERROR,
L_NUM type N,
L_KNB1 type KNB1,
L_TBSL type TBSL,
L_CSKS type CSKS,
L_LFB1 type LFB1.
l_flag(1).
clear: L_CHAR, L_NUM, VALID.
VALID = 'X'.
L_REF1 = L_REF-REF.
L_CHAR = L_REF1+0(1).
if not ( L_CHAR = 'M' or L_CHAR = 'Q'
or L_CHAR = 'Y' or L_CHAR = 'J').
MESSAGE E398(00) WITH TEXT-001 ' ' ' ' ' '.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-001.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
clear: L_CHAR, L_NUM.
L_CHAR = L_REF1+1(1).
L_NUM = L_CHAR.
if not L_CHAR = '0'.
if L_NUM = 0.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-001.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
endif.
clear: L_CHAR, L_NUM.
L_CHAR = L_REF1+2(1).
L_NUM = L_CHAR.
if not L_CHAR = '0'.
if L_NUM = 0.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-001.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
endif.
clear: L_CHAR, L_NUM.
L_CHAR = L_REF1+3(1).
L_NUM = L_CHAR.
if not L_CHAR = '0'.
if L_NUM = 0.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-001.
L_ERR-REC_NO = G_CNTR.
append L_ERR-ERR_MESG to GT_ZGF_ICO_RECHR_ERRORS.
VALID = 'F'.
endif.
endif.
if not ( L_REF-FREQ = 'M' or L_REF-FREQ = 'Q' or L_REF-FREQ = 'Y').
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-002.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
if not ( L_REF-CODE = 'A' or L_REF-CODE = 'B' or L_REF-CODE = 'C'
or L_REF-CODE = 'D' or L_REF-CODE = 'E'
or L_REF-CODE = 'F' ).
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-003.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
*Customer FROM must not be flagged for deletion in KNB1. (KNB1-LOEVM
*must be space), otherwise error message with TEXT-007. (ZGF_ICO_RECHR
*validation error From customer marked for deletion rec.x) where x
*ist the number of the incorrect record.
select single * from KNB1 into L_KNB1
where KUNNR = L_REF-CUSTFR.
if SY-SUBRC = 0.
if not L_KNB1-LOEVM is initial.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-007.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
if not L_KNB1-SPERR is initial.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-006.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
endif.
select single * from TBSL into L_TBSL
where BSCHL = L_REF-PKFRD.
if not L_TBSL-KOART = 'D'.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-008.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
select single * from TBSL into L_TBSL
where BSCHL = L_REF-PKFRS.
if not L_TBSL-KOART = 'S'.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-009.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
if not L_REF-PLTFR is initial.
select single * from CSKS into L_CSKS
where ZZWERKS = L_REF-PKFRS.
if SY-SUBRC <> 0.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-012.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
endif.
select single * from LFB1 into L_LFB1
where LIFNR = L_REF-CUSTTO.
if not L_LFB1-LOEVM is initial.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-018.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
if not LFB1-SPERR is initial.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-019.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
select single * from TBSL into L_TBSL
where BSCHL = L_REF-PKTOK.
if not L_TBSL-KOART = 'K'.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-020.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
select single * from TBSL into L_TBSL
where BSCHL = L_REF-PKTOS.
if not L_TBSL-KOART = 'S'.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-021.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
if not L_REF-TOTAL > 0.
clear L_ERR.
L_ERR = L_REF.
L_ERR-ERR_MESG = TEXT-017.
L_ERR-REC_NO = G_CNTR.
append L_ERR to GT_ZGF_ICO_RECHR_ERRORS.
append L_ERR-ERR_MESG to ERROR_TAB.
VALID = 'F'.
endif.
return valid.
endmethod. "check_validity
--- Method Post Invoice Start ---
method POST_INVOICE.
endmethod. "post_invoice
--- Method Post Invoice End ---
--- Method Filling Bapi Tables Start ---
method FILL_BAPI_TABLES.
*---- Populating Bapi for Customer
V_TOTAL = L_REF-TOTAL.
perform FILL_BAPI_CUSTOMER.
V_ERROR1 = 'N'.
V_ERROR2 = 'N'.
delete IT_ERROR where NODE_ID = L_SELECTED_NODE.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = SY-ULINE(30).
append IS_ERROR to IT_ERROR.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = L_REF-REF.
append IS_ERROR to IT_ERROR.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = SY-ULINE(30).
append IS_ERROR to IT_ERROR.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = '*** Checking Customer Document ***'.
append IS_ERROR to IT_ERROR.
clear IS_ERROR.
*---- Checking for 1st Document
call function 'BAPI_ACC_DOCUMENT_CHECK'
exporting
DOCUMENTHEADER = WA_DOCUMENTHEADER
tables
ACCOUNTGL = LT_ACCOUNTGL
ACCOUNTRECEIVABLE =
LT_ACCOUNTRECEIVABLE
ACCOUNTTAX = LT_ACCOUNTTAX
CURRENCYAMOUNT = LT_CURRENCYAMOUNT
RETURN = LT_RETURN.
loop at LT_RETURN into WA_RETURN.
if WA_RETURN-TYPE = 'E' or WA_RETURN-TYPE = 'A'.
V_ERROR1 = 'Y'.
endif.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
concatenate WA_RETURN-TYPE WA_RETURN-MESSAGE into IS_ERROR-ERROR
separated by '-'.
append IS_ERROR to IT_ERROR.
endloop.
*--- Checking for 2nd Document
if V_ERROR1 = 'N'.
*---- Populating Bapi for Vendor
L_REF-TOTAL = V_TOTAL.
perform FILL_BAPI_VENDOR.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = '*** Checking for Vendor Document ***'.
append IS_ERROR to IT_ERROR.
clear IS_ERROR.
call function 'BAPI_ACC_DOCUMENT_CHECK'
exporting
DOCUMENTHEADER = WA_DOCUMENTHEADER2
tables
ACCOUNTGL = LT_ACCOUNTGL2
ACCOUNTPAYABLE = LT_ACCOUNTPAYABLE
ACCOUNTTAX = LT_ACCOUNTTAX2
CURRENCYAMOUNT = LT_CURRENCYAMOUNT2
RETURN = LT_RETURN2.
loop at LT_RETURN2 into WA_RETURN2.
if WA_RETURN-TYPE = 'E' or WA_RETURN-TYPE = 'A'.
V_ERROR2 = 'Y'.
endif.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
concatenate WA_RETURN2-TYPE WA_RETURN2-MESSAGE into
IS_ERROR-ERROR separated by '-'.
append IS_ERROR to IT_ERROR.
endloop.
endif.
*--- CHECK WHETHER BOTH DOCUMENTS ARE CORRECT OR NOT returned SUCCESS
if V_ERROR1 = 'N' and V_ERROR2 = 'N'.
*--- Posting 1st Document - Customer
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = '*** Posting Customer Document ***'.
append IS_ERROR to IT_ERROR.
clear IS_ERROR.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
DOCUMENTHEADER = WA_DOCUMENTHEADER
tables
ACCOUNTGL = LT_ACCOUNTGL
ACCOUNTRECEIVABLE =
LT_ACCOUNTRECEIVABLE
ACCOUNTTAX = LT_ACCOUNTTAX
CURRENCYAMOUNT = LT_CURRENCYAMOUNT
RETURN = LT_RETURN.
call function 'BAPI_TRANSACTION_COMMIT'.
loop at LT_RETURN into WA_RETURN.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
concatenate WA_RETURN-TYPE WA_RETURN-MESSAGE into IS_ERROR-ERROR
separated by '-'.
append IS_ERROR to IT_ERROR.
endloop.
*--- Posting 2nd Document - Vendor
IS_ERROR-NODE_ID = L_SELECTED_NODE.
IS_ERROR-ERROR = '*** Posting Vendor Document ***'.
append IS_ERROR to IT_ERROR.
clear IS_ERROR.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
DOCUMENTHEADER = WA_DOCUMENTHEADER2
tables
ACCOUNTGL = LT_ACCOUNTGL2
ACCOUNTPAYABLE = LT_ACCOUNTPAYABLE
ACCOUNTTAX = LT_ACCOUNTTAX2
CURRENCYAMOUNT = LT_CURRENCYAMOUNT2
RETURN = LT_RETURN2.
call function 'BAPI_TRANSACTION_COMMIT'.
loop at LT_RETURN2 into WA_RETURN2.
IS_ERROR-NODE_ID = L_SELECTED_NODE.
concatenate WA_RETURN2-TYPE WA_RETURN2-MESSAGE into
IS_ERROR-ERROR separated by '-'.
append IS_ERROR to IT_ERROR.
endloop.
endif. "if V_ERROR1 = 'N' and V_ERROR2 = 'N'.
*--- Setting colour of node.
data: LO_REF type ref to LCL_REF,
IS_NODE_LAYOUT type LVC_S_LACN,
L_NODE_TEXT type LVC_VALUE,
WA_OREF type TY_REF.
clear :IS_NODE_LAYOUT,L_NODE_TEXT, WA_OREF, LO_REF.
create object LO_REF exporting IM_REF = LS_ZGF_ICO_RECHR.
IS_NODE_LAYOUT = LO_REF->GET_DIVAC( ).
read table GT_ZGF_ICO_RECHR into L_REF index L_SELECTED_NODE.
L_NODE_TEXT = L_REF-REF.
call method G_ALV_TREE->CHANGE_NODE
exporting
I_NODE_KEY = L_SELECTED_NODE
I_OUTTAB_LINE = L_REF
IS_NODE_LAYOUT = IS_NODE_LAYOUT
I_NODE_TEXT = L_NODE_TEXT
I_U_NODE_TEXT = 'X'
exceptions
NODE_NOT_FOUND = 1
others = 2.
call method G_ALV_TREE->FRONTEND_UPDATE.
call method CL_GUI_CFW=>FLUSH
exceptions
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
endmethod. "fill_int_tables
endclass. "lcl_ref IMPLEMENTATION
CLASS lcl_event_handler DEFINITION
class LCL_EVENT_HANDLER definition.
public section.
class-methods : ON_NODE_CLICK for event
NODE_DOUBLE_CLICK of CL_GUI_ALV_TREE
importing NODE_KEY.
methods: ON_FUNCTION_SELECTED
for event FUNCTION_SELECTED of CL_GUI_TOOLBAR
importing FCODE.
endclass. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
class LCL_EVENT_HANDLER implementation.
method ON_NODE_CLICK.
endmethod. "on_node_click
method ON_FUNCTION_SELECTED.
data: LT_SELECTED_NODES type LVC_T_NKEY,
L_RC type C,
L_CAN type C,
L_REC type I,
WA_OREF type TY_REF,
L_LINE type SY-TABIX.
Determine which line is selected
call method G_ALV_TREE->GET_SELECTED_NODES
changing
CT_SELECTED_NODES = LT_SELECTED_NODES.
call method CL_GUI_CFW=>FLUSH.
remark: The user can not select more than one node since the
default value of NODE_SELECTION_MODE is
cl_gui_column_Tree=>NODE_SEL_MODE_SINGLE (see constructor).
describe table LT_SELECTED_NODES lines L_REC.
if L_REC = 0 and FCODE = 'ERROR'.
*--- Show log for all if nothing is selected then.
refresh LT_ERRORS.
clear LT_ERRORS.
loop at IT_ERROR into IS_ERROR.
IS_ERRORS-LINE = IS_ERROR-ERROR.
append IS_ERRORS to LT_ERRORS.
endloop.
call method G_LOGGER->SET_TEXT_AS_R3TABLE
exporting
TABLE = LT_ERRORS.
endif.
loop at LT_SELECTED_NODES into L_SELECTED_NODE.
clear : L_REF, WA_OREF.
L_LINE = SY-TABIX.
read table GT_OREF into WA_OREF index L_SELECTED_NODE.
read table GT_ZGF_ICO_RECHR into L_REF index L_SELECTED_NODE.
if SY-SUBRC = 0.
case FCODE.
when 'ERROR'.
refresh LT_ERRORS.
clear LT_ERRORS.
loop at IT_ERROR into IS_ERROR where NODE_ID =
L_SELECTED_NODE.
IS_ERRORS-LINE = IS_ERROR-ERROR.
append IS_ERRORS to LT_ERRORS.
endloop.
call method G_LOGGER->SET_TEXT_AS_R3TABLE
exporting
TABLE = LT_ERRORS.
when 'POST'.
if L_LINE = 1.
if WA_OREF-O_REF->IS_VALID( ) = 'X'.
clear L_RC.
call function 'POPUP_TO_CONFIRM_STEP'
exporting
TEXTLINE1 = 'Do you want to post' "(902)
TEXTLINE2 = '?' "(903)
TITEL = 'Confirmation' "(904)
CANCEL_DISPLAY = ' '
importing
ANSWER = L_RC.
else.
call function 'POPUP_TO_INFORM'
exporting
TITEL = 'Select Another Record..'
TXT1 = 'Data Wrong,'
TXT2 = 'Posting Can Not be Done'.
endif.
else.
L_RC = 'J'.
endif.
if L_RC eq 'J'.
*---Post Invoice.
if WA_OREF-O_REF->CAN_POST( ) = 'X'.
call method WA_OREF-O_REF->POST_INVOICE.
*---Printing Log.
refresh LT_ERRORS.
clear LT_ERRORS.
loop at IT_ERROR into IS_ERROR.
IS_ERRORS-LINE = IS_ERROR-ERROR.
append IS_ERRORS to LT_ERRORS.
endloop.
call method G_LOGGER->SET_TEXT_AS_R3TABLE
exporting
TABLE = LT_ERRORS.
endif.
endif.
when 'PRINT'.
call method WA_OREF-O_REF->PRINT_INVOICE.
endcase.
else.
message I000(0K) with 'Please select a node.'.
endif.
endloop.
endmethod. "on_function_selected
endclass. "lcl_event_handler IMPLEMENTATION
START-OF-SELECTION.
start-of-selection.
end-of-selection.
call screen 100.
*& Module STATUS_0100 OUTPUT
module STATUS_0100 output.
set pf-status 'MAIN100'.
set titlebar 'MAINTITLE'.
if G_ALV_TREE is initial.
perform INIT_TREE.
call method CL_GUI_CFW=>FLUSH
exceptions
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
if SY-SUBRC ne 0.
call function 'POPUP_TO_INFORM'
exporting
titel = 'Automation Queue failure'(801)
txt1 = 'Internal error:'(802)
txt2 = 'A method in the automation queue'(803)
txt3 = 'caused a failure.'(804).
endif.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Form init_tree
text
--> p1 text
<-- p2 text
form INIT_TREE .
data: L_TREE_CONTAINER_NAME(30) type C.
*Reference tree
L_TREE_CONTAINER_NAME = 'ZCONTAINER'.
create object G_CUSTOM_CONTAINER
exporting
CONTAINER_NAME = L_TREE_CONTAINER_NAME
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
if SY-SUBRC <> 0.
MESSAGE x208(00) WITH 'ERROR'(100).
endif.
create tree control
create object G_ALV_TREE
exporting
PARENT = G_CUSTOM_CONTAINER
NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_MULTIPLE
NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_SINGLE
ITEM_SELECTION = 'X'
NO_HTML_HEADER = ''
NO_TOOLBAR = ''
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
ILLEGAL_NODE_SELECTION_MODE = 5
FAILED = 6
ILLEGAL_COLUMN_NAME = 7.
if SY-SUBRC <> 0.
message X208(00) with 'ERROR'. "#EC NOTEXT
endif.
****logger
L_TREE_CONTAINER_NAME = 'ZLOGGER'.
create object G_TEXT_CONTAINER
exporting
CONTAINER_NAME = L_TREE_CONTAINER_NAME
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
create object G_LOGGER
exporting PARENT = G_TEXT_CONTAINER
NAME = 'Error Log'.
call method G_LOGGER->SET_READONLY_MODE.
endlogger
data L_HIERARCHY_HEADER type TREEV_HHDR.
data: LT_LIST_COMMENTARY type SLIS_T_LISTHEADER,
L_LOGO type SDYDO_VALUE.
data : WA_FIELDCATALOG type LVC_S_FCAT.
perform BUILD_HIERARCHY_HEADER changing L_HIERARCHY_HEADER.
perform BUILD_COMMENT using LT_LIST_COMMENTARY
L_LOGO.
clear : WA_FIELDCATALOG, GT_FIELDCATALOG.
get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
I_STRUCTURE_NAME = 'ZGF_ICO_RECHR'
changing
CT_FIELDCAT = GT_FIELDCATALOG.
loop at GT_FIELDCATALOG into WA_FIELDCATALOG.
case WA_FIELDCATALOG-FIELDNAME.
when 'REF'.
WA_FIELDCATALOG-NO_OUT = 'X'.
endcase.
WA_FIELDCATALOG-OUTPUTLEN = 15.
modify GT_FIELDCATALOG from WA_FIELDCATALOG.
endloop.
call method G_ALV_TREE->SET_TABLE_FOR_FIRST_DISPLAY
exporting
IT_LIST_COMMENTARY = LT_LIST_COMMENTARY
I_LOGO = L_LOGO
i_structure_name = 'ZGF_ICO_RECHR'
IS_HIERARCHY_HEADER = L_HIERARCHY_HEADER
changing
IT_FIELDCATALOG = GT_FIELDCATALOG
IT_OUTTAB = GT_ZGF_ICO_RECHR. "table must be empty !
perform CREATE_HIERARCHY.
perform CHANGE_TOOLBAR.
perform REGISTER_EVENTS.
call method G_ALV_TREE->FRONTEND_UPDATE.
endform. " init_tree
*& Form build_hierarchy_header
form BUILD_HIERARCHY_HEADER changing
P_HIERARCHY_HEADER type TREEV_HHDR.
P_HIERARCHY_HEADER-HEADING = 'Reference Number'(300).
P_HIERARCHY_HEADER-TOOLTIP = 'Reference numbers for invoices'(400).
P_HIERARCHY_HEADER-WIDTH = 30.
P_HIERARCHY_HEADER-WIDTH_PIX = ' '.
endform. " build_hierarchy_header
*& Form create_hierarchy
form CREATE_HIERARCHY .
clear : LS_ZGF_ICO_RECHR, L_LAST_KEY.
§4a. Select data
refresh GT_ZGF_ICO_RECHR.
select * from ZGF_ICO_RECHR into table LT_ZGF_ICO_RECHR
where FREQ in SO_FREQ
and REF in SO_REF.
sort LT_ZGF_ICO_RECHR by REF.
Note: The top level nodes do not correspond to a field of the
output table. Instead we use data of the table to invent another
hierarchy level above the levels that can be build by sorting.
§4c. Add data to tree
G_CNTR = 1.
sort by oref->get_diva->image .
loop at LT_ZGF_ICO_RECHR into LS_ZGF_ICO_RECHR.
perform ADD_COMPLETE_LINE using LS_ZGF_ICO_RECHR
changing L_LAST_KEY.
G_CNTR = G_CNTR + 1.
perform add_node using ls_zgf_ico_rechr-ref
changing l_last_key.
endloop.
endform. " create_hierarchy
*& Module USER_COMMAND_0100 INPUT
module USER_COMMAND_0100 input.
SAVE_OK = OKCODE.
clear OKCODE.
case SAVE_OK.
when 'EXIT' or 'BACK' or 'CANC'.
perform EXIT_PROGRAM.
when others.
§6. Call dispatch to process toolbar functions
call method CL_GUI_CFW=>DISPATCH.
endcase.
call method CL_GUI_CFW=>FLUSH.
endmodule. " USER_COMMAND_0100 INPUT
*& Form exit_program
text
form EXIT_PROGRAM .
call method G_CUSTOM_CONTAINER->FREE.
leave to screen 0.
endform. " exit_program
*& Form add_complete_line
form ADD_COMPLETE_LINE using P_LS_ZGF_ICO_RECHR type ZGF_ICO_RECHR
P_RELAT_KEY type LVC_NKEY
changing P_NODE_KEY type LVC_NKEY.
data: L_NODE_TEXT type LVC_VALUE,
LO_REF type ref to LCL_REF,
L_NODE_LAYOUT type LVC_S_LAYN.
add leaf:
ALV Tree firstly inserts this node as a leaf if you do not provide
IS_NODE_LAYOUT with field ISFOLDER set.
Since these nodes will never get children they stay leaves
(as intended).
clear L_NODE_LAYOUT.
create object LO_REF exporting IM_REF = P_LS_ZGF_ICO_RECHR.
data : WA_OREF type TY_REF.
clear WA_OREF.
WA_OREF-O_REF = LO_REF.
append WA_OREF to GT_OREF.
L_NODE_LAYOUT = LO_REF->GET_DIVA( ).
L_NODE_TEXT = P_LS_ZGF_ICO_RECHR-REF.
call method G_ALV_TREE->ADD_NODE
exporting
I_RELAT_NODE_KEY = P_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
IS_OUTTAB_LINE = P_LS_ZGF_ICO_RECHR "_REF
I_NODE_TEXT = L_NODE_TEXT
IS_NODE_LAYOUT = L_NODE_LAYOUT
importing
E_NEW_NODE_KEY = P_NODE_KEY.
endform. " add_complete_line
*& Form add_node
form ADD_NODE using P_REF
changing P_NODE_KEY type LVC_NKEY.
clear L_NODE_LAYOUT.
L_NODE_LAYOUT-ISFOLDER = ''.
L_NODE_LAYOUT-N_IMAGE = ICON_POSITIVE.
L_NODE_TEXT = 'Reference1'. " ps_sflight-carrid.
call method G_ALV_TREE->ADD_NODE
exporting
I_RELAT_NODE_KEY = '' " p_relat_key
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
I_NODE_TEXT = L_NODE_TEXT
IS_OUTTAB_LINE = P_REF
IS_NODE_LAYOUT = L_NODE_LAYOUT
importing
E_NEW_NODE_KEY = P_NODE_KEY.
endform. " add_node
*& Form register_events
form REGISTER_EVENTS .
data: LT_EVENTS type CNTL_SIMPLE_EVENTS,
L_EVENT type CNTL_SIMPLE_EVENT,
L_EVENT_RECEIVER type ref to LCL_EVENT_HANDLER.
call method G_ALV_TREE->GET_REGISTERED_EVENTS
importing
EVENTS = LT_EVENTS.
*NODE_DOUBLE_CLICK
clear L_EVENT.
move CL_GUI_COLUMN_TREE=>EVENTID_NODE_DOUBLE_CLICK to L_EVENT-EVENTID.
append L_EOk fine that can be acchived by setting the retention policy and by issuing delete obsolete command.That's perfect.If FRA is configured then even delete obsolete command is also not required.
but i want to keep the last full backup for 15 days and archived logs only for one day.In this case can we set seperate retention policy for full backup and backup of archived logs
for the time being i just want to modify my present existing OS script to acchive my task and i will conside changing RMAN script later on.Can u provide me the modified OS script so that my work gets finishes succesfully.
Thank You... -
What is the diff b\w open form and start form in scripts.
Hi,
can any one tell me what is the diff andb\w open form and start form in scripts.when we should use open form and when start form.Hi Friend.
I have understood some usefull information and would like to share with you.
Within one transaction, you can open and close several layout sets using OPEN_FORM and
CLOSE_FORM, however not simultaneously. You can use parameters in the OPEN_FORM to control
whether the output is stored in the same print request. But also the SAP spool decides,
depending on several plausibility checks, whether new output is appended to an existing
print request or whether to create a new print request anyway.
CALL FUNCTION 'OPEN_FORM'
CALL FUNCTION 'CLOSE_FORM'
CALL FUNCTION 'OPEN_FORM'
CALL FUNCTION 'CLOSE_FORM'
You cannot combine ABAP/4 list output and SAPscript output in one print request.
START A LAYOUT SET AGAIN
Usually a print program does not print only one urging letter or one account statement, but
several layout sets for different customers. To have the output for each customer begin with
the start page of the layout set, you must start the current layout set again and again.
To start a layout set again, you must first end the current layout set and then open the
layout set again. Within one print request, first call the function module END_FORM. It
executes the final processing for the current layout set. Then start the layout set again
using START_FORM. Output then begins again on the start page of the desired layout set.
CALL FUNCTION 'OPEN_FORM'
CALL FUNCTION 'START_FORM'
CALL FUNCTION 'END_FORM'
CALL FUNCTION 'START_FORM'
CALL FUNCTION 'END_FORM'
CALL FUNCTION CLOSE_FORM
Hope your obstacle is cleared.
If not do ask me again? -
hi all,
Can i write a loop or a statement similar to that in an SAP scripts.
If yes how?
thanks
regards
nayanI did not understand your question correctly..
If you want to write a loop statement in SAPscript then you have to write it down in your driver program, there is no other way you can loop your internal table inside form.
Ex:
OPEN_FORM.
LOOP AT <itab>
WRITE_FORM
ENDLOOP.
CLOSE_FORM
Regards,
SaiRam -
How to clear fields used in SAP SCRIPT
hi all,
i want to clear all fields which i have printed on my sap script.
i have passed the values to these fields by useing function module
'TEXT_SYMBOL_SETVALUE' in se38 abap program.
i have also used clear statement in my abap program to clear those fields but it cant working. is there any statement in SAPSCRIPT to clear fields.
if so then please give me its an urgent.
thanks in advance.
Vinod.hey,
I understand that in a text-symbol when u set the values once, then u print them. for the second time when u want to print with diff values, then it will automatically get refreshed when u open it again.
So use code like this.
PERFORM OPEN_FORM USING FORMNAME.
PERFORM WRITE_FORM USING TEXT_SYM.
PERFORM CLOSE_FORM
for the next run...
at this instant all the text elements will get refreshed.
PERFORM OPEN_FORM USING FORMNAME.
PERFORM WRITE_FORM USING TEXT_SYM.
PERFORM CLOSE_FORM
Cheers,
Sam -
Missing fields in the output while using SAP SCRIPT
Hi,
I am working on an issue where we are using F110 to print some checks, and for this we have created a custom sap script and we are using a std driver program RFFOUS_C, we have also maintianed a custom subroutine pool ZRFFOUS which will retrieve the missing data for the sap script which was not there in the std. program. Now we have applied a SP to our system and since then we are having a problem...when we are printing the chechks its missing some fields.
Surpisingly, it is happening for all scripts like Dunning, invoice......
These scripts are working good in production which is not applied patches.
I have tried in all ways, did debug, data is there in tables and scripts are exactly same as in production.
Could you please share any ideas regarding this? What would be the effect of patches?
Thanks
ShaHi ,
I think u r printing the Check through the Tr Code F110.
In that program u r using the Standard Driver Program RFFOUS_C and u create a New Sap script.
and also u also mantained the custom subroutine pool ZRFFOUS . when ru giving printing u are not able to print some field.
In this case when u using the Standard driver Program RFFOUS_C in that program there is a Include Progran * RFFORI01---- check ,
in this program it is calling the Standard Form (F110PRENUM_CHCK) i--e t042e-zforn .as shown in the below and it is calling the function module 'OPEN_FORM'._
Please copy the form asZF110_PRENUM_CHCK and and do the changes in that form . and we need to maintained the Form as Company code level -- and it will shown this Table T042E (Company Code-Specific Specifications for Payment Methods)
Please go to Transaction Code FBZP and U can maitained the New Sap Script Form Company Code Level.
one thing while u calling your new subroutine pool ZRFFOUS Please call this subroutine in your Sap Script form then only u can see all values in your Check. and Actvate the Sap script .
Like U can call your new subroutine ZRFFOUS in your New Sap script Program.
/E CHECK
/: PERFORM XXXXXXX IN PROGRAM XXXXXX''
/: PERFORM CHECK_NAME IN PROGRAM ZRFFOUS
/: USING &XXXXXXX&
/: CHANGING &XXXXXX&
/: ENDPERFORM
In the subroutine pool ZRFFOUS u have to call as
FORM CHECK_NAME TABLES t_data_in STRUCTURE itcsy
t_data_out STRUCTURE itcsy.
xxxxx
xxxxx
xxxxx
ENDFORM.
In this case when u using the Standard driver Program RFFOUS_C in that program there is a Include Progran * RFFORI01---- check ,
in this program it is calling the Standard Form (F110_PRENUM_CHCK) i--e t042e-zforn .
open check form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = t042e-zforn
device = 'PRINTER'
language = t001-spras
options = itcpo
dialog = space
EXCEPTIONS
form = 1.
IF sy-subrc EQ 1. "abend:
IF sy-batch EQ space. "form is not active
MESSAGE a069 WITH t042e-zforn.
ELSE.
MESSAGE s069 WITH t042e-zforn.
MESSAGE s094.
STOP.
ENDIF.
ENDIF.
I thing it will help u to solve this issue.
Thanks.
Gagan -
All values in internal table are not displaing in the script print program
Hi,
I am calling the script program.In main window all values in the internal table are not displaying. I wrote
write-form statement in loop. But not all the values are getting displayed. Only thel ast values getting dispalyed.
*& Report ZSCRIPT_116719
REPORT ZSCRIPT_116719.
************Table decleration***************
TABLES: mara, mbew, makt.
loop at i_makt into wa_makt.
endloop.
loop at i_MARA into wa_mara.
endloop.
LOOP AT I_MBEW INTO WA_MBEW.
ENDLOOP.
lv_price = 0.
********************Total Price******************
LOOP AT i_mbew INTO wa_mbew.
lv_price = lv_price + wa_mbew-stprs.
ENDLOOP.
end-of-selection.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZSCRIPT_719'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
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.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = 'ZSCRIPT_719'
LANGUAGE = SY-LANGU
STARTPAGE = ' '
PROGRAM = 'ZSCRIPT_116719'
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.
*LOOP AT I_MBEW INTO WA_MBEW.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA'
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.
If I give only one value it is showing the output. When I am fetching the data for range of values it i sshowing start_form is not there.
Plz let me know how to get the aa internal table values to be displayedhi
I shortened your program a bit. So we can go to essentials of your question.
You said you put in it in a loop.
What i see in your prog is:
REPORT zscript_116719.
************table decleration***************
TABLES: mara, mbew, makt.
LOOP AT i_makt INTO wa_makt.
ENDLOOP.
LOOP AT i_mara INTO wa_mara.
ENDLOOP.
LOOP AT i_mbew INTO wa_mbew.
ENDLOOP.
lv_price = 0.
********************total price******************
LOOP AT i_mbew INTO wa_mbew.
lv_price = lv_price + wa_mbew-stprs.
ENDLOOP.
END-OF-SELECTION.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZSCRIPT_719'
language = sy-langu.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZSCRIPT_719'
language = sy-langu
program = 'ZSCRIPT_116719'.
*LOOP AT I_MBEW INTO WA_MBEW.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'DATA'
function = 'SET'
type = 'BODY'
window = 'MAIN'.
*endloop.
1. Your loop is not a loop with this '*' in front of it.
2. Are you printing &wa_mbew-???& variables in your sap-script
3. is itab I_MBEW properly filled
Let me know.
Gr. Frank -
Dear all
I want to make a driver program in sapscripts for Delivery note...since i am new to this topic then also i am done with the layout . please help me the program. i want the example code which is easy to read and understand.
thanks in advance...
MohitHi Mohit,
Go through the following code.
START-OF-SELECTION.
PERFORM GET_DATA CHANGING WA_MARC
I_MARC.
PERFORM GET_DATA1 CHANGING I_MARC
I_VBAP.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZPAVSCRIPT1'
LANGUAGE = SY-LANGU .
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 I_VBAP INTO WA_VBAP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
FUNCTION = 'APPEND'
TYPE = 'BODY'
WINDOW = 'MAIN.
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.
CALL FUNCTION 'CLOSE_FORM' .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In the script layout,create a MAIN window,in that create a Text element (i named it MAIN in my program).
call these functions using button "Pattern" in toolbar.
In the above forms Get_data & get_data1,write the required code.....
This is the example code to b written in driver program...
Dont forget to reward points if helpful....
Pavan. -
Logo is not coming properly while mailing the script
this is my code..
m converting script output to pdf and sending as attachment... my pdf conatains LOGO.. when i received the mail,text is coming properly but LOGO is not getting printed properly..
pls suggest any solution to this...
thanking u in advance...
*& Report ZZGBTEST_PDF
REPORT ZZGBTEST_PDF.
TABLES: PA0105.
DATA: LF_FM_NAME TYPE RS38L_FNAM.
DATA: WA_CTRLOP TYPE SSFCTRLOP,
WA_OUTOPT TYPE SSFCOMPOP,
WA_STXH LIKE STXH.
DATA: T_OTFDATA TYPE SSFCRESCL,
T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE,
T_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA : T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
W_FILESIZE TYPE I,
W_BIN_FILESIZE TYPE I.
*OBJECTS TO SEND MAIL.
DATA : I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLIX OCCURS 0 WITH HEADER LINE,
I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_OBJHEAD TYPE SOLI_TAB,
W_DOC_CHNG TYPE SODOCCHGI1,
W_BUFFER TYPe STRING. "TO CONVERT FROM 132 TO 255.
DATA : V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK SCR WITH FRAME TITLE TEXT-900.
SELECT-OPTIONS: MAILTO FOR PA0105-USRID_LONG NO INTERVALS.
PARAMETERS : WDATE LIKE SY-DATUM DEFAULT SY-DATUM,
TESTRUN AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK SCR.
DATA: DATAB TYPE TABLE OF ITCOO WITH HEADER LINE,
PDFTAB TYPE TABLE OF TLINE WITH HEADER LINE,
BINFILESIZE TYPE I.
DATA: FNAME TYPE STRING,
FPATH TYPE STRING,
FULL_PATH TYPE STRING.
DATA: STRUCT TYPE ITCPO.
START-OF-SELECTION.
WA_CTRLOP-GETOTF = 'X'.
WA_CTRLOP-NO_DIALOG = 'X'.
WA_OUTOPT-TDNOPREV = 'X'.
STRUCT-TDDEST = 'LP01'.
STRUCT-TDNOPREV = 'X'.
STRUCT-TDGETOTF = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = SPACE
FORM = 'ZGBTEST'
LANGUAGE = SY-LANGU
OPTIONS = STRUCT
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.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
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.
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = DATAB[]
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..
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = BINFILESIZE
TABLES
OTF = DATAB[]
LINES = T_PDF_TAB[]
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF SY-SUBRC EQ 0.
MESSAGE 'SCRIPT SUCCESSFULLY CONVERT IN TO PDF' TYPE 'I'.
ENDIF.
LOOP AT T_PDF_TAB.
REPLACING SPACE BY ~
TRANSLATE T_PDF_TAB USING ' ~'.
CONCATENATE W_BUFFER T_PDF_TAB INTO W_BUFFER.
ENDLOOP.
REPLACING ~ BY SPACE
TRANSLATE W_BUFFER USING '~ '.
DO.
I_RECORD = W_BUFFER.
APPENDING 255 CHARACTERS AS A RECORD
APPEND I_RECORD.
SHIFT W_BUFFER LEFT BY 255 PLACES.
IF W_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
REFRESH : I_RECLIST, I_OBJTXT, I_OBJBIN, I_OBJPACK.
CLEAR W_OBJHEAD.
OBJECT WITH PDF.
I_OBJBIN[] = I_RECORD[].
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
MAIL TEXT TO BE FILLED UP HERE
SELECT SINGLE TDID TDSPRAS TDNAME TDOBJECT FROM STXH INTO
CORRESPONDING FIELDS OF WA_STXH
WHERE TDOBJECT ='TEXT' AND TDNAME = 'ZGBTEST'.
IF SY-SUBRC = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = WA_STXH-TDID
LANGUAGE = WA_STXH-TDSPRAS
NAME = WA_STXH-TDNAME
OBJECT = WA_STXH-TDOBJECT
TABLES
LINES = T_LINE.
LOOP AT T_LINE.
I_OBJTXT = T_LINE-TDLINE.
APPEND I_OBJTXT.
ENDLOOP.
ENDIF.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
DOCUMENT INFORMATION.
W_DOC_CHNG-OBJ_NAME = 'FORM'.
W_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
W_DOC_CHNG-SENSITIVTY = 'F'. "FUNCTIONAL OBJECT
W_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
PACK TO MAIN BODY AS RAW.
OBJ. TO BE TRANSPORTED NOT IN BINARY FORM
CLEAR I_OBJPACK-TRANSF_BIN.
START LINE OF OBJECT HEADER IN TRANSPORT PACKET
I_OBJPACK-HEAD_START = 1.
NUMBER OF LINES OF AN OBJECT HEADER IN OBJECT PACKET
I_OBJPACK-HEAD_NUM = 0.
START LINE OF OBJECT CONTENTS IN AN OBJECT PACKET
I_OBJPACK-BODY_START = 1.
NUMBER OF LINES OF THE OBJECT CONTENTS IN AN OBJECT PACKET
I_OBJPACK-BODY_NUM = V_LINES_TXT.
CODE FOR DOCUMENT CLASS
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
PACKING AS PDF.
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 1.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'FORM'.
I_OBJPACK-OBJ_DESCR = 'temp.PDF'.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
APPEND I_OBJPACK.
DOCUMENT INFORMATION.
CLEAR I_RECLIST.
CLEAR I_RECLIST[].
E-MAIL RECEIVERS.
LOOP AT MAILTO.
I_RECLIST-RECEIVER = MAILTO-LOW.
I_RECLIST-EXPRESS = 'X'.
I_RECLIST-REC_TYPE = 'U'. "INTERNET ADDRESS
APPEND I_RECLIST.
ENDLOOP.
SENDING MAIL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = W_OBJHEAD
CONTENTS_HEX = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC = 0.
WRITE :/ 'MAIL SENT SUCCESSFULLY...'.
ENDIF.
*CALL METHOD cl_gui_frontend_services=>FILE_SAVE_DIALOG
CHANGING
FILENAME = FNAME
PATH = FPATH
FULLPATH = FULL_PATH.
*CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BINFILESIZE
FILENAME = FULL_PATH
FILETYPE = 'BIN'
TABLES
DATA_TAB = PDFTAB[]
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
*IF SY-SUBRC <> 0.
MESSAGE 'Error !!!' TYPE 'E'.
*ELSE.
MESSAGE 'PDF FILE SUCCESSFULLY DOWNLOADED ...!!!' TYPE 'I'.
*ENDIF.Hi Sagar,
In scripts when you will see print preview the logo will be not shown up with clarity.Take the print out of the document and check whether logo is printing up with clarity.
Thanks
Phani
Maybe you are looking for
-
Unable to load Falt file in our new Upgrade BI 7 system ?
Hi all, I am an APO DP consultant and we have recently upgraded from SCM 4.1 version to SCM 7.0. As Apo had Build in BI system and SCM 4.1 uses BI 3.5 and now SCM we have upgraded to BI 7.0. While testing to uplaod sales data into infocube from flat
-
Tried to post a question about restoring my i mac from time machine, but this new format makes no sense to me. I want to restore my i mac from time machine after I reinstall the OS from the original disk. Will a time machine restore only restore th
-
GR slip print-out & automatic default for the print tick
Hi, I have followed the steps as outlined below for the solution and unfortunately the GRN document do not print as anticipated. I was wondering if the non-assignment of the MM or FI Program might be the cause? Please advice if I had missed something
-
Set sleep time for multiple hard drives
I have 2 internal hard drives on my mac, one SSD boot drive and an HDD for media. I would like to have the HDD go to sleep when it is not in use (i.e. when I am not using itunes) which is most of the time. I have energy saver set to sleep drives when
-
Ever since I updated firefox to 3.5.16 java ahs stopped working. Drop down menu's in ebay don't, windows from links (such as tracking in ebay) don't work, pogo game windows won't load or will load the widow frame but not the game itself. I work onlin