Function module for includes
Is there any function module which would return all the includes name in the submitted program?
>
priya singh wrote:
> Is there any function module which would return all the includes name in the submitted program?
Hi Priya,
Nitin is correct but the function module "RS_GET_ALL_INCLUDES", doen't inform the level of the INCLUDE. That means if you have a Report R1, which contains INCLUDE I1 and INCLUDE I2 and I1 inturn contains I11, then the Function Module will return:-
R1
I1
I11
I2
But it won't tell the level. If you need to know the level you can use the followinng code. In the following code the table ITAB2 also has the Depth, Level and Include Name information.
DATA prog TYPE c LENGTH 30.
DATA: itab TYPE TABLE OF string,
itab2 TYPE TABLE OF slevel,
itab3 TYPE TABLE OF stoken,
itab4 TYPE TABLE OF sstmnt.
prog = 'RSTXR3TR'.
READ REPORT prog INTO itab.
SCAN ABAP-SOURCE itab LEVELS INTO itab2
WITH INCLUDES
TOKENS INTO itab3
STATEMENTS INTO itab4.
Many Regards,
Ravi.
Similar Messages
-
How to create the INBOUND Function Module for INBOUND IDOCs
Hi Friends,
Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
which are recieved from XI Server ?
I am working in SAP-ISU
Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
We have a Standard INBOUND FUNCTION MODULE
IDOC_INPUT_ISU_MR_UPLOAD
which Uploads the Meter Reading Results.
I copied the Same function Module into ZIDOC_INPUT_
and working on it.
Can any one suggest me, whether i am going in correct way or not.
In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
Can I Use the Same BAPI
BAPI_MTRREADDOC_UPLOAD
to Update the below fields,
EABL-SERNR
EABL-ZWNUMMER
EABLG-ABLESGR
EABL-V_ZWSTAND
EABL-N_ZWSTAND
EABL-ABLHINW
EABL-ZSKIPC
EABL-ADAT
EABL-ATIMTATS
EABL-ADATTATS
EABL-ATIM
EABL-ZMESSAGE
EABL-ABLESER(Meter reader number)
Kindly Suggest me,
Thanks in Advance,
GaneshHello Ganesh
I think you are going completely astray with you z-function module for IDoc processing.
If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
EABL-SERNR => BAPIEABLU-SERIALNO
EABL-ZWNUMMER =>REGISTER
EABLG-ABLESGR
EABL-V_ZWSTAND
EABL-N_ZWSTAND
EABL-ABLHINW
EABL-ZSKIPC
EABL-ADAT
EABL-ATIMTATS => ACTUALMRTIME
EABL-ADATTATS => ACTUALMRDATE
EABL-ATIM
EABL-ZMESSAGE
EABL-ABLESER(Meter reader number)
Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
- BAPI_TE_EABL
- BAPI_TE_EOSB
Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
Regards
Uwe -
Which is better Function modules or Include programs?
Hi,
I am working on an enhancement and it has lot of screens with a tree structure on the left. Now we are planning to have each screen to have its PAI/PBO and the processing logic to be in seperate include programs.
However in our team we have debate as to go in for include programs or for Function modules. The opinion here is that the program should not take long time to load if its going to be include programs.
Please suggest what approach is better, is it Function modules or include programs.
Any other suggestion is also welcome.
Thank You,
SAC.Thank You all.
In this enhancement I have about 13 screens and has business logic in each. So if I go with each screens and business logic coding in seperate Function modules than includes under 1 function group is adviceable?
Using object oriented approach is really the best thing here, but however most of my team members are not welversed in OO concepts. The deadlines are very tight for grooming my team members as well.
My only concern is that with so much screens and business logic in 1 transaction should not bring down this programs performance when its executed.
Any other suggestions to keep in mind for this is appreciated.
Thank You.
SAC -
Error in XXL_FULL_API function module for download report to excel
Hi all,
I am using XXL_FULL_API function module for download report to excel, In this FM we have to fill a table called sema = t_gxxlt_s. in this table we have a fields called
i_sema-col_no = 19.
i_sema-col_src = 19.
i_sema-col_typ = 'STR'.
i_sema-col_ops = 'DFT'
here in 'col_typ' if we put STR in excel it will come as a text but i wnat the time field what i have to pass ?
and for filed 'col_ops' also ??
Thaks,
SridharHi sridhar joshi,
Please check this program
REPORT Excel.
TABLES:
sflight.
* header data................................
DATA :
header1 LIKE gxxlt_p-text VALUE 'Suresh',
header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
* Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA END OF t_sflight.
* Internal table for holding the horizontal key.
DATA BEGIN OF t_hkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_h.
DATA END OF t_hkey .
* Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_v.
DATA END OF t_vkey .
* Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
INCLUDE STRUCTURE gxxlt_o.
DATA END OF t_online.
* Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
INCLUDE STRUCTURE gxxlt_p.
DATA END OF t_print.
* Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
INCLUDE STRUCTURE gxxlt_s.
DATA END OF t_sema.
* Retreiving data from sflight.
SELECT * FROM sflight
INTO TABLE t_sflight.
* Text which will be displayed online is declared here....
t_online-line_no = '1'.
t_online-info_name = 'Created by'.
t_online-info_value = 'KODANDARAMI REDDY'.
APPEND t_online.
* Text which will be printed out..........................
t_print-hf = 'H'.
t_print-lcr = 'L'.
t_print-line_no = '1'.
t_print-text = 'This is the header'.
APPEND t_print.
t_print-hf = 'F'.
t_print-lcr = 'C'.
t_print-line_no = '1'.
t_print-text = 'This is the footer'.
APPEND t_print.
* Defining the vertical key columns.......
t_vkey-col_no = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.
t_vkey-col_no = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.
t_vkey-col_no = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.
t_vkey-col_no = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.
* Header text for the data columns................
t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.
t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.
t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.
t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.
t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.
t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.
* populating the SEMA data..........................
t_sema-col_no = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.
t_sema-col_no = 2.
APPEND t_sema.
t_sema-col_no = 3.
APPEND t_sema.
t_sema-col_no = 4.
APPEND t_sema.
t_sema-col_no = 5.
APPEND t_sema.
t_sema-col_no = 6.
APPEND t_sema.
t_sema-col_no = 7.
APPEND t_sema.
t_sema-col_no = 8.
APPEND t_sema.
t_sema-col_no = 9.
APPEND t_sema.
t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.
CALL FUNCTION 'XXL_FULL_API'
EXPORTING
* DATA_ENDING_AT = 54
* DATA_STARTING_AT = 5
filename = 'TESTFILE'
header_1 = header1
header_2 = header2
no_dialog = 'X'
no_start = ' '
n_att_cols = 6
n_hrz_keys = 1
n_vrt_keys = 4
sema_type = 'X'
* SO_TITLE = ' '
TABLES
data = t_sflight
hkey = t_hkey
online_text = t_online
print_text = t_print
sema = t_sema
vkey = t_vkey
EXCEPTIONS
cancelled_by_user = 1
data_too_big = 2
dim_mismatch_data = 3
dim_mismatch_sema = 4
dim_mismatch_vkey = 5
error_in_hkey = 6
error_in_sema = 7
file_open_error = 8
file_write_error = 9
inv_data_range = 10
inv_winsys = 11
inv_xxl = 12
OTHERS = 13
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
please refer this link
http://www.thespot4sap.com/Articles/Download_to_excel.asp
Best regards,
raam -
Function Module for sending an Attachment
Not able to find the Function Module for sending an Attachment to the email ids.
Please help.Hi bala,
1. There is some trick involved in attachment
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
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 = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
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 <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
regards,
amit m. -
Error in function module for inbound processingwhile testing from we19
hi,
I have developed a custom function module for processing inbound idoc for creating material using bdc...the problem is that when i am trying to test my idoc using we19 and calling my function module in debug mode an error is displayed showing 'interface for function module is incorrect' and also i am unable to see my function module in debugging mode.It is only displaying the error message...
I have given all the parameters necessary (import,export or tables) and found no error in the interface...I think the problem is appearing before my function module is being called....Also on seeing the short dump analysis I have seen that the error is in the form 'Idocs passed to application' which is not a part of the function module developed by me...
I am unable to understand why this error message is being displayed...
Please help me out of this..ya i know that ..But I wanted to create a simple one..moreover the problem is not with bdc....It is with the function module interface..
Also I want to ask a question that I had to define all the parameters (in the function module ) by data declaration statements in the function group top include..
If i dont do that say the first error is when i write loop at idoc_contrl ..idoc_contrl is not declared by a data statement..So IO had to write a data statement:
Idoc_contrl type table of edidc..I have seen that in other function modules (idoc inbound processing) no such data declaration is done.. -
BAPI Function Module for SCM APO Tcode /SAPAPO/AC42
Hi,
I want to know the BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.
This BAPI FM should return the column values "Remaining Prod Alloc" and "Incoming Order Quantity" when we give
below details as inputs for the Tcode /SAPAPO/AC42
Product Allocation Group
Product
Allocation Procedure
prod Alloc step
Product Alloc Object (Characteristics of Product Alloc Group)
Plant (Characteristics of Product Alloc Group)
Customer Group 5 (Characteristics of Product Alloc Group)
Reward points if helpful.
Thanks,
MichHi,
You should be able to get the information using the standard BAPI (Assuming you are using SCM5.0) BAPI_APOPAL_INSERT in the transaction BAPI.
ProductAllocationAPO.DataInsert
Interface to Import Product Allocation Data Functionality
This method is used to adopt data from OLTP systems for product allocation in the global availability check.
You can do the following using the method:
Adopt new data
You can adopt new characteristics combinations or new time series. Newly created characteristics combinations have the status Active and are therefore included in the product allocation check.
Change existing data
You can overwrite existing data if you have set the interface parameter ALLOW_UPDATE. You can set the status of existing characteristics combinations to Active if you set the interface parameter UPDATE_STATUS. If the characteristics combination does not exist, the system creates it.
The product allocation quantity is overwritten for existing time series. If you also want to change the incoming orders quantity, you must set the interface parameter UPDATE_INCOMING_ORDER_QTY. If the time series does not exist, the system creates it.
Prerequisite
To be able to use this method, you must have made all the Customizing settings for product allocation. For more information, see the Implementation Guide (IMG) for SAP APO under Global Available-to-Promise -> Product Allocation.
Regards
Vinod -
BAPI Function Module for SCM APO Trans code /SAPAPO/AC42
Hi,
Is there any BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.
This BAPI FM should return the column values "Remaining Prod Alloc" and "Incoming Order Quantity" when we give
below details as inputs for the Tcode /SAPAPO/AC42
Product Allocation Group
Product
Allocation Procedure
prod Alloc step
Product Alloc Object (Characteristics of Product Alloc Group)
Plant (Characteristics of Product Alloc Group)
Customer Group 5 (Characteristics of Product Alloc Group)
Reward points if helpful.
Thanks,
MichHi,
You should be able to get the information using the standard BAPI (Assuming you are using SCM5.0) BAPI_APOPAL_INSERT in the transaction BAPI.
ProductAllocationAPO.DataInsert
Interface to Import Product Allocation Data Functionality
This method is used to adopt data from OLTP systems for product allocation in the global availability check.
You can do the following using the method:
Adopt new data
You can adopt new characteristics combinations or new time series. Newly created characteristics combinations have the status Active and are therefore included in the product allocation check.
Change existing data
You can overwrite existing data if you have set the interface parameter ALLOW_UPDATE. You can set the status of existing characteristics combinations to Active if you set the interface parameter UPDATE_STATUS. If the characteristics combination does not exist, the system creates it.
The product allocation quantity is overwritten for existing time series. If you also want to change the incoming orders quantity, you must set the interface parameter UPDATE_INCOMING_ORDER_QTY. If the time series does not exist, the system creates it.
Prerequisite
To be able to use this method, you must have made all the Customizing settings for product allocation. For more information, see the Implementation Guide (IMG) for SAP APO under Global Available-to-Promise -> Product Allocation.
Regards
Vinod -
Function Module For Item Level Details of a Sales Order
Hi Guys,
I have to get the item level details for a particular sales document no ..I want to know if there is any function module existing for the same.
Also I need any function module for getting the contact information such as contact form (KNVK-ANRED),contact name(KNVK-NAM1),contact name(KNVK-NAMEV),Contact number (KNVK-TELF1).
Please let me know if anyone is aware of it.
Thanks in Advance,
Mayank<b>SD_SALES_DOCUMENT_READ</b> Reads sales document header and business data: tables VBAK, VBKD and VBPA (Sold-to (AG), Payer (RG) and Ship-to (WE) parties)
<b>SD_SALES_DOCUMENT_READ_POS</b> Reads sales document header and item material: tables VBAK, VBAP-MATNR
<b>SD_DOCUMENT_PARTNER_READ</b> partner information including address. Calls SD_PARTNER_READ
<b>SD_PARTNER_READ</b> all the partners information and addresses
<b>SD_DETERMINE_CONTRACT_TYPE</b>
In: at least VBAK-VBELN
Exceptions: NO CONTRACT | SERVICE_CONTRACT | QUANTITY_CONTRACT
<b>SD_SALES_DOCUMENT_COPY</b>
<b>RV_ORDER_FLOW_INFORMATION</b> Reads sales document flow of sales document after delivery and billing
SD_SALES_DOCUMENT_SAVE create Sales Doc from the copied document
SD_SALES_DOCUMENT_ENQUEUE to dequeue use DEQUEUE_EVVBAKE
RV_DELIVERY_PRINT_VIEW Data provision for delivery note printing
SD_PACKING_PRINT_VIEW
SD_DELIVERY_VIEW Data collection for printing
called from RV_DELIVERY_PRINT_VIEW, SD_PACKING_PRINT_VIEW
RV_BILLING_PRINT_VIEW Data Provision for Billing Document Print
regards
vinod -
Hi all,
Is there any Z function modules for OLE, which will download the data directly to Excel with 2 sheets.
Regards,
ShaliniHi Shalini Reddy
there is no FM but code is there... u can see...
*& Report YOLE_FOR_EXCEL
REPORT yole_for_excel.
*REPORT ZTEST_BYW.
OLE specific include file
INCLUDE ole2incl.
INCLUDE excel__c.
data definitions of OLE objects with type ole2_object
PARAMETERS: p_filenm(80) LOWER CASE OBLIGATORY
DEFAULT 'd:\temp\report_tsl.xls'.
DATA: g_tmp_workbook TYPE ole2_object.
DATA: g_tmp_worksheets TYPE ole2_object.
DATA: g_tmp_worksheet1 TYPE ole2_object.
DATA: g_tmp_worksheet2 TYPE ole2_object.
DATA: g_pc_template LIKE rcgfiletr-ftappl
VALUE 'd:\temp\mmr_rpt_tsl_tmp.xls'.
DATA: g_excel TYPE ole2_object.
DATA: g_workbooks TYPE ole2_object.
DATA: g_workbook TYPE ole2_object.
DATA: g_worksheets TYPE ole2_object.
DATA: g_worksheet TYPE ole2_object.
DATA: g_cell TYPE ole2_object.
DATA: g_cell1 TYPE ole2_object.
DATA: g_cell2 TYPE ole2_object.
DATA: g_cellrange TYPE ole2_object.
DATA: g_font TYPE ole2_object.
DATA: g_interior TYPE ole2_object.
DATA: g_borders TYPE ole2_object.
DATA: g_first_ws VALUE 'Y'.
DATA: g_row TYPE i.
DATA: g_col TYPE i.
definition of loop counter
DATA: i TYPE i VALUE '5'.
DATA: BEGIN OF t_sheet1 OCCURS 1,
col1(10),
col2(20),
END OF t_sheet1.
DATA: BEGIN OF t_sheet2 OCCURS 1,
col1(10),
col2(20),
END OF t_sheet2.
START-OF-SELECTION.
PERFORM prepare_data.
PERFORM download_to_excel.
END-OF-SELECTION.
call method of excel 'QUIT'.
it is now possible to leave the EXCEL application
remark: you have to go to the EXCEL application and answer the
popup dialog screen
*& Form PREPARE_DATA
FORM prepare_data.
t_sheet1-col1 = 'A1'.
t_sheet1-col2 = 'A2'.
APPEND t_sheet1.
t_sheet1-col1 = 'B1'.
t_sheet1-col2 = 'B2'.
APPEND t_sheet1.
t_sheet2-col1 = 'Y1'.
t_sheet2-col2 = 'Y2'.
APPEND t_sheet2.
t_sheet2-col1 = 'Z1'.
t_sheet2-col2 = 'Z2'.
APPEND t_sheet2.
ENDFORM. " PREPARE_DATA
*& Form DOWNLOAD_TO_EXCEL
FORM download_to_excel.
PERFORM open_excel.
PERFORM add_worksheet1.
PERFORM add_worksheet2.
PERFORM open_template_file.
PERFORM close_excel.
WRITE: / 'End of program'.
ENDFORM. " DOWNLOAD_TO_EXCEL
*& Form FILL_CELL
*& FORM routine, which fills the specified cell in the EXCEL sheet
*& with the given value
FORM fill_cell USING i_row TYPE i
i_col TYPE i
i_value
i_fontbold
i_digit
i_wraptext
i_horizon_align
i_vertical_align.
DATA: l_str TYPE string.
CALL METHOD OF g_excel 'CELLS' = g_cell
EXPORTING #1 = i_row
#2 = i_col.
SET PROPERTY OF g_cell 'VALUE' = i_value.
IF i_fontbold = 'X'.
GET PROPERTY OF g_cell 'Font' = g_font.
SET PROPERTY OF g_font 'Bold' = 1.
ENDIF.
IF NOT i_wraptext IS INITIAL.
SET PROPERTY OF g_cell 'WrapText' = 1.
ENDIF.
IF NOT i_horizon_align IS INITIAL.
IF i_horizon_align = 'L'.
SET PROPERTY OF g_cell 'HorizontalAlignment' = xlleft.
ELSEIF i_horizon_align = 'R'.
SET PROPERTY OF g_cell 'HorizontalAlignment' = xlright.
ELSEIF i_horizon_align = 'C'.
SET PROPERTY OF g_cell 'HorizontalAlignment' = xlcenter.
ENDIF.
ENDIF.
IF NOT i_vertical_align IS INITIAL.
IF i_vertical_align = 'T'.
SET PROPERTY OF g_cell 'VerticalAlignment' = xltop.
ELSEIF i_vertical_align = 'B'.
SET PROPERTY OF g_cell 'VerticalAlignment' = xlbottom.
ELSEIF i_vertical_align = 'C'.
SET PROPERTY OF g_cell 'VerticalAlignment' = xlcenter.
ENDIF.
ENDIF.
To set number format for cell
IF i_digit <> ''.
IF i_value IS INITIAL AND i_digit <> '%'.
SET PROPERTY OF g_cell 'VALUE' = ''.
ELSE.
Set number format for cell with number
IF i_digit = '1'.
SET PROPERTY OF g_cell 'NumberFormat' = '#,###.0 '.
ELSEIF i_digit = '2'.
SET PROPERTY OF g_cell 'NumberFormat' = '#,##0.00 '.
ELSEIF i_digit = '%'.
SET PROPERTY OF g_cell 'NumberFormat' = '#,##0.00% '.
ELSE.
SET PROPERTY OF g_cell 'NumberFormat' = '#,### '.
ENDIF.
ENDIF.
ENDIF.
ADD 1 TO i_col.
ENDFORM. "FILL_CELL
*& Form OPEN_EXCEL
FORM open_excel.
DATA: l_cnt TYPE i.
create object excel of OLE class 'EXCEL.APPLICATION'
CREATE OBJECT g_excel 'EXCEL.APPLICATION'.
CALL METHOD OF g_excel 'WORKBOOKS' = g_workbooks.
CALL METHOD OF g_workbooks 'ADD' = g_workbook.
GET PROPERTY OF g_workbook 'Worksheets' = g_worksheets.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
SET PROPERTY OF g_excel 'DISPLAYALERTS' = 0.
GET PROPERTY OF g_worksheets 'Count' = l_cnt.
l_cnt = l_cnt - 1.
Delete unwanted worksheets
DO l_cnt TIMES.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
CALL METHOD OF g_worksheet 'DELETE'.
ENDDO.
ENDFORM. " OPEN_EXCEL
*& Form CLOSE_EXCEL
FORM close_excel.
SET PROPERTY OF g_excel 'VISIBLE' = 1.
CALL METHOD OF g_workbook 'SAVEAS'
EXPORTING #1 = p_filenm.
quit Excel and free all OLE objects
call method of g_excel 'QUIT'.
FREE OBJECT g_interior.
FREE OBJECT g_borders.
FREE OBJECT g_font.
FREE OBJECT g_cell.
FREE OBJECT g_cell1.
FREE OBJECT g_cell2.
FREE OBJECT g_cellrange.
FREE OBJECT g_excel.
FREE OBJECT g_workbooks.
FREE OBJECT g_workbook.
FREE OBJECT g_worksheets.
FREE OBJECT g_worksheet.
ENDFORM. " CLOSE_EXCEL
*& Form ADD_WORKSHEET
FORM add_worksheet USING i_name.
Add new worksheet
IF g_first_ws <> 'N'.
g_first_ws = 'N'.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
ELSE.
CALL METHOD OF g_worksheets 'Add' = g_worksheet.
ENDIF.
SET PROPERTY OF g_worksheet 'NAME' = i_name.
g_row = 1.
g_col = 1.
ENDFORM. " ADD_WORKSHEET
*& Form ADD_WORKSHEET1
FORM add_worksheet1.
PERFORM add_worksheet USING 'Test 1'.
fill line in EXCEL sheet with headerlines of table columns
g_col = 1.
PERFORM fill_cell USING g_row g_col 'My First Worksheet' 'X' ''
PERFORM merge_cell USING g_row 1 g_row 4.
PERFORM set_border USING g_row 1 g_row 4 4 ''.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'ID'(001) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Name'(002) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Telephon'(003) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Rabatt'(004) 'X' '' '' '' ''.
loop at customr table and print values into EXCEL sheet
ADD 1 TO g_row.
LOOP AT t_sheet1.
g_col = 1.
PERFORM fill_cell USING g_row g_col t_sheet1-col1 '' '' '' '' ''.
PERFORM fill_cell USING g_row g_col t_sheet1-col2 '' '' '' '' ''.
ADD 1 TO g_row.
ENDLOOP.
g_col = 4.
PERFORM set_border USING 1 1 g_row g_col '' 4.
ENDFORM. " ADD_WORKSHEET1
*& Form ADD_WORKSHEET2
FORM add_worksheet2.
PERFORM add_worksheet USING 'Test 2'.
fill line in EXCEL sheet with headerlines of table columns
g_col = 1.
PERFORM fill_cell USING g_row g_col 'My Second Worksheet' 'X' ''
PERFORM merge_cell USING g_row 1 g_row 4.
PERFORM set_border USING g_row 1 g_row 4 1 'X'.
PERFORM set_color USING g_row 1 g_row 4 'LT'.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'ID'(001) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Name'(002) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Telephon'(003) 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col 'Rabatt'(004) 'X' '' '' '' ''.
loop at customr table and print values into EXCEL sheet
ADD 1 TO g_row.
LOOP AT t_sheet2.
g_col = 1.
PERFORM fill_cell USING g_row g_col t_sheet2-col1 '' '' '' '' ''.
PERFORM fill_cell USING g_row g_col t_sheet2-col2 '' '' '' '' ''.
ADD 1 TO g_row.
ENDLOOP.
g_col = 4.
PERFORM set_border USING 1 1 g_row g_col 2 'X'.
ADD 4 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'This is a wrap text' 'X' ''
'X' 'C' 'T'.
PERFORM fill_cell USING g_row g_col 'Vertical - Bottom' 'X' ''
'' 'L' 'T'.
ADD 4 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'Amount 1' 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col '100.04' '' 'X' '' '' ''.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'Amount 2' 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col '200.01' '' 'X' '' '' ''.
ADD 1 TO g_row.
g_col = 1.
PERFORM fill_cell USING g_row g_col 'Total' 'X' '' '' '' ''.
PERFORM fill_cell USING g_row g_col '=SUM(B13:B14)' 'X' 'X' '' '' ''.
PERFORM fill_cell USING g_row g_col '0.00' 'X' 'X' '' '' ''.
PERFORM copy_cell USING g_row 2 17 5 25 8.
ENDFORm. " ADD_WORKSHEET2
*& Form MERGE_CELL
FORM merge_cell USING i_row1 i_col1
i_row2 i_col2.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_row1
#2 = i_col1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_row2
#2 = i_col2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
CALL METHOD OF g_cellrange 'Merge'.
ENDFORM. " MERGE_CELL
*& Form SET_BORDER
FORM set_border USING i_row1 i_col1
i_row2 i_col2
i_thickness
i_allborders.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_row1
#2 = i_col1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_row2
#2 = i_col2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
IF i_allborders IS INITIAL.
CALL METHOD OF g_cellrange 'BorderAround'
EXPORTING #1 = 1 "Continuous line
#2 = i_thickness. "Thickness: 1 - Normal, 4 - Thick
ELSE.
GET PROPERTY OF g_cellrange 'Borders' = g_borders.
SET PROPERTY OF g_borders 'LineStyle' = '1'.
SET PROPERTY OF g_borders 'Weight' = i_thickness.
ENDIF.
ENDFORM. " SET_BORDER
*& Form SET_COLOR
FORM set_color USING i_row1 i_col1
i_row2 i_col2
i_color.
DATA: l_colorindex TYPE i.
CASE i_color.
WHEN 'BK'.
l_colorindex = 1. "Black
WHEN 'BR'.
l_colorindex = 53. "Brown
WHEN 'OG'.
l_colorindex = 52. "Olive Green
WHEN 'DG'.
l_colorindex = 51. "Dark Green
WHEN 'DT'.
l_colorindex = 49. "Dark Teal
WHEN 'DB'.
l_colorindex = 11. "Dark Blue
WHEN 'ID'.
l_colorindex = 55. "Indigo
WHEN 'G4'.
l_colorindex = 56. "Gray 80%
WHEN 'DR'.
l_colorindex = 9. "Dark Red
WHEN 'OR'.
l_colorindex = 46. "Orange
WHEN 'DY'.
l_colorindex = 12. "Dark Yellow
WHEN 'GR'.
l_colorindex = 10. "Green
WHEN 'TL'.
l_colorindex = 14. "Teal
WHEN 'BL'.
l_colorindex = 5. "Blue
WHEN 'BY'.
l_colorindex = 47. "Blue Gray
WHEN 'G3'.
l_colorindex = 16. "Gray 50%
WHEN 'RD'.
l_colorindex = 3. "Red
WHEN 'LO'.
l_colorindex = 45. "Light Orange
WHEN 'LI'.
l_colorindex = 43. "Lime
WHEN 'SG'.
l_colorindex = 50. "Sea Green
WHEN 'AQ'.
l_colorindex = 42. "Aqua
WHEN 'LB'.
l_colorindex = 41. "Light Blue
WHEN 'VL'.
l_colorindex = 13. "Violet
WHEN 'G2'.
l_colorindex = 48. "Gray 40%
WHEN 'PK'.
l_colorindex = 7. "Pink
WHEN 'GD'.
l_colorindex = 44. "Gold
WHEN 'YL'.
l_colorindex = 6. "Yellow
WHEN 'BG'.
l_colorindex = 4. "Bright Green
WHEN 'TQ'.
l_colorindex = 8. "Turquoise
WHEN 'SB'.
l_colorindex = 33. "Sky Blue
WHEN 'PL'.
l_colorindex = 54. "Plum
WHEN 'G1'.
l_colorindex = 15. "Gray 25%
WHEN 'RS'.
l_colorindex = 38. "Rose
WHEN 'TN'.
l_colorindex = 40. "Tan
WHEN 'LY'.
l_colorindex = 36. "Light Yellow
WHEN 'LG'.
l_colorindex = 35. "Light Green
WHEN 'LT'.
l_colorindex = 34. "Light Turquoise
WHEN 'PB'.
l_colorindex = 37. "Pale Blue
WHEN 'LV'.
l_colorindex = 39. "Lavender
WHEN 'WH'.
l_colorindex = 2. "White
WHEN OTHERS.
l_colorindex = 2. "White
ENDCASE.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_row1
#2 = i_col1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_row2
#2 = i_col2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
GET PROPERTY OF g_cellrange 'Interior' = g_interior.
SET PROPERTY OF g_interior 'ColorIndex' = l_colorindex.
ENDFORM. " SET_COLOR
*& Form COPY_CELL
FORM copy_cell USING i_crow i_ccol
i_prow1 i_pcol1
i_prow2 i_pcol2.
CALL METHOD OF g_excel 'Cells' = g_cell
EXPORTING #1 = i_crow
#2 = i_ccol.
CALL METHOD OF g_cell 'Copy'.
CALL METHOD OF g_excel 'Cells' = g_cell1
EXPORTING #1 = i_prow1
#2 = i_pcol1.
CALL METHOD OF g_excel 'Cells' = g_cell2
EXPORTING #1 = i_prow2
#2 = i_pcol2.
CALL METHOD OF g_excel 'Range' = g_cellrange
EXPORTING #1 = g_cell1
#2 = g_cell2.
CALL METHOD OF g_worksheet 'Paste'
EXPORTING #1 = g_cellrange.
ENDFORM. " COPY_CELL
*& Form OPEN_TEMPLATE_FILE
FORM open_template_file.
CALL METHOD OF g_workbooks 'Open' = g_tmp_workbook
EXPORTING #1 = g_pc_template
#2 = 2
#3 = 0
#4 = 1
#5 = 0
#6 = 0
#7 = 1.
CALL FUNCTION 'FLUSH'
EXCEPTIONS
OTHERS = 0.
GET PROPERTY OF g_tmp_workbook 'Worksheets' = g_tmp_worksheets.
GET PROPERTY OF g_tmp_worksheets 'Item' = g_tmp_worksheet1
exporting #1 = 1.
GET PROPERTY OF g_tmp_worksheets 'Item' = g_tmp_worksheet2
exporting #1 = 2.
CALL METHOD OF g_tmp_worksheet1 'Copy'
EXPORTING #1 = g_worksheet.
CALL METHOD OF g_tmp_worksheet2 'Copy'
EXPORTING #1 = g_worksheet.
call method of g_tmp_workbook 'Close'.
CALL FUNCTION 'FLUSH'
EXCEPTIONS
OTHERS = 0.
ENDFORM. " OPEN_TEMPLATE_FILE -
Sample Outbound Function Module for IDocs
Hello All,
Does anyone have sample code for an outbound function module for an IDoc - they created themselves. Custom or extended? Weblogs, sample code will be useful
ty, dd
Message was edited by:
Demi DouglasHi,
Check this program:
REPORT zmatmas_idoc.
INCLUDE zmatmas_idoc_top.
INCLUDE zmatmas_idoc_selscreen.
INCLUDE zmatmas_idoc_formroutine.
START OF SELECTION
START-OF-SELECTION.
PERFORM get_data.
PERFORM create_idoc.
PERFORM distribute_idoc.
TABLES
TABLES: mara.
Structures
*Header
TYPES: BEGIN OF gs_h_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
aenam TYPE mara-aenam,
pstat TYPE mara-pstat,
END OF gs_h_mara.
*Item
TYPES: BEGIN OF gs_i_makt,
spras TYPE makt-spras,
maktx TYPE makt-maktx,
maktg TYPE makt-maktg,
matnr TYPE makt-matnr,
END OF gs_i_makt.
TYPES: BEGIN OF gs_i_mbew,
lvorm TYPE mbew-lvorm,
lbkum TYPE mbew-lbkum,
salk3 TYPE mbew-salk3,
vprsv TYPE mbew-vprsv,
verpr TYPE mbew-verpr,
stprs TYPE mbew-stprs,
peinh TYPE mbew-peinh,
matnr TYPE mbew-matnr,
END OF gs_i_mbew.
TYPES: BEGIN OF gs_i_mvke,
vkorg TYPE mvke-vkorg,
vtweg TYPE mvke-vtweg,
lvorm TYPE mvke-lvorm,
versg TYPE mvke-versg,
bonus TYPE mvke-bonus,
provg TYPE mvke-provg,
matnr TYPE mvke-matnr,
END OF gs_i_mvke.
TYPES: BEGIN OF gs_i_mlan,
aland TYPE mlan-aland,
taxm1 TYPE mlan-taxm1,
taxm2 TYPE mlan-taxm2,
taxm3 TYPE mlan-taxm3,
taxm4 TYPE mlan-taxm4,
matnr TYPE mlan-matnr,
END OF gs_i_mlan.
*Segment & control record
DATA: gs_segment_h LIKE zmara_h,
gs_segment_i1 LIKE zmakt_i,
gs_segment_i2 LIKE zmbew_i,
gs_segment_i3 LIKE zmvke_i,
gs_segment_i4 LIKE zmlan_i,
gs_control_rec LIKE edidc.
Internal Table and work area
*Header & Item
DATA: gt_h_mara TYPE STANDARD TABLE OF gs_h_mara,
gt_i_makt TYPE STANDARD TABLE OF gs_i_makt,
gt_i_mbew TYPE STANDARD TABLE OF gs_i_mbew,
gt_i_mvke TYPE STANDARD TABLE OF gs_i_mvke,
gt_i_mlan TYPE STANDARD TABLE OF gs_i_mlan.
DATA: gw_h_mara TYPE gs_h_mara,
gw_i_makt TYPE gs_i_makt,
gw_i_mbew TYPE gs_i_mbew,
gw_i_mvke TYPE gs_i_mvke,
gw_i_mlan TYPE gs_i_mlan.
*EDIDD & EDIDC
DATA: gt_edidc LIKE TABLE OF edidc WITH HEADER LINE,
gt_edidd LIKE TABLE OF edidd WITH HEADER LINE.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
*& Include ZMATMAS_IDOC_FORMROUTINE
*& Form get_data
FORM get_data .
SELECT matnr ersda ernam laeda aenam pstat
FROM mara
INTO TABLE gt_h_mara
WHERE matnr IN s_matnr.
IF sy-subrc <> 0.
MESSAGE e003(zkaren_msgclass).
No data found according to the selection criteria
ENDIF.
IF gt_h_mara IS NOT INITIAL.
SELECT spras maktx maktg matnr
INTO TABLE gt_i_makt
FROM makt
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
SELECT lvorm lbkum salk3 vprsv verpr stprs peinh matnr
INTO TABLE gt_i_mbew
FROM mbew
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
SELECT vkorg vtweg lvorm versg bonus provg matnr
INTO TABLE gt_i_mvke
FROM mvke
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
SELECT aland taxm1 taxm2 taxm3 taxm4 matnr
INTO TABLE gt_i_mlan
FROM mlan
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
ENDIF.
ENDFORM. " get_data
*& Form create_idoc
FORM create_idoc .
*Control data
gs_control_rec-mestyp = 'ZKAR_MATMAS_MSG_TYPE'. "Message type
gs_control_rec-idoctp = 'ZKAR_MATMAS'. "IDoc
gs_control_rec-rcvprt = 'LS'. "Partner type of receiver
gs_control_rec-rcvprn = 'T90CLNT810'. "Partner number of receiver
LOOP AT gt_h_mara INTO gw_h_mara .
*Header data.
gs_segment_h-matnr = gw_h_mara-matnr.
gs_segment_h-ersda = gw_h_mara-ersda.
gs_segment_h-ernam = gw_h_mara-ernam.
gs_segment_h-laeda = gw_h_mara-laeda.
gs_segment_h-aenam = gw_h_mara-aenam.
gs_segment_h-pstat = gw_h_mara-pstat.
*Header segment
gt_edidd-segnam = 'ZMARA_H'.
gt_edidd-sdata = gs_segment_h.
MOVE gt_edidd-sdata TO gs_segment_h.
APPEND gt_edidd.
WRITE:/ gs_segment_h-matnr, gs_segment_h-ersda, gs_segment_h-ernam,
gs_segment_h-laeda, gs_segment_h-aenam, gs_segment_h-pstat.
*ITEM 1
LOOP AT gt_i_makt INTO gw_i_makt.
IF gw_i_makt-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i1-spras = gw_i_makt-spras.
gs_segment_i1-maktx = gw_i_makt-maktx.
gs_segment_i1-maktg = gw_i_makt-maktg.
*Item segment
gt_edidd-segnam = 'ZMAKT_I'.
gt_edidd-sdata = gs_segment_i1.
APPEND gt_edidd.
ENDIF.
ENDLOOP. "at gt_i_vbak
*ITEM2
LOOP AT gt_i_mbew INTO gw_i_mbew.
IF gw_i_mbew-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i2-lvorm = gw_i_mbew-lvorm.
gs_segment_i2-lbkum = gw_i_mbew-lbkum.
gs_segment_i2-salk3 = gw_i_mbew-salk3.
gs_segment_i2-vprsv = gw_i_mbew-vprsv.
gs_segment_i2-verpr = gw_i_mbew-verpr.
gs_segment_i2-stprs = gw_i_mbew-stprs.
gs_segment_i2-peinh = gw_i_mbew-peinh.
*Item segment
gt_edidd-segnam = 'ZMBEW_I'.
gt_edidd-sdata = gs_segment_i2.
APPEND gt_edidd.
ENDIF.
ENDLOOP.
*ITEM3
LOOP AT gt_i_mvke INTO gw_i_mvke.
IF gw_i_mvke-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i3-vkorg = gw_i_mvke-vkorg.
gs_segment_i3-vtweg = gw_i_mvke-vtweg.
gs_segment_i3-lvorm = gw_i_mvke-lvorm.
gs_segment_i3-versg = gw_i_mvke-versg.
gs_segment_i3-bonus = gw_i_mvke-bonus.
gs_segment_i3-provg = gw_i_mvke-provg.
*Item segment
gt_edidd-segnam = 'ZMVKE_I'.
gt_edidd-sdata = gs_segment_i3.
APPEND gt_edidd.
ENDIF.
ENDLOOP.
*ITEM4
LOOP AT gt_i_mlan INTO gw_i_mlan.
IF gw_i_mlan-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i4-aland = gw_i_mlan-aland.
gs_segment_i4-taxm1 = gw_i_mlan-taxm1.
gs_segment_i4-taxm2 = gw_i_mlan-taxm2.
gs_segment_i4-taxm3 = gw_i_mlan-taxm3.
gs_segment_i4-taxm4 = gw_i_mlan-taxm4.
*Item segment
gt_edidd-segnam = 'ZMLAN_I'.
gt_edidd-sdata = gs_segment_i4.
APPEND gt_edidd.
ENDIF.
ENDLOOP.
ENDLOOP. "at gt_h_kna1
ENDFORM. " create_idoc
*& Form distribute_idoc
FORM distribute_idoc .
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = gs_control_rec
TABLES
communication_idoc_control = gt_edidc
master_idoc_data = gt_edidd
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.
IF sy-subrc <> 0.
WRITE:/ 'Error'.
ELSE.
LOOP AT gt_edidc.
WRITE:/ gt_edidc-docnum.
ENDLOOP. "at gt_edidc
ENDIF.
ENDFORM. " distribute_idoc -
To use SubRoutines and function modules and include
Hellow Friends ,
Can any body suggest me at waht situations we have to use SubRoutines and function modules and include in an abap report and also i need the standards in an abap program.Hi Rajesh,
You use create subroutines within your programs for those block of codes which are used often within the scope of the development. Function modules are like global subroutines , hence any number programs which might want to use the functionality within the function module can do so.
Creating includes is a good programming prctise, e.g. one for data declerations , one for subroutines, so that it makes the code more reader friendly and also helps in modularizing the program. Also once you put a subroutine in an include, you can use the same subroutine in other programs by referring to the include with the INCLUDE statement in your other programs.
Hence basically they are used for :
1. Reusability
2. Modularization of code (make it more readable)
Hope this is of some help.
Regards,
Aditya -
Function Module for RSAP001 requires Type Pool
Hi
I am not an ABAP Freak:
I want to set up a Function Module for RSAP0001.
Setting Import and / or Tables Parameters give an Activation error:
Type pool SBIWA has not been declared
Message no. FL031
Diagnosis:
You used a type from type pool & in the interface of a function module.
Procedure:
For the program to be syntactically correct, you must
declare the type pool in the global data declaration of the
function group using the 'TYPE-POOLS: &.' statement.
Where do I find the global data declaration of the
function group ?
Thank You
Best Wishes
MartinHi Martin,
When you click on the function group you will find many includes declared in it.
Some of them will be Include L<fgrp>UXX and there will be one include,
INCLUDE L<fgrp>TOP, this is the include in which you will have to make declarations, and here you will have to declare type pool.
Simply goto transaction SE38 and the the program name as L<functionfroupname>TOP and you can directly change this include.
Regards,
Durgesh. -
Function module for Ship to details
Hi,
I am new to SRM and we are implementing SRM 4.0.
How do I get the SHIP TO - floor, building name, room number, etc if I pass the PO GUID or PO number? Is there any function module for the same?
Thanks and regards,
MickThanks Yann.
But the table CRMD_PARTNER does not contain the floor, room no, etc of the ship to party. In BBP_PD i think it is maintained in ADDR3_DATA.
But in the report that I am developing how do I map ADDR3_DATA with the PO GUID or PO number? Is there any function module that can give me the Ship to address including floor, room no, etc, if I pass the PO GUID or the PO number?
Regards,
Mick -
Functional module for automatic creation of pur requisition & pur order
hello,
what is the functional module for automatic creation of puchase requisition and automatic creation of purchase order which we will assign in action box in service order processing management.
please let me know as early as possible
regards,
rajesh kumar rajuHi,
Please check with following.
IDOC_INPUT_ACC_PURCHASE_REQUI
IDOC_INPUT_ACC_PURCHASE_ORDER
/ISDFPS/OR_PURCHASE_ORDER_CR
BS01_PURCHASE_DOCUMENT_CREATE
CO_MP_CREATE_PURCHASE_ORDER
Thanks & Regards
Sadhu Kishore
Maybe you are looking for
-
Can't figure out how to use home sharing
Since the latest couple iTunes updates, my family and I can not figure out how to use home sharing. Everyone in our household has their own iTunes, and for a long time we would just share our music through home sharing. But with the updates, so much
-
I currently run Solaris 2.5.1 on my SS5, does anyone think I will have problems running Solaris 8 on a SS5? Thanks! Matt
-
Wireless drop of Macbook Air (mid2012)
I have Macbook Air 13 inch- (mid 2012) with software OS X 10.8.4 (12E55) , i have problem with wireless connection which it drops always, i tried to install windows update 1.0 for (mid 2013) but it not work & gives me message that it isn't support on
-
EncodingStyle error in JWSDP 1.1 generated SOAP XML?
Hi, I ran wscompile to generate some stubs for a simple "fortune cookie" web service. I know this service works fine because I have tested it with clients using other toolkits. So the stubs are generated, I use them to call the service and it fails.
-
PSC 1315 faded stripes when printing after a cold start
Hello All, I have an HP PSC 1315 that is about three years old and was working fine until it recently started printing with faded greyish or white stripes across the page in grayscale printouts. This only happens immediately after a cold start, that