How to get internal table from SAP Data Provider C#
Hello.
ABAP:
DATA: lt_t001 TYPE TABLE OF t001.
DATA: url(1000) TYPE c.
SELECT * INTO TABLE lt_t001 FROM t001.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'APPLICATION'
subtype = 'X-R3TABLE'
TABLES
data = lt_t001
CHANGING
url = url
EXCEPTIONS
OTHERS = 4.
C#:
using SAPDataProvider;
using SAPTableFactoryCtrl;
public void SetDataFromUrl(string url)
SAPDataProviderClass p = new SAPDataProviderClass();
p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
SAPTableFactoryClass tf = new SAPTableFactoryClass();
Table tb = (Table)tf.NewTable();
tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
How to get internal table from SAP Data Provider ?
Hi Sergey,
I'm trying to do the same, have you found a solution to solved it?
thanks for your help.
Regards.
Jonathan
Similar Messages
-
How to Send Internal table to SAP Spool using Function Modules or Methods?
Hi Experts,
How to Send Internal table to SAP Spool using Function Modules or Methods?
Thanks ,
KiranThis is my code.
I still get the no ABAP list data for the spool, even tho I can see it sp01?
REPORT Z_MAIL_PAYSLIP.
* Declaration Part *
tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
infotypes: 0000, 0001, 0105, 0655.
data: begin of ITAB occurs 0,
MTEXT(25) type C,
PERNR like PA0001-PERNR,
ABKRS like PA0001-ABKRS,
ENAME like PA0001-ENAME,
USRID_LONG like PA0105-USRID_LONG,
end of ITAB.
data: W_BEGDA like HRPY_RGDIR-FPBEG,
W_ENDDA like HRPY_RGDIR-FPEND.
data: RETURN like BAPIRETURN1 occurs 0 with header line.
data: P_INFO like PC407,
P_FORM like PC408 occurs 0 with header line.
data: P_IDX type I,
MY_MONTH type T549Q-PABRP,
STR_MY_MONTH(2) type C,
MY_YEAR type T549Q-PABRJ,
STR_MY_YEAR(4) type C,
CRLF(2) type x value '0D0A'.
data: W_CMONTH(10) type C.
data: TAB_LINES type I,
ATT_TYPE like SOODK-OBJTP.
data: begin of P_INDEX occurs 0,
INDEX type I,
end of P_INDEX.
constants: begin of F__LTYPE, "type of line
CMD like PC408-LTYPE value '/:', "command
TXT like PC408-LTYPE value 's', "textline
end of F__LTYPE.
constants: begin of F__CMD, "commands
NEWPAGE like PC408-LINDA value '',
end of F__CMD.
data: P_LIST like ABAPLIST occurs 1 with header line.
*data: OBJBIN like SOLISTI1 occurs 10 with header line,
data: OBJBIN like LVC_S_1022 occurs 10 with header line,
DOCDATA like SODOCCHGI1,
OBJTXT like SOLISTI1 occurs 10 with header line,
OBJPACK like SOPCKLSTI1 occurs 1 with header line,
RECLIST like SOMLRECI1 occurs 1 with header line,
OBJHEAD like SOLISTI1 occurs 1 with header line,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_buffer type string,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname.
data: file_length type int4,
spool_id type rspoid,
line_cnt type i.
*-------------------------------------------------------------------* * INITIALIZATION *
OBJBIN = ' | '.
append OBJBIN.
OBJPACK-HEAD_START = 1.
data: S_ABKRS like PV000-ABKRS.
data: S_PABRP like T549Q-PABRP.
data: S_PABRJ like T549Q-PABRJ.
* SELECTION SCREEN *
selection-screen begin of block BL1.
parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
selection-screen end of block BL1.
START-OF-SELECTION.
s_ABKRS = PNPXABKR.
S_PABRP = PNPPABRP.
s_pabrj = PNPPABRJ.
w_begda = PN-BEGDA.
w_endda = PN-ENDDA.
get pernr.
* "Check active employees
rp-provide-from-last p0000 space pn-begda pn-endda.
CHECK P0000-STAT2 IN PNPSTAT2.
* "Check Payslip Mail flag
rp-provide-from-last p0655 space pn-begda pn-endda.
CHECK P0655-ESSONLY = 'X'.
rp-provide-from-last p0001 space pn-begda pn-endda.
* "Find email address
RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
if p0105-usrid_LONG ne ''.
ITAB-PERNR = P0001-PERNR.
ITAB-ABKRS = P0001-ABKRS.
ITAB-ENAME = P0001-ENAME.
ITAB-USRID_LONG = P0105-USRID_LONG.
append itab.
clear itab.
endif.
"SY-UCOMM ='ONLI'
END-OF-SELECTION.
*------------------------------------------------------------------* start-of-selection.
write : / 'Payroll Area : ', S_ABKRS.
write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
write : / 'System Time : ', SY-UZEIT.
write : / 'User Name : ', SY-UNAME.
write : / SY-ULINE.
sort ITAB by PERNR.
loop at ITAB.
clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
* Retrieve Payroll results sequence number for this run
select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
and FPBEG ge W_BEGDA
and FPEND le W_ENDDA
and SRTZA eq 'A'.
* Produce payslip for those payroll results
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
EXPORTING
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
IMPORTING
RETURN = RETURN
P_INFO = P_INFO
TABLES
P_FORM = P_FORM.
check RETURN is initial.
* remove linetype from generated payslip
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
endloop.
file_length = line_cnt * 1022.
* create spool file of paylsip
CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
EXPORTING
i_file_length = file_length
IMPORTING
e_spoolid = spool_id
TABLES
it_textdata = objbin.
IF sy-subrc EQ 0.
WRITE spool_id.
ENDIF.
DESCRIBE table objbin.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spool_id
NO_DIALOG = ' '
DST_DEVICE = 'MAIL'
* PDF_DESTINATION =
* IMPORTING
* PDF_BYTECOUNT = l_no_of_bytes
* PDF_SPOOLID = l_pdf_spoolid
* LIST_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
PDF = pdf
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 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.
*Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = pdf.
* Transfer the 132-long strings to 255-long strings
* LOOP AT pdf.
* TRANSLATE pdf USING ' ~'.
* CONCATENATE gd_buffer pdf INTO gd_buffer.
* ENDLOOP.
* TRANSLATE gd_buffer USING '~ '.
* DO.
* it_mess_att = gd_buffer.
* APPEND it_mess_att.
* SHIFT gd_buffer LEFT BY 255 PLACES.
* IF gd_buffer IS INITIAL.
* EXIT.
* ENDIF.
* ENDDO.
OBJHEAD = 'Objhead'.
append OBJHEAD.
* preparing email subject
concatenate W_ENDDA(6)
' Payslip-'
ITAB-ENAME+0(28)
ITAB-PERNR+4(4) ')'
into DOCDATA-OBJ_DESCR.
DOCDATA-OBJ_NAME = 'Pay Slip'.
DOCDATA-OBJ_LANGU = SY-LANGU.
OBJTXT = 'Pay Slip.'.
append OBJTXT.
*prepare email lines
OBJTXT = DOCDATA-OBJ_DESCR.
append OBJTXT.
OBJTXT = 'Please find enclosed your current payslip.'.
append OBJTXT.
* Write Attachment(Main)
* 3 has been fixed because OBJTXT has fix three lines
read table OBJTXT index 3.
* DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
clear OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 3.
OBJPACK-DOC_TYPE = 'RAW'.
append OBJPACK.
* Create Message Attachment
ATT_TYPE = 'PDF'.
describe table OBJBIN lines TAB_LINES.
read table OBJBIN index TAB_LINES.
* OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = ATT_TYPE.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Payslip'.
append OBJPACK.
* Create receiver list refresh RECLIST.
clear RECLIST.
RECLIST-RECEIVER = itab-USRID_long.
translate RECLIST-RECEIVER to lower case.
RECLIST-REC_TYPE = 'U'.
append RECLIST.
* Send the document
*SO_NEW_DOCUMENT_ATT_SEND_API1
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = pdf
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = 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 NE 0.
ITAB-MTEXT = 'Message Not Sent to : '.
else.
ITAB-MTEXT = 'Message Sent to : '.
endif.
* else.
* ITAB-MTEXT = 'Message Not Sent to : '.
* endif.
else.
"SY-SUBRC Not = 0
ITAB-MTEXT = 'Payroll data not found : '.
endif.
"end of SY-SUBRC = 0.
modify ITAB.
endloop. "end loop at ITAB
sort ITAB by MTEXT PERNR.
loop at ITAB.
at new MTEXT.
uline.
write : / ITAB-MTEXT color 4 intensified on.
write : / 'Emp. Code' color 2 intensified on,
12 'Emp. Name' color 2 intensified on,
54 'Email ID' color 2 intensified on.
endat.
write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
endloop. -
How to get pivot table by using dates
Hi,
How to get pivot table by using dates in column.
Below is the sample table and its value is given.
create table sample1
Order_DATE DATE,
order_CODE NUMBER,
Order_COUNT NUMBER
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,232);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,935);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,43);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,5713);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,11346);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,368);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,1380);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,133);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,7109);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,14336);
select * from sample1;So how to get the data like below.
order_date
order_code 30-sep-12 29-sep-12
1 232 368
2 935 1380
3 43 133
4 5713 7109
5 11345 14336Using the extra data I inserted in my previous reply:select ORDER_CODE,
SUM(DECODE(extract (month from ORDER_DATE),1,ORDER_COUNT,0)) JAN,
SUM(DECODE(extract (month from ORDER_DATE),2,ORDER_COUNT,0)) FEB,
SUM(DECODE(extract (month from ORDER_DATE),3,ORDER_COUNT,0)) MAR,
SUM(DECODE(extract (month from ORDER_DATE),4,ORDER_COUNT,0)) APR,
SUM(DECODE(extract (month from ORDER_DATE),5,ORDER_COUNT,0)) MAY,
SUM(DECODE(extract (month from ORDER_DATE),6,ORDER_COUNT,0)) JUN,
SUM(DECODE(extract (month from ORDER_DATE),7,ORDER_COUNT,0)) JUL,
SUM(DECODE(extract (month from ORDER_DATE),8,ORDER_COUNT,0)) AUG,
SUM(DECODE(extract (month from ORDER_DATE),9,ORDER_COUNT,0)) SEP,
SUM(DECODE(extract (month from ORDER_DATE),10,ORDER_COUNT,0)) OCT,
SUM(DECODE(extract (month from ORDER_DATE),11,ORDER_COUNT,0)) NOV,
SUM(DECODE(extract (month from ORDER_DATE),12,ORDER_COUNT,0)) DEC
from SAMPLE1
where trunc(order_date, 'YY') = trunc(sysdate, 'YY')
group by order_code
order by order_code;
ORDER_CODE JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
1 0 0 0 0 0 0 0 0 600 600 0 0
2 0 0 0 0 0 0 0 0 2315 2315 0 0
3 0 0 0 0 0 0 0 0 176 176 0 0
4 0 0 0 0 0 0 0 0 12822 12822 0 0
5 0 0 0 0 0 0 0 0 25682 25682 0 0Now a bit of explanation.
1) Whenever you pivot rows to columns, no matter what version of Oracle and no matter what method you use, you have to decide in advance how many columns you are going to have and what the names of the columns are. This is a requirement of the SQL standard.
2) I use the WHERE clause to get just the data for this year
3) With EXTRACT, I get just the month without the year.
4) Using DECODE, I put every month's data into the correct column
5) Once I do all that, I can just GROUP BY order_code while SUMming all the data for each month. -
How to get maximal value from the data/class for show in Map legend
I make WAD report that using Map Web Item.
I devide to four (4) classes for legend (Generate_Breaks).
I want to change default value for the class by javascript and for this,
I need to get maximal value from the class.
How to get maximal value from the data/class.
please give me solution for my problem.
Many Thx
Eddy Utomouse this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01 -
How to fill internal table with no data in debugging mode
Hi all,
I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
Thanks,
BalajiHi,
In the debugging do the following..
Click the Table button..
Double click on the internal table name..
Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
Use the APPEND button to insert records to the internal table..
Thanks,
Naren -
HR abap : how to declare internal table to fetch data from 0585 infotype
Hi all ,
I am able to fetch the data from pa0585 infotype for set of employee no , but the problem is as the fields in pa0585 (like Contr to ULIP , NSC , Medical Treatment,Contribution to Certain Pension Funds so on ..) will be changed dynamically and will be displayed based on the amount value in descending order iam not able to store the values of the fileds into internal table . I dont understand how to declare the internal table ..Please help in if u have solved this kind of problem.
I shld get the output in this way ...
Emp No Name Medical treatment Contr to ULIP ....... so on
101 abc 10000 150000 .......so on
102 xyz 12000 150000 .......so on
My header shld be fixed and I shld display values in this way .... I can use write statement to display directly .
Thanks ....Hi
Decalre INFOTYPE
Goto SE37 - Find FM -
READINFOTYPE* -
How to Pass internal table from a program to Samrt form
Hi Pals
I want to pass an internal table which I have declared in the program to Smartform..can you please help
me asap.
Regards
PraveenHai.
check link.
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf
check this.
How to create a New smartfrom, it is having step by step procedure
http://sap.niraj.tripod.com/id67.html
step by step good ex link is....
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
Here is the procedure
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
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.
Smartform
you can check this link here you can see the steps and you can do it the same by looking at it..
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
SMARTFORMS STEPS.
1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
2. Create Table type(t_struct) of stracture in se11.
3. In your program declare Internal table(Itab) type table of structure(struct).
4. Define work area(wa) like line of internal table.
5. Open Tcode Smartforms
6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
8. In form pages and window, create Page node by default Page1 is available.
9. In page node you can create numbers of secondary window. But in form there is only one Main window.
10. By right click on page you can create windows or Go to Edit, Node, Create.
11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
13. In table there are three areas Header, Main Area, Footer.
14. Right click on the Main area create table line by default line type1 is there select it.
15. Divide line into cells according to your need then for each cell create Text node.
16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
17. Save form and activate it.
18. Then go to Environment, function module name, there you get the name of function module copy it.
19. In your program call the function module that you have copied from your form.
20. In your program in exporting parameter of function pass the internal table(itab).
SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
configure forms with data from an SAP System for the relevant business processes.
To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
SAP Smart Forms also support postage optimizing.
Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
What Transaction to start SAP Smart Forms?
Execute transaction SMARTFORMS to start SAP Smart Forms.
Key Benefits of SAP Smart Forms:
SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
These actions do not include writing of coding lines or using a Script language.
Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
For Web publishing, the system provides a generated XML output of the processed form.
Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
SmartForms System Fields
Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
System fields of Smart Forms
&SFSY-DATE&
Displays the date. You determine the display format in the user master record.
&SFSY-TIME&
Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE&
Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
&SFSY-FORMPAGES&
Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
&SFSY-JOBPAGES&
Contains the total page number of all forms in the currently processed print request.
&SFSY-WINDOWNAME&
Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME&
Contains the name of the current page (string in the Page field)
&SFSY-PAGEBREAK&
Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
&SFSY-MAINEND&
Is set as soon as processing of the main window on the current page ends
&SFSY-EXCEPTION&
Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
Example Forms Available in Standard SAP R/3
SF_EXAMPLE_01
Simple example; invoice with table output of flight booking for one customer
SF_EXAMPLE_02
Similar to SF_EXAMPLE_01 but with subtotals
SF_EXAMPLE_03
Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
check this:
http://help.sap.com/saphelp_nw04s/helpdata/en/a5/de6838abce021ae10000009b38f842/content.htm
http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
http://www.sapbrain.com/TUTORIALS/TECHNICAL/SMARTFORMS_tutorial.html
check this linkls------>
https://www.sdn.sap.com/irj/sdn/collaboration
http://help.sap.com/saphelp_erp2004/helpdata/en/a9/de6838abce021ae10000009b38f842/frameset.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
Insert Images in smartforms
regards.
sowjanya.b. -
How to get pdf file from sap presentation server using java connector
Hi Friends,
with the below code i am able to get po details in pdf in presentation server.
DATA : w_url TYPE string
VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
CALL FUNCTION 'ECP_PDF_DISPLAY'
EXPORTING
purchase_order = i_ponum
IMPORTING
PDF_BYTECOUNT =
pdf = file " data in Xsting format
*Converting Xstring to binary_tab
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = file
APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH =
TABLES
binary_tab = it_bin " data in binary format
**Downloading into PDF file
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = w_url
filetype = 'BIN'
TABLES
data_tab = it_bin
when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
init:
deps-jar:
compile-single:
run-single:
com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
at PdfGen.<init>(PdfGen.java:35)
at PdfGen.main(PdfGen.java:78)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
i debugged too, problem with <b>gui_download......</b>
I am very glad to all with your suggestions!!
Regards,
Madhu..!!Hi
You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
Max
Edited by: max bianchi on Oct 13, 2011 10:27 AM -
How to pass internal table from FM to mai report
Hi,
I have created a new FM and under this all mine data is coming in one internal table IT_OUTPUT. now how to take this internl table to main report along with whole data.hi
As i understand, your are using this function module in your report, giving some parameters then u r getting complete data into one internal table if i am not wrong.
When u execute ur report this function module will give u the data through internal table. Just use that internal table to display the data using write statement if it is classical report. If it is ALV report use REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY to display the internal table data in screen
Thanks
Siva Kumar -
How to get PO details from SAP to VB using BAPI control
hi friends...
My requirement is
In VB(Visual basic) i will enter PO number, for that PO number i want to fetch the data from SAP to VB.
How to get this using BAPI Control in VB.
From SAP point of view, i checked SWo1, there standard Object (PurchaseOrder)-Method GetDetail is there.
but my doubt is how to pass the PO number to which parameter...
i dono how to use that standard Object (PurchaseOrder) in VB...
can you guide me plz..
regards
devaHi,
You need to get .NET connector and use this in your VB.
h6.
The SAP .NET Connector is a development environment that enables communication between the Microsoft. NET platform and SAP systems. This connector supports RFCs and Web services, and allows you to write different applications such as Web form, Windows form, or console applications in the Microsoft Visual Studio.Net. With the SAP .NET Connector, you can use all common programming languages, such as Visual Basic. NET, C#, or Managed C++.
In short it will make your VB talk to SAP.
http://www.service.sap.com/connectors
Regards,
Firoz. -
How to display internal table or DDIC data into Form
Hi
can anybody help me that how can i show the field data from internal table or DDIC into SAPscript form.
Pls let me know the example of both se38 code and text element screen.Why cant u refer a standard sapscript program.
refer form RVORDER01
in SE38 refer program RVADOR01
Thi sis simple example.
DATA: IT_INVOICEDETAIL LIKE TABLE OF ZINVOICEDETAIL WITH HEADER LINE.
DATA: TOTAL LIKE ZINVOICEDETAIL-AMOUNT,
CARRY LIKE ZINVOICEDETAIL-AMOUNT.
SELECT * FROM ZINVOICEDETAIL INTO TABLE IT_INVOICEDETAIL.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZDEMO1'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEAD'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'.
LOOP AT IT_INVOICEDETAIL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'BOX'
WINDOW = 'MAIN'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM'
WINDOW = 'MAIN'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'SUMMARY'
FUNCTION = 'SET'
TYPE = 'BOTTOM'
WINDOW = 'MAIN'.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'.
In SE71 form u have to create the text element.
BOX, ITEM,SUMMARY.
/E ITEM.
P1 &IT_INVOICEDETAIL-TOTAL& -
How to get the values from struct data type using java code..?
Hi ,
I am newer to java.
we are using oracle database.
How to get the data from struct data type using java code.
Thanks in Advance.
Regards,
kumarHi Rajeev,
To retrieve a FilterContainer you will need to traverse the report structure:
ReportStructure boReportStructure = boDocumentInstance.getStructure();
ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
FilterContainer boFilterContainer = null;
if (boReportContainer.hasFilter()) {
boFilterContainer = boReportContainer.getFilter();
} else {
boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
Hope this helps.
Regards,
Dan -
How to get Plant address from SAP R/3 to SRM
Hi Gurus,
We need to retrieve the plant address from SAP R/3 to SRM and display it in the output list of the report (SRM).
Suggest any standard FM or should we need to create a Custom Remote enabled FM and put the select query to get the address.
Regards
PaulHi Paul,
Try using the RFC_READ_TABLE function module...
Pass the table name as t001w which contains the plant details.
Hope this helps.
Thanks,
Pradeep -
How to get internal table with maximum value of a field in other internal
Let say I have an table itab consisting of:
itab-matnr = marm-matnr.
itab-umren = marm-umren.
itab-ean11 = marm-ean11.
there are many "ean11" for one "matnr"
How could I create itab2 with only "biggest" "ean11". could you give me examlpleHi,
data: mat_no type MATNR.
Loop at ITAB1.
IF mat_no = itab1-matnr.
here check the ean11 with previos ean11(Store it like matnr), and move the biggest one andf modify that row or move that in ITAB2 with a Modify statment, so that there will no second row with same material No
ENDIF.
MAT_NO = ITAB1-Matnr (Moving Itab1 material no to a Local field)
ENDLOOP.
Endloop. -
How to get two rows from this data?
SQL Gurus,
I need to summarize the following data into two rows (two rows based on the example data below but it can be any number of rows if there are more breaks in continuos numbers)
DETAIL_ID FM_SERIAL_NUMBER TO_SERIAL_NUMBER
63009 11 11
63009 12 12
63009 13 13
63009 14 14
63009 15 15
63009 16 16
63009 17 17
63009 18 18
63009 19 19
63009 20 20
63009 228 228
I need to get two rows, one showing 11-20 (that's because there's a conituity between 11 to 20)
and the other row showing 228 - 228.
Any help is appreciated
Regards,
Srinithe example i gave had some issues.
Here is an updated code.
Provided your detail_id,f_serial_no,t_serial_no are numbers.
Thanks to the example provided by Karthick_Arp
link:genterating one order
WITH t AS
(SELECT 63009 a,
level b ,
level c
FROM dual CONNECT BY level < 10
UNION ALL
SELECT 63009 , 228,228 FROM dual
UNION ALL
SELECT 63009 , 229,229 FROM dual
UNION ALL
SELECT 63009 , 238,238 FROM dual
UNION ALL
SELECT 63009,239,239 FROM dual
UNION ALL
SELECT 630010,223,223 FROM dual
UNION ALL
SELECT 630010,224,224 FROM dual
union all
SELECT 63009,232,232 FROM dual
, t1 as (
select a, b, c, decode(b-nvl(lag(b) over (partition by a order by b),1),1,0,b) d from t)
,t2 as (
select a, b, c,d
from (select row_number() over(order by b) rno, a,b,c,d
from t1) t
model
return updated rows
dimension by (rno)
measures (a, b, c,d)
rules update
d[any] = case when d[cv()] = 0 then nvl(d[cv()-1],0) else d[cv()] end
select a,min(b),max(b) from t2
group by a,doutput
63009 1 9
630010 223 224
63009 232 232
63009 228 229
63009 238 239
Alvinder
Edited by: alvinder on Feb 20, 2009 9:28 AM
Maybe you are looking for
-
ITunes crashes syncing due to album artwork!
Hi everybody, I have an 120GB iPod and iTunes 10.2.2.12. There are certain songs that makes iTunes crash while syncing. The workaround is just to delete the artwork of the song. The big annoying thing is that I have to stare at iTunes and wait for th
-
How to start/stop a MSCS clustered SAP system?
Hi! I know the sequece is very important. Could you give the step sequence and the method of each step? I search SMP but found no clue. Thanks a lot! Pints guaranteed.
-
Hi, My InDesign cc2014 freezes when I apply manually 'mapStylestoXMLTags' to a document. any idea? Thank you,
-
IDES - Oracle with AIX-License on Windows possible?
Hello, We have a license for SAP ERP with Oracle on AIX-Basis. But for testing and investigation purposes I want to install IDES on a Windows-basis. Is it possible to get an IDES Windows Oracle Installation with an AIX-license? Or are there other pos
-
Quicktime "Save As" Automator Function
I have a 3,000 quicktime reference files that I need to have: --Opened In Quicktime --Save As (Same directory and name (which quicktime does automatically) I am new to automator but can get quicktime to open all of the files in a selected directory b