Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

smartforms

Former Member
0 Kudos
253

hi,

I am new to smartforms. I need help from u guys. my problem i have to print data in the header area of smartforms. there are 4 fields. for suppose if the host id >1 i have to print it on the item data otherwise print in header data. if there is no data i have to supress it. depending on this condition i have to retrieve the data on the smartforms. in the same manner if there are multiple kunnrs for the same order i have to print it in item details otherwise print it in header. plz send me the solution to this problem ASAP.

THank u in advance

1 ACCEPTED SOLUTION

jayanthi_jayaraman
Active Contributor
0 Kudos
135

Hi,

Create a program line before header.In that write the ABAP code to select records having multiple kunnr for same order.Move those records to separate table.Delete the same from the main internal table.

Use the second internal table to dispalying items and first internal table to display header [one kunnr for one order].

15 REPLIES 15

Vinod_Chandran
Active Contributor
0 Kudos
135

Hi Hasmath,

Yes. This can be done. You can use either the alternate condition or the condition tab.

For example you can give the condition 'host id > 1' in the General attribute tab of alternate condition node. Right click on your window to create this node.

Whenever the value of host id is greater than 1, whatever you have given under 'TRUE' condition will be executed, otherwise the 'FALSE' condition.

Similar way you can control the execution using the condition tab. You can find a tab called 'Conditions' in all the nodes in smartforms.

For example if there is no data then you want to supress the display of some node. For this get the number of items in the internal table using DESCRIBE command and in the condition give;

w_lines > 0.

Same way you can do for the multiple kunnr.

Thanks

Vinod

0 Kudos
135

Thank u frnd,

i will try the same as u describe. along with that i need to print the smrtform in pdf format. if u have any code plz forward it.

Thank u once again,

Hasmath

0 Kudos
135

Hi,

Check this link.Here I am using convert_OTF fucntion module.This link describes how to convert smartform into PDF and then mailing the output of the smartform.

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/smartforms/smart form in abap.pdf

Hope this helps.

jayanthi_jayaraman
Active Contributor
0 Kudos
136

Hi,

Create a program line before header.In that write the ABAP code to select records having multiple kunnr for same order.Move those records to separate table.Delete the same from the main internal table.

Use the second internal table to dispalying items and first internal table to display header [one kunnr for one order].

0 Kudos
135

Hai jayanthi

I am going thru the code which u had given. it is very helpful. in that ur sending it as a email. i want to store the pdf in system. can u tell me which func. calls the save dialog box

Hasmath

0 Kudos
135

Hi,

After that CONVERT_OTF function module,just use this.It will save the PDF in your system.

data w_filesize type i.

call function 'WS_DOWNLOAD'

Exporting

bin_filesize = v_len_in

filename = 'd:\test.pdf'

filetype = 'BIN'

importing

filelength = w_filesize

tables

data_tab = i_tline.

Then check whether it is downloaded in your system properly.

0 Kudos
135

Hi hasmath,

I hope below fm will help you

<b>CONVERT_ABAPSPOOLJOB_2_PDF and CONVERT_OTFSPOOLJOB_2_PDF</b>

regards,

venu.

0 Kudos
135

hi,

I had used the code provided by u. the pdf file is saved on the disk but the data is not displayed. A message box has been displayed as "not a supported file format or because the file has been damaged. it was sent as an email attachment was wasn't correctly decoded ". I haven't used this part of code

  • Sending mail.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = w_doc_chng

put_in_outbox = 'X'

TABLES

packing_list = i_objpack

object_header = w_objhead

contents_hex = i_objbin

contents_txt = i_objtxt

receivers = i_reclist

EXCEPTIONS

as this is for sending the email. where may be the code gone wrong. ur suggestions are precious to me.

Cheers,

Hasmath

0 Kudos
135

can u give the description or code for this

0 Kudos
135

Hi,

As you told,'SO_NEW_DOCUMENT_ATT_SEND_API1' is for mailing.Did you checked your smartform output from smartform itself?If it has data,then obviously data should come here also.

In my program,I am not passing anything from report to smartform.I am handling the code inside the smartform program lines.

Hope it helps.

0 Kudos
135

hi

data is represented in the smartform. there is no problem in that. but the data is not appearing in .pdf file. can u tell me whr the error may have occured.

0 Kudos
135

Hi,

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZZZ_TEST2'

...

Here the formname is your smartform name in Upper case.Did you used any form interface in smartform?

0 Kudos
135

i had given as it is. there is no problem in that

0 Kudos
135

Hello jayanthi,

still there is problem in that. the data is been printed in the smartform preview. but it is not printed in the pdf file. when i am trying to open the file a mesage comes like file it is either not a supported file format or the file may be damaged.

0 Kudos
135

Hi,

Could you post the entire code in your report here?And also let me know,what are the parameters you declared in form interface of smartforms?According to my program,I didn't declare anything in form interface.