Conditional Printing :SMARTFORM
Hello All,
I am new to Smartforms and I am working on reservation pick list. I need to propose available bins based on qty for each line item. So if there are 2 bins for line item 0001, I should display line no, material no, Qty in only on first line.
Should be like this:
Line Material Qty Bins
0001 123456 2 ABC
blank blank blank XYZ
Can somebody tell me where do I put the condition?
Thanks,
Chandni
Please find a very good code sample explaining such condition checks and program lines etc,
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
Regards
Kathirvel
Similar Messages
-
If Condition in Smartform - window text- without program lines
Hi,
I have faced one problem in smartforms. In smartforms i have a window (main.) It has five lines. For Fifth line only i need to check one condition. if it is true then print the Line otherwise i need one Blank line to print.
How i write if condition in smartforms window - text.
Mahesh.Hi Mahesh,
You need to create and alternative node and put your text into that. An alternative will check a condition, and process one of two nodes depending if it is true or false. Based on your condition, on true you can have your current text element and on false a text element containing a blank line.
Regards,
Nick -
ERROR IN OUTPUT WITH CONDITIONS IN SMARTFORM
I have two conditions in smartform.
if i_final-konrth NE g_temp9.
i_final-ssign eq g_temp10.
then we need to print text1 in the output. There are no program lines in the text.
g_temp9 and g_temp10 are passed from the program. text1 is not getting outputted. Could anybody help in this issue ?hI,
i have written break username in program lines but the cursor is not stopping. please tell me why -
Error while printing smartforms
Hi Friends,
I am getting error "<b>Invalid value for parameter ARCHDEST</b>" while printing smartforms. This is happening only in IDES server. In Development the same smartform is working normally. I have checked in transaction SU53, to see whether all the authorisations have been given for IDES server. There is no problem in authorisation also. So what might be the reason for this. Please give me the solution to solve this problem.
Thanks & Regards,
RanjithHi Beginner,
In the layout you have taken window or layout taken the big width in that case only you will get this type error syntatically it shows correct when you exicute the smart from try to give the print or see the print preview you will get this error (suggestion is better to check the window sizes)
Thanks
Ashok -
Problem while printing smartform in dot matrix printer
Hi Experts,
When i am printing smartform using dot matrix printer only the last page prints but all the pages displays in print privew.
For example suppose there are three pages to be print 1/3, 2/3 , 3/3 , i get all the three pages in print privew as well as when i take its printout in laser printer i get all three pages as print, but when i am using dot matrix printer i get only the last page ie 3/3 as print.
Regards
Varun SharmaHai Varun,
If things are coming properly then its no more ABAP issue.
Need to check out with the BASIS team along with the IT / hardware department.
Just try to take print out on a other dotmatrix printer, if its somewhere close to you as usually they are heavy and large in size can't be moved.
Hope this helps,
Cheers,
Suvendu -
Hello Experts,
I am developing new SMARTFROM.
Requirement: On entering the Personnel number(s) on the selection it should print SMARTFORM. for one entry there are two page. so for 2 entries it should show 4 pages. It should work like mass printing.
Error: currently it is working for single entry. but when i entered multiple enteries on selection-screen in print-preview i can see only 2 pages for first. for viewing second entry i need to comback to Printer specification page.
how do i achieve if i enter 2 entries on selection-screen in print preview it should show 4 pages.
ie. for 1st entry two page and for 2nd entry last two page.
Regards
Saurabhcheck the following code, the control parameters need to be changed accordingly.
LOOP AT it_acct.
AT NEW kunnr.
READ TABLE it_acct INDEX sy-tabix.
READ TABLE it_kna1 WITH KEY kunnr = it_acct-kunnr.
READ TABLE it_adrc WITH KEY addrnumber = it_kna1-adrnr.
IF sy-subrc = 0.
wa_adrc = it_adrc.
READ TABLE it_landx WITH KEY land1 = it_adrc-country.
IF sy-subrc = 0.
l_landx = it_landx-landx.
ENDIF.
ENDIF.
CALL FUNCTION 'ZSDG_COMPANY_ADDRESS'
EXPORTING
i_bukrs = it_acct-bukrs
IMPORTING
o_comp_addr = g_comp.
REFRESH it_acct1.
IF g_over = 'X'.
r_duedt-sign = 'I'.
r_duedt-option = 'LE'.
r_duedt-low = date.
APPEND r_duedt.
ENDIF.
LOOP AT it_acct WHERE kunnr = it_acct-kunnr AND duedt IN r_duedt.
MOVE-CORRESPONDING it_acct TO it_acct1 .
APPEND it_acct1.
CLEAR: it_acct,it_acct1.
ENDLOOP.
c_nofopr = c_nofopr + 1.
* t_control_parameters-DEVICE = 'LP01'.
t_control_parameters-no_dialog = 'X'.
t_control_parameters-preview = 'X'.
IF c_nop <> 1.
CASE c_nofopr.
WHEN 1.
t_control_parameters-no_open = ' '.
t_control_parameters-no_close = 'X'.
WHEN c_nop.
t_control_parameters-no_open = 'X'.
t_control_parameters-no_close = ' '.
WHEN OTHERS.
t_control_parameters-no_open = 'X'.
t_control_parameters-no_close = 'X'.
ENDCASE.
ENDIF.
IF doct = 'X'.
doc = 'X'.
ELSE.
doc = 'Y'.
ENDIF.
CALL FUNCTION lf_fm_name
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = t_control_parameters
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
g_comp = g_comp
wa_adrc = wa_adrc
landx = l_landx
p_seldate = date
waers = waers
doc = doc
intrvl1 = intrvl1
intrvl2 = intrvl2
intrvl3 = intrvl3
intrvl4 = intrvl4
g_over = g_over
TABLES
it_acct = it_acct1
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
* 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.
ENDAT.
ENDLOOP. -
Post Author: kirsty
CA Forum: Formula
HiTrying to write formula for conditional printing defining a section,I have created a new section, right click on grey area on the left ofthe report and say insert section below.Went to Section Expert to define a formula for the 'Suppress' tick boxbut cannot get the right formula. I need to display jobnumber ifneeded if not suppress.programming has never been my best subject please helpPost Author: synapsevampire
CA Forum: Formula
If you'd bothered to read my post it stated make up data if need be. Your permissions certainly don't disallow that.
Saying radio button inventory doesn't really help us, post the field and it's type if you want help with code.
v361 took a good stab at it, but you're intentionally wasting yours and other people's time because you don't want to take the time to give examples or post specifics.
If you right click the field you wish to suppress and select format field->X2 next to suppress, you can palce the appropriate code there.
Good luck.
-k -
How to print Smartform in Draft mode.
HI all,
we are using Wipro LQ DSI 5232 printer, our problem is while printing smartform , its coming in Roman but it should come in Draft Mode.
When it goes to Roman mode the printing become very slow.
How to set in default Draft mode.
Regards,
Rahul.Hi,
there is an SBO setting inside
Administation>System Init>Print preferences>Print Draft Watermark on Draft
Then a "DRAFT" watermark will appear if it's printed before adding.
In CR use a stored proc to get data back according to the Objectid@.
Then if its the object id of a draft then add a CR watermark.
Hope this helps.
Regards,
D -
Issue with if condition in smartform text elements
Hi all.
iam having a problem in smart forms
itab has 3 fields
id matnr werks
1 a p1
1 b p2
1 c p3
2 b l1
2 c l2
3 q u1
3 l u2
i neead output like in the smart form
-id = 1-
a p1
b p2
c p3
-id = 2-
b l1
c l2
-id = 3-
q u1
l u2
I have aloop in main window
itab into wa_itab.
then i have program lines
iam writing any perform statment insted iam write the code in here
input paramters wa_itab-id
output paramters id
i declared id type zabc-id under global data in global definations
CLEAR : ID.
ON CHANGE OF WA_itab-ID.
*BREAK point.
ID = WA_ITab-iD.
ENDON.
after the program lines i have a text
/: if &id& ne ' '.
---id = &id& ---
/: endif
&wa_itab-matnr& &wa_itab-werks&
now i see the output
-id = 1-
a p1
-id=- i don't need this (&id& has no value)
b p2
-id=- i don't need this
c p3
-id = 2-
b l1
-id=- i don't need this
c l2
-id = 3-
q u1
-id=- i don't need this
l u2
I checked my code if two items have same id the id has no value and you can see the output also
but for some reason its still goinng into the if condition
And also is there away that i can debugg my text elements like in scripts. my break point doesn't take me to the text elements
Thanks1. Move only the ID into one internal table say i_id,
2. Now in your smartform, create a table and loop at i_id into wa_id.
3.Print your ID in a text, &wa_id-id&
3. Now in main area of the table Create a loop with the internal table you mentioned above with 3 elements, say, i_data into wa_data give CONDITION as wa_data-id = wa_id-id.
4. Print your other values &wa_data-matnr& &wa_data-werks&
5. outside main area, clear the work areas.
This should work fine as i use the same logic in one of my current developments!!! -
Printing Smartform for a series of data
hello People,
i am stuck up in a situation which sums up like this
i am having a range of check numbers for which the details of checks have to be printed.
the req is all the check between the range has to be printed in that many pages and printer should be assigned once only
that is for 10 checks smartform should have 10 pages.
the code i have designed is mentioned below
it is working fine in terms of execution, the only problem is that
only the last check in the range is showing in the preview.
all other are bieng overwritten.
in the debugger i can see the values for all checks being assigned.
<u><i><b>the thing is i want the first time the loop execute it should print check in first page
the next time the loop executes it should print check in second page
and so on till the tenth.</b></i>.</u>
<b>few points i wud lik to mention :
its not the standard check format, so dont think in dat direction,
the whole content including the main and secondary window is changing not just the table in main window</b>
please help
here is the code i devised
upper = upper.
lower = lower.
itab = itab.
select chect
from payr
into table itab
where HBKID EQ BANK
AND CHECT between lower and upper.
break-point.
DATA: l_char18 TYPE char18,
l_p TYPE p DECIMALS 2.
loop at itab into wa_itab.
SELECT SINGLE zbukr
hbkid
hktid
rzawe
chect
lifnr
kunnr
ubhkt
vblnr
zaldt
waers
rwbtr
pridt
zanre
znme1
FROM payr
INTO wa_payr
WHERE chect EQ wa_itab-chect
and hbkid eq bank.
IF sy-subrc EQ 0.
SELECT SINGLE lifnr
adrnr
FROM lfa1
INTO wa_lfa1
WHERE lifnr EQ wa_payr-lifnr.
SELECT SINGLE addrnumber
date_from
nation
name1
name2
name4
city1
post_code1
po_box_loc
street
tel_number
region
FROM adrc
INTO wa_adrc
WHERE addrnumber EQ wa_lfa1-adrnr.
SELECT bukrs
belnr
gjahr
buzei
augbl
shkzg
mwskz
dmbtr
qbshb
FROM bseg
INTO TABLE it_bseg
WHERE augbl EQ wa_payr-vblnr
AND shkzg = 'H'.
IF sy-subrc EQ 0.
SELECT bukrs
belnr
gjahr
xblnr
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bseg
WHERE belnr = it_bseg-belnr.
LOOP AT it_bseg INTO wa_bseg.
READ TABLE it_bkpf INTO wa_bkpf
WITH KEY belnr = wa_bseg-belnr.
wa_disp-billno = wa_bkpf-xblnr.
wa_disp-amount = wa_bseg-dmbtr.
l_char18 = wa_bseg-dmbtr.
SHIFT l_char18 LEFT DELETING LEADING space.
wa_disp-amount = l_char18.
l_p = wa_disp-amount.
CLEAR wa_disp-amount.
wa_disp-amount = l_p.
CLEAR l_p.
SHIFT wa_disp-amount LEFT DELETING LEADING space.
wa_disp-tdsamt = wa_bseg-qbshb.
l_char18 = wa_bseg-qbshb.
SHIFT l_char18 LEFT DELETING LEADING space.
wa_disp-tdsamt = l_char18.
l_p = wa_disp-tdsamt.
CLEAR wa_disp-tdsamt.
wa_disp-tdsamt = l_p.
CLEAR l_p.
SHIFT wa_disp-tdsamt LEFT DELETING LEADING space.
APPEND wa_disp TO it_disp.
CLEAR wa_disp.
ENDLOOP.
ENDIF.
ELSE.
MESSAGE 'Entered Cheque No is Incorrect' TYPE 'E' RAISING exc1.
ENDIF.
endloop.
help people
thanks & regards
Nitinhi Nitin
just give a try with this .
create one loop and for that give your int_tab which holds the records of all the checks say 10 checks.
also create one program lines wherein you l set the flag to 1 whenever the itab count increases if not then set the flag to 0.
now inside the main window create one command node and check the go to new page checkbox and give your second(or next page) name , and in the conditions tab keep the flag = 1.
the extra work you need to do is you have to create one next page with all the same windows which will triggers for evry new line item.
hope it may be helpful to you.
plz reward points if helpful
Regards
Zarina -
How to Handle Blank Field Value based Condition in SmartForms
Dear Sir,
In SMARTFORM , we need to define a Condition that incase Field Value is not equal to BLANK value (blank means that field is empty) then a specific text gets printed .
Our problem is that We do not know as how to define Empty Field Value based condition .
Had it been Non Empty Field value based condition then solution was simple and could be done in following way :
Field Value R Comparision Value
WA_KZDKZ = 'X'
In our case , we need to give Blank (Empty Value) instead of 'X' .
Kindly help us pl .
Rgds
B MittalHi,
To handle blank field values in SMARTFORMS,
Go to the conditions tab in your SMARTFORM and give condition there
Field Comparision operator value
<Field name> <> Here symbol is diff space.
eg:
wa_mara-matnr =/ space.
Regards,
Santosh Kumar M. -
Problem in invoice printing smartform
Sir,
I am encoutring a problem in smartform of invoice printing,
the customer and invoice details are taken in secondary windows,
and the item details are taken in mainwindow.
the main is repeating if that invoice has more no items, to next page.
but the secondary windows for customer and invoice details are not
repeating.
pls provide the solution.
Regards.
Satish.P.HI friend,
Please specify check the Check box only At end of main window in the conditions tab of those two secondary windows ie customer and invoice details secondary windows.
I think this will solve your problem. Revert me if you have any issues i will help you.
Thanks,
Sri Hari -
How to print smartform on both side of pages.
Hi,
I have requirment of printing the smarform on both side of the page. for example the header data and item date on front of the page and terms and condition on the back of the page... can anyone help wht printer settings and wht changes in the smartform needed... its very urgent pls help ASAP.
Thanks in advance.
Abhishek Pandey.Hi Abhishek,
In PAGE node u have Output Options Tab.
In Output Options U can find the field Print Mode
There u need to give the D.
Default: No change of print mode
S Begin new page in SIMPLEX mode (single-sided)
D Begin new page in DUPLEX mode (double-sided)
T Begin new page in TUMBLE DUPLEX mode (double-sided)
DUPLEX:
The current print mode is set to DUPLEX (double-sided print, long-edge
binding) and a new page is started. A form page defined with DUPLEX is
always printed on the front of the page, never on the back of the page.
If the next form page contains the attribute value DEFAULT, it is output
on the back of the page.
Best regards,
raam -
How can i give conditions in smartform text editor
Hi all,
i want to display something based on some condition using text element in smartforms , how can i do it.
in SAP Scripts normally we give conditions in text element using command line(/:)
but it wont work in smartforms , how can i give the same in smartforms ?
please help me soon.
thank you.Hi,
You can use the Conditions tab for the corresponding text.
ex: in the text-editor consider you are displaying a name field based on a variable
<b>
ws_name
ws_variable</b>
In the text give the field to be displayed
&ws_name&
In the conditions tab give
ws_variable = 'X'
This will print the value from ws_name only when ws_Variable = 'X'.
Regards,
Tushar -
Print smartform from background
Dear Experts,
I have requirement to create delivery then create bill automatically so i open background job from program (A) and submit the creating program for bill (B) via this job what happened is the delivery creating is ok, the delivery printing is ok and the billing creation is ok but the billing printing program (C) is not ok where the spool is creating with status waiting so can any body help how to print from background job??
program (A) (Create backgroundjob and submit program via it)
FORM USEREXIT_SAVE_DOCUMENT.
DATA: jobcount TYPE tbtcjob-jobcount,
new_time type TBTCJOB-SDLSTRTTM.
data : p_vbeln TYPE likp-vbeln.
DATA : v_JOB_WAS_RELEASED LIKE BTCH0000-CHAR1.
break rurik.
if T180-TRTYP = 'H'
and ( likp-lfart = 'ZDCF'
or likp-lfart = 'ZDCI'
or likp-lfart = 'ZDCO'
or likp-lfart = 'ZDCP'
or likp-lfart = 'ZDCR'
or likp-lfart = 'ZDOB'
or likp-lfart = 'ZDOT'
or likp-lfart = 'ZDQT'
or likp-lfart = 'ZDRE' - Ian
or likp-lfart = 'ZDSO').
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'SD_AUTOMATION'
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
JOBCOUNT = jobcount
CHANGING
RET =
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
SUBMIT zsd_create_billing_document
with vbeln EQ LIKP-VBELN
AND RETURN
VIA JOB 'SD_AUTOMATION'
NUMBER jobcount.
new_time = sy-uzeit + 10. "short delay
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = 'SD_AUTOMATION'
STRTIMMED = 'X'
SDLSTRTDT = sy-datum
SDLSTRTTM = new_time
IMPORTING
JOB_WAS_RELEASED = v_JOB_WAS_RELEASED
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
INVALID_TARGET = 8
OTHERS = 9
ENDIF.
ENDFORM.
Program B (Creat bill)
REPORT zsd_create_billing_document
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES: vbup, vbak, vbuk.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA done(1).
PARAMETERS vbeln TYPE likp-vbeln.
DATA sal_vbeln TYPE vbeln..
DATA messtab LIKE TABLE OF bdcmsgcoll WITH HEADER LINE.
DATA billing_doc TYPE vbeln.
DATA messagetext(200).
MESSAGE s002(zsd).
WRITE: / vbeln.
DATA : v_print TYPE i.
CALL FUNCTION 'ENQUEUE_EVVBLKE'
EXPORTING
MODE_LIKP = 'E'
MANDT = SY-MANDT
vbeln = vbeln
X_VBELN = ' '
_SCOPE = '2'
_wait = 'X'
" _wait = space
_COLLECT = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3
MESSAGE s005(zsd).
*In case ZSOT automatic billing once we create delivery and post goods issue manual.
SELECT SINGLE vbelv
FROM vbfa
INTO sal_vbeln
WHERE vbeln = vbeln
AND vbtyp_v = 'C'.
SELECT SINGLE *
FROM vbak
WHERE vbeln = sal_vbeln.
import v_print to v_print FROM MEMORY id 'PRINTFLAG'.
IF vbak-auart EQ 'ZSOT'.
IF v_print eq '1'.
PERFORM create_document USING vbeln
CHANGING sy-subrc.
ENDIF.
ELSE.
*Other than ZSOT Post Goods issue from ZPGI2 and from there automatic billing.
ENDIF.
*& Form CREATE_DOCUMENT
text
-->P_VBELN text
FORM create_document USING p_vbeln
CHANGING sysubrc.
PERFORM bdc_dynpro USING 'SAPMV60A' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KOMFK-VBELN(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KOMFK-VBELN(01)'
p_vbeln."'1130010202'.
PERFORM bdc_dynpro USING 'SAPMV60A' '0104'.
PERFORM bdc_field USING 'BDC_CURSOR'
'VBRK-FKART'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
CALL FUNCTION 'DEQUEUE_EVVBLKE'
EXPORTING
MODE_LIKP = 'E'
MANDT = SY-MANDT
vbeln = vbeln
X_VBELN = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
CALL TRANSACTION 'VF01' USING bdcdata
MODE 'N'
UPDATE 'S'
MESSAGES INTO messtab.
READ TABLE messtab WITH KEY msgtyp = 'E'.
IF sy-subrc EQ 0.
sysubrc = 4.
ELSE.
sysubrc = 0.
ENDIF.
LOOP AT messtab.
sy-msgty = messtab-msgtyp.
sy-msgid = messtab-msgid.
sy-msgno = messtab-msgnr.
sy-msgv1 = messtab-msgv1.
sy-msgv2 = messtab-msgv2.
sy-msgv3 = messtab-msgv3.
sy-msgv4 = messtab-msgv4.
CALL FUNCTION '/SAPTRX/GET_MESSAGE_TEXT'
EXPORTING
msgid = sy-msgid
msgno = sy-msgno
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
IMPORTING
messagetext = messagetext
EXCEPTIONS
no_message_retrieved = 1
OTHERS = 2.
WRITE: / messagetext.
CLEAR messagetext.
ENDLOOP.
*... refresh tables
REFRESH: messtab, bdcdata.
ENDFORM. "CREATE_DOCUMENT
*& Form BDC_DYNPRO
text
-->PROGRAM text
-->DYNPRO text
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
*& Form change_status
text
--> p1 text
<-- p2 text
FORM change_status .
*Change status if delivery and the billing document has been created
SELECT *
FROM vbup
WHERE vbeln = vbeln
AND fksta NE 'C'.
vbup-fksta = 'C'.
vbup-gbsta = 'C'.
MODIFY vbup.
ENDSELECT.
UPDATE vbuk
SET fkstk = 'C'
gbstk = 'C'
WHERE vbeln = vbeln.
ENDFORM. " change_status
Program C (Print Bill)
REPORT z_sdps_invoice.
*& <Module>: SD Smart Forms.
*& Type : Executable
*& Request No.:
*& Author/Co. : Ahmed Al Eryani
*& Created On : 26.02.2007
*& Finished : 24.2007
*& Description:
*& MODIFICATION LOG
*& Modified by :
*& Request No. :
*& Dev. Class :
*& Date Modified:
*& Description :
TABLES: vbrk, kna1, vbrp, makt, konv, vbkd.
SELECTION-SCREEN BEGIN OF BLOCK a.
PARAMETER: p_vbeln LIKE vbrp-vbeln OBLIGATORY MATCHCODE OBJECT vmcf. "Billing document No
"SELECT-OPTIONS s_bukrs FOR bkpf-bukrs. "Company Code
SELECTION-SCREEN END OF BLOCK a.
*itab is object of our smart form structre
DATA: itab TYPE zsd_invoice OCCURS 0 WITH HEADER LINE.
DATA: wa_footer TYPE zsd_invv1.
DATA: t_items TYPE zsd_inv WITH HEADER LINE,
w_items TYPE LINE OF zsd_inv,
it_footer TYPE zsd_inv1,
w_footer TYPE LINE OF zsd_inv1.
DATA: amountspell LIKE spell.
DATA: g_fm_name TYPE rs38l_fnam.
DATA: mnumvflag(10) TYPE c.
DATA: coun TYPE i,
totalforitems TYPE kwert,
lasttotal(8) TYPE p DECIMALS 2,
lasttotalc(11) TYPE c,
firstpart(11) TYPE c,
secondpart(2) TYPE c.
DATA: currency TYPE waerk.
DATA: currtxet(50) TYPE c.
*Header internal table
DATA: BEGIN OF t_header OCCURS 0,
vbeln LIKE vbrk-vbeln,"Document no
name1 LIKE kna1-name1,"Customer Name
adrnr LIKE kna1-adrnr,"Customer Address
bstkd LIKE vbkd-bstkd,"
kunnr LIKE kna1-kunnr,"Customer Account no
waerk LIKE vbrk-waerk, "currency key
aubel LIKE vbrp-aubel,
kunrg LIKE vbrk-kunrg,
street LIKE adrc-street,
fkart LIKE vbrk-fkart,
lgort LIKE lips-lgort,"Stord bin
lgobe LIKE t001l-lgobe,
ktokd LIKE kna1-ktokd,
PSTYV LIKE vbrp-PSTYV,
orgbil LIKE vbfa-vbelv,
END OF t_header.
*detail internal table
DATA: BEGIN OF t_items1 OCCURS 0,
matnr LIKE vbrp-matnr,"Material Number
posnr LIKE vbrp-posnr,
vgpos LIKE vbrp-vgpos,
maktx LIKE makt-maktx,"Material Description
lgort LIKE vbrp-lgort,"Storage location
fkimg LIKE vbrp-fkimg,"
knumv LIKE vbrk-knumv,"
unitprice LIKE konv-kawrt,
total LIKE konv-kawrt,
waers LIKE konv-waers,
kkurs LIKE konv-kkurs,
vgbel LIKE vbrp-vgbel,
lgpbe LIKE lips-lgpbe,
vgtyp LIKE vbrp-vgtyp,
END OF t_items1.
DATA: v_belnr TYPE belnr_d.
*Unit price internal table
DATA: BEGIN OF t_untprice OCCURS 0,
kschl LIKE konv-kschl,"condition type
kawrt LIKE konv-kawrt,"unit price
END OF t_untprice.
*Condition(spcial deduction)
DATA: BEGIN OF t_spcialcnd OCCURS 0,
kschl LIKE konv-kschl,"condition type
kwert LIKE konv-kwert,"Deduction value
END OF t_spcialcnd.
DATA: t_tax LIKE TABLE OF t_spcialcnd WITH HEADER LINE,
v_tax LIKE konv-kwert.
DATA: BEGIN OF t_curtxt OCCURS 0,
ltext LIKE tcurt-ltext,
END OF t_curtxt.
DATA :return_code TYPE i," VALUE 999,
us_screen TYPE c. "VALUE 'X'.
declaration of data
INCLUDE rlb_invoice_data_declare.
definition of forms
INCLUDE rlb_invoice_form01.
INCLUDE rlb_print_forms.
START-OF-SELECTION.
"IF p_vbeln IS NOT INITIAL.
PERFORM entry USING return_code us_screen.
"ENDIF.
FORM ENTRY
FORM entry USING return_code us_screen.
DATA: lf_retcode TYPE sy-subrc.
CLEAR retcode.
xscreen = us_screen.
perform processing using us_screen
changing lf_retcode.
if lf_retcode ne 0.
return_code = 1.
else.
return_code = 0.
endif.
IF p_vbeln IS INITIAL.
p_vbeln = nast-objky.
ENDIF.
"get header data
SELECT SINGLE vbrk~vbeln vbrk~waerk vbrp~aubel vbrk~kunrg vbrk~fkart vbrp~lgort vbrp~PSTYV
INTO (t_header-vbeln, t_header-waerk, t_header-aubel, t_header-kunrg, t_header-fkart,
t_header-lgort, t_header-PSTYV)
FROM vbrk JOIN vbrp ON vbrp~vbeln = vbrk~vbeln
JOIN kna1 ON vbrk~kunrg = kna1~kunnr
WHERE vbrk~vbeln = p_vbeln.
IF t_header-PSTYV = 'ZREN'.
SELECT SINGLE VBELV
INTO t_header-orgbil
FROM vbfa
WHERE vbeln = p_vbeln
and VBTYP_V = 'M'.
ENDIF.
SELECT SINGLE t001l~lgobe
INTO t_header-lgobe
FROM t001l
WHERE t001l~lgort = t_header-lgort.
SELECT SINGLE kna1~name1 kna1~adrnr kna1~kunnr kna1~ktokd
INTO (t_header-name1, t_header-adrnr, t_header-kunnr, t_header-ktokd)
FROM kna1 "ON vbrk~kunrg = kna1~kunnr
WHERE kna1~kunnr = t_header-kunrg
AND spras = 'AR'.
IF t_header-name1 IS INITIAL.
SELECT SINGLE kna1~name1 kna1~adrnr kna1~kunnr kna1~ktokd
INTO (t_header-name1, t_header-adrnr, t_header-kunnr, t_header-ktokd)
FROM kna1 "ON vbrk~kunrg = kna1~kunnr
WHERE kna1~kunnr = t_header-kunrg
AND spras = 'EN'.
ENDIF.
IF t_header-ktokd = 'ZONE'.
SELECT SINGLE belnr
INTO v_belnr
FROM bkpf
WHERE xblnr = p_vbeln.
SELECT SINGLE name1
INTO t_header-name1
FROM bsec
WHERE belnr = v_belnr.
ENDIF.
SELECT SINGLE adrc~street
INTO t_header-street
FROM adrc
WHERE addrnumber = t_header-adrnr
AND langu = 'AR'.
IF t_header-street IS INITIAL.
SELECT SINGLE adrc~street
INTO t_header-street
FROM adrc
WHERE addrnumber = t_header-adrnr
AND langu = 'EN'.
ENDIF.
"get details data
SELECT vbrp~matnr vbrp~posnr vbrp~vgpos vbrp~fkimg
vbrk~knumv vbrp~matnr vbrp~vgbel vbrp~vgtyp"makt~maktx
INTO CORRESPONDING FIELDS OF TABLE t_items1
FROM vbrp "JOIN makt ON vbrp~matnr = makt~matnr
JOIN vbrk ON vbrp~vbeln = vbrk~vbeln
"join konv on vbrk~knumv = konv~knumv
WHERE vbrp~vbeln = p_vbeln
AND vbrp~fkimg NE '0.000'.
"AND makt~spras = 'E'.
break arasmy.
LOOP AT t_items1.
SELECT SINGLE lips~lgpbe
INTO t_items1-lgpbe
FROM lips
WHERE vbeln = t_items1-vgbel
AND posnr = t_items1-vgpos.
SELECT SINGLE makt~maktx
INTO t_items1-maktx
FROM makt
WHERE matnr = t_items1-matnr
AND makt~spras = 'EN'.
SELECT SINGLE konv~kbetr konv~kwert konv~waers konv~kkurs
INTO (t_items1-unitprice, t_items1-total, t_items1-waers,
t_items1-kkurs)
FROM konv
WHERE konv~kschl = 'NETW'"'ZSPC' "'ZSP1'
AND konv~knumv = t_items1-knumv
AND kposn = t_items1-posnr.
t_items1-unitprice = ( t_items1-total / t_items1-fkimg ) * t_items1-kkurs.
MODIFY t_items1.
mnumvflag = t_items1-knumv."Number of the document condition
ENDLOOP.
*get the deduction value for the document condiotion no
SELECT konvkschl konvkwert
INTO CORRESPONDING FIELDS OF TABLE t_spcialcnd
FROM konv
WHERE konv~kschl IN ('ZSSD', 'ZSCD', 'ZSDD', 'ZSPD', 'ZSWD', 'ZMW1', 'ZSGS', 'ZMW2')
AND konv~knumv = mnumvflag.
Get tax 10%
SELECT konvkschl konvkwert
APPENDING CORRESPONDING FIELDS OF TABLE t_tax
FROM konv
WHERE konv~kschl = 'MWST'
AND konv~knumv = mnumvflag.
itab-invn = t_header-vbeln.
itab-orgbil = t_header-orgbil.
itab-cusna = t_header-name1.
itab-addr = t_header-street.
itab-custn = t_header-kunrg.
itab-sord = t_header-aubel.
itab-fkart = t_header-fkart.
itab-lgort = t_header-lgort.
itab-lgobe = t_header-lgobe.
itab-PSTYV = t_header-PSTYV.
currency = t_header-waerk.
LOOP AT t_items1.
w_items-matn = t_items1-matnr.
w_items-matdes = t_items1-maktx.
w_items-stloc = t_items1-lgpbe."lgort.
w_items-qunt = t_items1-fkimg.
w_items-total = t_items1-total.
totalforitems = totalforitems + w_items-total.
COLLECT w_items INTO t_items.
endloop.
LOOP AT t_items1.
LOOP AT t_items WHERE matn = t_items1-matnr.
t_items-prc = t_items1-unitprice.
MODIFY t_items.
ENDLOOP.
ENDLOOP.
LOOP AT t_items.
coun = coun + 1.
t_items-itmn = coun.
MODIFY t_items.
ENDLOOP.
w_footer-totalforitems = totalforitems.
LOOP AT t_spcialcnd.
CASE t_spcialcnd-kschl.
WHEN 'ZSSD'.
w_footer-spdisc = w_footer-spdisc + t_spcialcnd-kwert.
WHEN 'ZSCD'.
w_footer-comdisc = w_footer-comdisc + t_spcialcnd-kwert.
WHEN 'ZSDD'.
w_footer-DIFMAT = w_footer-DIFMAT + t_spcialcnd-kwert.
when 'ZSPD'.
w_footer-trgtdisc = w_footer-trgtdisc + t_spcialcnd-kwert.
WHEN 'ZMW2'.
w_footer-comindisc = w_footer-comindisc + t_spcialcnd-kwert.
WHEN 'ZSWD'.
w_footer-cshdisc = w_footer-cshdisc + t_spcialcnd-kwert.
WHEN 'ZSGS'.
w_footer-stampsdisc = w_footer-stampsdisc + t_spcialcnd-kwert.
ENDCASE.
w_footer-ttldisc = w_footer-spdisc + w_footer-comdisc + w_footer-trgtdisc
+ w_footer-cshdisc + w_footer-DIFMAT + w_footer-stampsdisc.
ENDLOOP.
w_footer-aftrdiscnts = w_footer-totalforitems + w_footer-ttldisc.
LOOP AT t_tax WHERE kwert NE '0.00'.
w_footer-saltax = w_footer-saltax + t_tax-kwert.
ENDLOOP.
w_footer-totalaftrtax = w_footer-aftrdiscnts + w_footer-saltax.
w_footer-total = w_footer-totalaftrtax + w_footer-comindisc.
lasttotal = w_footer-total.
APPEND w_footer TO it_footer.
SELECT tcurt~ltext
INTO CORRESPONDING FIELDS OF TABLE t_curtxt
FROM tcurt
WHERE tcurt~spras = 'AR'
AND tcurt~waers = currency.
LOOP AT t_curtxt.
currtxet = t_curtxt-ltext.
ENDLOOP.
itab[] = t_header[].
lasttotalc = lasttotal.
SPLIT lasttotalc AT '.' INTO firstpart secondpart.
lasttotal = firstpart / 100.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = lasttotal
currency = ''"CURRENCY
filler = space
language = 'A'
IMPORTING
in_words = amountspell
EXCEPTIONS
not_found = 1
too_large = 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.
--split amount--
BREAK radha.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_INVOICE_PARTS2'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = g_fm_name
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.
DATA : control_parameters TYPE ssfctrlop,
print_options TYPE ssfcompop.
DATA : document_output_info TYPE ssfcrespd,
job_output_info TYPE ssfcrescl,
job_output_options TYPE ssfcresop.
DATA : count TYPE i.
control_parameters-langu = 'AR'.
control_parameters-no_dialog = 'X'."Don't show Dialog
print_options-tdarmod = '1'.
print_options-tdcopies = '001'.
print_options-tddest = 'LP02'.
print_options-tdprinter = 'ZARSWIN'.
print_options-tdimmed = 'X'.
print_options-tddelete = 'X'.
print_options-tdlifetime = '8'.
print_options-tddest = 'LP03'."nast-ldest.
"print_options-tddest = nast-ldest.
"print_options-tdcopies = pv_copies.
print_options-tddelete = 'X'.
print_options-tdfinal = 'X'.
print_options-tdnewid = 'X'.
WHILE count ne 1.
IF job_output_info-outputdone ne 'X'.
CALL FUNCTION g_fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = control_parameters
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = print_options
user_settings = space
header = itab
amountspell = amountspell
currtxt = currtxet
secondpart = secondpart
wa_footer = w_footer
IMPORTING
DOCUMENT_OUTPUT_INFO = document_output_info
JOB_OUTPUT_INFO = job_output_info
JOB_OUTPUT_OPTIONS = job_output_options
TABLES
it_items = t_items
it_footer = it_footer
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. "ENTRYHi,
lw_control_param-device = 'PRINTER'.
lw_control_param-getotf = c_x.
lw_control_param-no_dialog = c_x.
lw_composer_param-tdnoprev = c_x.
<b>*lw_composer_param-tddest = 'LONSC0P310'.</b>
<b>lw_composer_param-tddest = 'XXXX'.</b> <b>"Four digits</b>
<i>lw_composer_param-tdnewid = c_x.
lw_composer_param-tdfinal = c_x.</i> --> Not required
In place of 'XXXX', replace it by a 4 digit value. It would be available in transaction SPAD->Output Devices->Double click your output device. On the right hand side there would be a field Short Name. Replace 'XXXX' with that value.
Best regards,
Prashant
Maybe you are looking for
-
SQL Advisor with SQL_ID
Hi All, I want to use SQL Advisor for SQL performance tuning. Here I don't want to create SQL and pass it to DBMS_SQLTUNE.create_tuning_task. I want to pass SQL_ID in this. So whenever I ran my SQL, I want to capture its SQL_ID. How can we get this.
-
Calling PL/SQL Procedures from Java
Hello, I want to know, if it is possible to call PL/SQL Procedures from SQLJ(which uses htp.print from the Package web toolkit ). Though, it is possible to call normal procedures but if I want to call PL/SQL procedures with htp.print then I get I err
-
The hard drive was replaced on the unit and a fresh windows 8.1 was installed. How can I re-install Magic Canvas? I don't have the original cd/dvd with the recovery options. This question was solved. View Solution.
-
What can I do if my Iphone doesn't read the SIM card?
I bought an Iphone 4S in France because I had a gift card but now I live in Italy and It doesn't read my Sim card. Someone told me that I have to unlock It, but I don't know if it is true. What can I do?
-
Programming error in HH2 software: Dynamic DNS
Advanced Settings >>Broadband >> Dynamic DNS When you try to add multiple hosts the behaviour is very erratic. I am testing some websites I am building and need to have 3 host names in the list of multiple hosts. The first two went in OK ... after so