08-31-2006 10:28 AM
Hi!
can anybody help me on how to pass values from screen(qmo2) to custom function module. I appreciate if u can provide some source code....
08-31-2006 10:30 AM
08-31-2006 10:36 AM
08-31-2006 10:38 AM
For passing screen values to a custom program use the concept of "Parameter ID" that is SAP memory concept.
Check the parameter id (when you press F1 on the particular field in QM01 and go to the technical info. you can view the parameter id ex: for Notification Number in QM01 is "IQM").
In the "Z" program get the values as
Data F type QMNUM. ~--
GET PARAMETER ID 'IDQM' FIELD f.
Now f will contain the value of the screen field.
- Raj
08-31-2006 10:42 AM
Thanks Raj..
Once getting value in the memory . Do i have to use assign to actually assign it to function module parameters or what...
08-31-2006 10:48 AM
Using Assign statement also you can get the info. The code beow is similar code to retrive screen field values to a Z program.
Data: V_COLL(85) value '(SAPLIQS0)VIQMEL-QMNUM',
p_value like VIQMEL-QMNUM.
FIELD-SYMBOLS: <FS_COLLECT> TYPE ANY.
ASSIGN (V_COLL) TO <FS_COLLECT>.
p_value = <FS_COLLECT>.
Now p_value will have all the screen field value.
- Raj
08-31-2006 10:51 AM
Declare all the IMPORT parameters which you need, But declare them as optional.
After that USe the "Parameter id" concept or the "Assign" i.e field symbol cocept to retrive the values. after that You can assign the values to your IMPORT parameters.
- Raj
08-31-2006 10:57 AM
hi Raj
Actually i all values from(qm02) which are mandatory to create sales order using BAPI_SALESORDER_CREATEFROMDAT2 because i am developing a function module to call BAPI which will create credit memo request usign above said BAPI
08-31-2006 11:20 AM
Hi,
Use any of the above two procedures which i have specified and you can solve the issues.
- Raj
08-31-2006 12:56 PM
Hi Raj
can u explain me this statement
Data: V_COLL(85) value '(SAPLIQS0)VIQMEL-QMNUM',
p_value like VIQMEL-QMNUM.
FIELD-SYMBOLS: <FS_COLLECT> TYPE ANY.
ASSIGN (V_COLL) TO <FS_COLLECT>.
p_value = <FS_COLLECT>.
Now p_value will have all the screen field value.
08-31-2006 2:30 PM
hi,
First you declare a field-symbol of any type.
this field-symbol can take the value dynamically.
when you say "ASSIGN (V_COLL) TO <FS_COLLECT>" it means what ever is the value of v_coll it will get into the field-symbol <fs_collect>. Now you take get the value of this field in a field p_value.
ex.
data : p_value type char4.
v_coll = 'itab-BUKRS'.
FIELD-SYMBOLS: <FS_COLLECT> TYPE ANY.
ASSIGN (V_COLL) TO <FS_COLLECT>.
p_value = <FS_COLLECT>.
*if itab-bukrs value is '0001', p_value will have this value.
v_coll = 'itab-BSART'.
ASSIGN (V_COLL) TO <FS_COLLECT>.
p_value = <FS_COLLECT>.
*if itab-bsart value is 'abcd', p_value will have this value.
so you can write this in loop .
field-symbols <fs1>.
loop at t_dd03l.
clear v_name.
move t_dd03l-fieldname to v_name.
assign (v_name) to <fs1>.
concatenate rstring <fs1> into rstring separated by '~'.
endif.
endloop.
From help
ASSIGN (V_COLL) TO <FS_COLLECT>.
This statement assigns the memory area specified using mem_area to the field symbol <fs>. You can assign a data object or a memory area calculated from the address of a data object. After the assignment, the field symbol refers to the assigned memory area and can be used in operand positions. When used in a statement, it behaves like a dereferenced data reference, meaning that the statement works with the content of the memory area.
Hope this helps.
Regards,
Richa
08-31-2006 10:51 AM
Hi,
In transaction Qm02 get memory id related to all
fields with f1 help on transaction screen to get
memory id.
set memory id 'MAT' fields lv_matnr.
call function 'TEST'
matnr = lv_matnr.
Regards,
Amole