Handle multiple material numbers as import parameter in a function module
Hello Folks,
I want to handle multiple material numbers as import parameters.. I have tried using table types but having problem while reading the data....
My requirement is user will input say 10 materials , now i need to get all the information for that particular material ..
I am unable to use for all entries as it is saying that it is not internal table... I have found table types which is having sigon , option, low and high fields but user doesn't want it... He wants to enter only materials... Currently am using this MD_T_MATNR(table type)
I am stuck up here..
Appreciate any kind of help.
Regards,
Raj
Hi,
it looks like you are on a good way, just something little is missing. Type MD_T_MATNR is suitable for your issue. I have tried it and probably your problem is that You have to use
SELECT ... FOR ALL ENTRIES IN it_matnr WHERE mara~matnr EQ it_matnr~table_line.
instead of
SELECT ... FOR ALL ENTRIES IN it_matnr WHERE mara~matnr EQ it_matnr~matnr.
In this example I suppose that a name of your variable of type MD_T_MATNR is it_matnr. Problem is that table line is not structure, but data element, therefore You have to use ~table_line instead of ~matnr.
Hope it helps.
Adrian
Similar Messages
-
Table type in import parameter in rfc function module
Hi we don't have the table type in our system which exist in the other system which is the import parameter of the rfc function module.so how can we pass the parameter. shell we create the same table type in our system also.it is a table type for a deep structure.
Hello,
I donot have access to CRM box I cannot view the FM. You can verify with the CRM counterpart what exactly is the TYPE for param DATA.
Else you can define a generic internal table (TYPE TABLE) & try calling the FM.
BR,
Suhas -
Pass multiple values as single input parameter into pipelined function
Hi all,
My need is to pass multiple values as single input parameter into pipelined function.
For example - "2" and "3" are values of input parameter "t":
with data as (
select 1 as t from dual union all
select 2 as t from dual union all
select 3 as t from dual union all
select 4 as t from dual union all
select 5 as t from dual
select * from data where t in (2,3)Is it possible at all?Not exactly sure, but usually 'multiple values'+'pipelined function' = some IN-LIST related approach?
See:
SQL> create table data as
2 select 1 as t from dual union all
3 select 2 as t from dual union all
4 select 3 as t from dual union all
5 select 4 as t from dual union all
6 select 5 as t from dual;
Table created.
SQL> --
SQL> CREATE OR REPLACE FUNCTION in_list (p_in_list IN VARCHAR2)
2 RETURN sys.odcivarchar2list PIPELINED
3 AS
4 l_text VARCHAR2(32767) := p_in_list || ',';
5 l_idx NUMBER;
6 BEGIN
7 LOOP
8 l_idx := INSTR(l_text, ',');
9 EXIT WHEN NVL(l_idx, 0) = 0;
10 PIPE ROW (TRIM(SUBSTR(l_text, 1, l_idx - 1)));
11 l_text := SUBSTR(l_text, l_idx + 1);
12 END LOOP;
13
14 RETURN;
15 END;
16 /
Function created.
SQL> --
SQL> select *
2 from data
3 where t in ( select *
4 from table(in_list('1,2'))
5 );
T
1
2
2 rows selected.http://www.oracle-base.com/articles/misc/dynamic-in-lists.php
or
http://tkyte.blogspot.nl/2006/06/varying-in-lists.html -
Is it necessary to pass RETURN parameter in bapi function module
Hai All,
Is it necessary to pass structure to RETURN parameter in bapi_transaction_rollback function module. If it is not necessary then how can it gives return value. Please give me the answer for this one. some sample code below...
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN = i_return.
LOOP AT i_return into wa_return WHERE type EQ c_error.
wa1_out-postdoc = wa_return-message.
ENDLOOP.
Thanks & Regards.
Laxman.Phi
bapi should never throw an error as it might be called for mass data proceessing
and it is prefferred not to hault the proceess bcoz of one or two errors.
that's why the error or success messages are caught and returned in return table.
in bapi_transaction_rollback the return parameter is not necessary as it will work without that as well.
the purpose of rollback bapi is just to undo whatever done before that.
regards
vijay
<b>reward points if helpful</b>
Message was edited by:
vijay sharma -
Passing Message number as an parameter in a Function module
Hi all,
I have to pass the Message number(sy-msgno) as an parameter into an function module
and that Message should be like "PO NUMBER ####### is deleted"
This Funtion module is an loop and PO number changes for every loop
How to define this Message in the Message class.
Regards
AjayHi,
Message definition SE91 should be like below.
PO NUMBER & is deleted.
Here & is the place holder where u can pass one value dynamically. If u want to pass 2 dynamic values then u have to use 2 place holder and so on.
eg: PO NUMBER & is deleted by user &.
When u call this message it will display like
PO NUMBER 12345 is deleted by user user1.
Thanks,
vinod. -
Multiple Material Numbers to use one Info Record
I have several material numbers that I have recently set up as Subcontracting special procurement. All of these numbers use one quote from our vendor. How do I assign multiple numbers to a single info record?
Thanks for your assistance!!SAP knows 2 kind of subcontracting scenarios, a purchasing route and a production route.
in the purchasing subcontract scenario you order the finished material with item category L, you can see the components in the purchase order and you consume the components when you post the goods receipt to this purchase order.
in the production route, you create production orders to "manufacture" the finished and to consume the components, the purchase order is only to procure the service. you do goods receipt and cosumption in reference to the production order, and you do a goods receipt for the service in reference to the purchase order.
if the info record is without material number,then you cannot have a permanent link to a material if you use the purchasing route.
Usually SAP will propose the info record as source when you assign and process requisitions in ME57. I doupt that SAP will propose info records without material number for requisition with material number. so the only chance to assign such info record to a PO to get the price defaulted would be manual entry of info record number in ME21N (F4 search help is available)
in the production subcontracting process you can enter the info record number in the recipe, so you can establish a permanent link in master data. So SAP exactly knows which info record price to pull for the service orders. and in this process you can enter one info record number in several recipes. -
Bapi for mrp wfich has material quantity as import parameter
hi to all,
i need a bapi for mpr run which has material quantity as import paramaeter so that we can create pr for given material quantity.
Regards,
Manoj Rwat.HI!
Try,
MD_MRP_SINGLE_MAT_REPLAN
BAPI_ALM_ORDER_MAINTAIN
hope this will helps you.
regards,
Kiran -
Mail sending using sender importing parameter using so_object_send function
Hi all,
I using so_object_send function module to send mail. My requirement is with respect to any user
logged in the sender mail address should be taken by V_SENDER parameter in exporting
parameter.
<code>
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = wa_folder_id
forwarder = w_forwarder
object_fl_change = wa_object_fl_change
object_hd_change = wa_object_hd_change
object_id = wa_object_id
object_type = w_object_type
outbox_flag = w_outbox_flag
owner = w_owner
store_flag = w_store_flag
IMPORTING
object_id_new = wa_object_id_new
sent_to_all = w_sent_to_all
sender = v_sender
TABLES
objcont = i_objcont
objhead = i_objhead
objpara = i_objpara
objparb = i_objparb
receivers = i_receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
OTHERS = 22.
IF sy-subrc 0.
ENDIF.
</code>
My Requirement is V_SENDER can be any user of that SAP system,noot particularly logged in user.
I tried using this functionality my sy-subrc is zero. but i am not able to get any mails with that user name in V_SENDER.
Do i need to do any further settings or any more code is required.
Even i tired giving SUBMIT rsconn01 .
still its not working.
Please suggest any solutions if we have.
Thanks,
satishHi,
to send mails check this:
FORM docu_send_email USING pv_otfdata TYPE tsfotf
pv_emailid TYPE any
pv_formname TYPE any.
DATA: lv_filesize TYPE i,
lv_buffer TYPE string,
lv_attachment TYPE i,
lv_testo TYPE i.
DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
li_mess_att TYPE STANDARD TABLE OF solisti1,
li_mtab_pdf TYPE STANDARD TABLE OF tline,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objtxt TYPE STANDARD TABLE OF solisti1,
li_objbin TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objhead TYPE soli_tab.
DATA: lwa_pdfdata TYPE tline,
lwa_objpack TYPE sopcklsti1,
lwa_mess_att TYPE solisti1,
lwa_objtxt TYPE solisti1,
lwa_objbin TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_doc_chng TYPE sodocchgi1.
CONSTANTS: lc_u TYPE char1 VALUE 'U',
lc_0 TYPE char1 VALUE '0',
lc_1 TYPE char1 VALUE '1',
lc_pdf TYPE char3 VALUE 'PDF',
lc_raw TYPE char3 VALUE 'RAW',
lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = lc_pdf
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = pv_otfdata
lines = li_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 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.
LOOP AT li_pdfdata INTO lwa_pdfdata.
TRANSLATE lwa_pdfdata USING ' ~'.
CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
CLEAR lwa_pdfdata.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.
DO.
lwa_mess_att = lv_buffer.
APPEND lwa_mess_att TO li_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Object with PDF.
REFRESH li_objbin.
li_objbin] = li_mess_att[.
DESCRIBE TABLE li_objbin LINES lv_attachment.
Object with main text of the mail.
lwa_objtxt = space.
APPEND lwa_objtxt TO li_objtxt.
CLEAR lwa_objtxt.
DESCRIBE TABLE li_objtxt LINES lv_testo.
Create the document which is to be sent
lwa_doc_chng-obj_name = text-008.
lwa_doc_chng-obj_descr = text-008.
lwa_doc_chng-sensitivty = lc_0.
lwa_doc_chng-obj_prio = lc_1.
lwa_doc_chng-doc_size = lv_testo * 225.
Pack to main body.
CLEAR lwa_objpack-transf_bin.
header
lwa_objpack-head_start = 1.
The document needs no header (head_num = 0)
lwa_objpack-head_num = 0.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_testo.
lwa_objpack-doc_type = lc_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
Create the attachment.
Fill the fields of the packing_list for the attachment:
lwa_objpack-transf_bin = gc_x .
header
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_attachment.
lwa_objpack-doc_type = lc_pdf.
lwa_objpack-obj_name = lc_attachment.
lwa_objpack-obj_descr = text-008.
lwa_objpack-doc_size = lv_attachment * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
lwa_reclist-receiver = pv_emailid.
lwa_reclist-rec_type = lc_u.
lwa_reclist-notif_del = gc_x.
lwa_reclist-notif_ndel = gc_x.
APPEND lwa_reclist TO li_reclist.
IF li_reclist IS NOT INITIAL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = gc_x
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_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 sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " DOCU_SEND_EMAIL -
How to import a range in Function module?
I am using a Function module in which material is getting imported.
In the import tab we have
Parameter Name Typing Associated Type optional pass value
IM_MATERIAL TYPE MATNR <checked> <checked>
So when the Function module is execute we can enter only one value into the IM_MATERIAL.
But now it has to be enhanced for entering multiple values. How to import the material as a range?
Please throw light.
Thanks.Hi
If you are using a select-options you can use this approach.
TABLES: MARA.
DATA: RANGE TYPE WRF_MATNR_RANG_TTY.
SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR.
START-OF-SELECTION.
RANGE[] = SO_MATNR[].
CALL FUNCTION 'ZTEST'
EXPORTING
I_RANGE = RANGE.
Where I_RANGE is defined using this table type WRF_MATNR_RANG_TTY
Parameter Name Typing Associated Type optional pass value
I_RANGE TYPE WRF_MATNR_RANG_TTY <checked> <checked> -
"Changing" parameter and "Tables" parameter defintions in function module
If one defines "Changing" or "tables" parameters, they are treated as reference parameters.
It becomes obvious for "tables" parameters where one does not have option to check box for "Pass by Value". But for "Changing" parameters, they provide the checkbox for "Pass by Value". Even when you select this option, the function module seems to handle the parameter as a reference parameter (whatever changes you make to it in the function module are retained when you return back to a calling program).
My question is why then SAP has provided the checkbox of "Pass by Value" for "Changing" parameter?
Thanks.
Jitendra MehtaHi Chaiphon:
Thanks for explanation but I know the theory of "Pass by reference" versus "Pass by Value".
Let me rephrase my question.
When I use the importing parameter (say as a table with a dictionary table type) with reference (not "passing by value"), and if I modify the value of the parameter, the calling program (which calls function module) receives the changed value after the call.
When I use the importing parameter with "Pass by Value" box checked, the modifications made to the table inside the function module is not retained after the code leaves function module and returns to the calling program.
My question is why not the same behaviour with the "Changing parameter" in function module definition?
And if Changing parameters are always reference parameters, then why SAP has provided the "Pass by Value" check box? -
Error while creating import parameters in RFC function module
Hi,
I am trying to create import parameter in RFC enabled function module and getting the following error "Reference parameters are not allowed with RFC". Am I doing something wrong.
Your earlier response is much appreciated
Regards
KasiThere is a "Pass by Value" checkbox, just check that and you wont get the error. The basic reason behind is since an RFC is called by a different system the parameters have to be sent as values than as references.
hith
Sunil Achyut -
How to default a longer value in import parameters of a function module?
I have to default a file name of some 50 characters in the file_name import parameter (RPGRAP-FILENAME) of a custom fucntion module.
I tried to set it under "Default Value" but it is taking some 15 or so charaters.
So.. how to do this?
Thanks
VenYou just closed a number of your older threads. Please remember that there is no need to add a comment if there is nothing new to add. It just brings old posts to the top.
And in addition to marking them as closed, you could assign po1nts to those who tried to help. It encourages people to answer.
Rob -
Get Import Parameters of a Function Module
Hi,
Is there a way to find the import parameters and their Data Type of a Function Module in any Table??
For example, i know i can find the name and the include of the Funtion Module in TFDIR. Is there anywhere i can find the list of Import Parameters and their Data Types??
Thanks and Regards,
Kaeyuryou can use
Data: lv_type type c.
clear:lv_type.
DESCRIBE FIELD p_bukrs TYPE lv_type.
It will return C as its type C and p_bukrs is selection screen parameter.
hope this helps. -
Passing the parameter in the Function module MESSAGE_SEND_AS_MAIL
Hi all,
I have to send the same message to five different mail ID's using the Function module MESSAGE_SEND_AS_MAIL
How to pass this five mail ID's in the Parameter Reciever of the Function module
Regards
Ajaysee if this helps
REPORT Z_MESSAGE.
data receiv type standard table of SOMLRECI1 initial size 0.
data wa type SOMLRECI1.
wa-receiver = 'email address in caps'.
wa-REC_TYPE = 'U'.
append wa to receiv.
wa-receiver = 'email address in caps'.
wa-REC_TYPE = 'U'.
append wa to receiv.
do so more more three
CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'
EXPORTING
msgid = 'Z_ZZZ_CA_MESSAGES'
msgno = '000'
MSGV1 = 'material'
MSGV2 = 'MAT'
MSGV3 = 'MM'
MSGV4 = 'MMM'
tables
receivers = receiv[]
COMMIT WORK AND WAIT.
then u can go to SOST transaction and see that the mail has been or is yet to be sent. It worked for me. The message comes in an PDF form to the mail box.
Edited by: Biswadeep Ghosh on Jun 25, 2008 2:28 PM
Edited by: Biswadeep Ghosh on Jun 25, 2008 2:30 PM -
HOW TO PASS SELECT-OPTIONS PARAMETER TO A FUNCTION MODULE.
Hi friends.
HOW DO U PASS A SELECT-OPTIONS PARAMTER TO A FUNCTION MODULE AS ITS IMPORT PARAMETER(IN MY CASE rfc fM) .
Really urgent!!!
thanks to one and allHi,
If you are passing a single value, its better you take it from s_option-low or s_option-high (select options).
Else if you are passing values to the FM in a loop for all select option values, then better you declare an internal table with type <b>WSELKUNNR</b>.
get low & high fields from each row & pass them.
It will make you clear when you check out your select options in debug mode by entering different combinations of inputs.
Maybe you are looking for
-
How to use the same variable value for data entry and the planning sequence
Hi, the scenario is the following: Using the WAD template a user enters cost center plan data. The cost center is selected by the chosen value for the variable "V1". Afterwards he shall push a button which starts a planning sequence (including saving
-
Excel report and automatic format via VBA
Hello, I made a report in MSY and created a Makro to format the Excel Sheet (the relevant data is copyied to another Workbook). Now I tried to run this Makro on startup so the user has no need to do this manually. This was done by the Workbook_Open()
-
ITunes block unmount on MBP with lion
Hello, I have some trouble with my MBP using Lion and itunes. Since 5 weeks I can not shut down my MBP when I run itunes with my mediathek. To get a better piction of the problem, I tried to isolate the issue. - I have tested the mediathek using my a
-
VideoPhoneLabs example not working
Dear dev-team, could you also give more information about why the example-application (VideoPhoneLabs.swf) does not work, when I upload all the assets (not reg.cgi, while I want to use the Stratus-service) to a server ( http://work.joeyvandijk.nl/str
-
Setting Attachment limits for incoming & outgoing messages
In the Netscape console for the Iplanet Messaging Server 5.1 there is an option under HTTP for maximum size limit for outgoing attachments. I would like to set a size limit for all incoming and outgoing messages to 4096 KB (4 MB). These would include