on 2015 May 07 3:54 AM
Gurus, i need help with CMOD. i am working with 2LIS_02_SRV datasource and have to call a function module. now the issue is the program is working fine when i hard code EBELN number but this is temporary. when my datasource will run it will send a lot of EBELN numbers. what do i put in EXPORTING parameter of the function module? I tried to put C_T_DATA-EBELN but it is empty. i need to know how to dynamically pass EBELN. can some body please help me ?
Thanks.
Thank you everyone. i was able to get the code working but the issue is that it is very slow. I think this is due to calling 2 loops? is there a way to fix the performance of this code please? it is producing correct results but it is just too slow and I am not even using REFRESH or CLEAR my internal tables.
DATA: l_s_mc11va0itm LIKE mc11va0itm,
it_mc11va0itm TYPE mc11va0itm OCCURS 0.
DATA: l_tabix LIKE sy-tabix.
LOOP AT C_T_DATA INTO l_s_mc11va0itm.
l_tabix = sy-tabix.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = '0002'
language = 'E'
name = l_s_mc11va0itm-VBELN
object = 'VBBP'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_lines1
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT it_lines1 INTO wa_t_it_lines.
IF sy-subrc = 0.
l_s_mc11va0itm-FIELD1 = wa_t_it_lines-FIELD1.
ENDIF.
ENDLOOP.
MODIFY c_t_data FROM l_s_mc11va0itm INDEX l_tabix.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello and thank you again everybody. see i tried to do some changes by using field symbols in the code but performance is still very very bad.
FIELD-SYMBOLS <f1_data> TYPE mc11va0itm.
LOOP AT c_t_data ASSIGNING <f1_data>.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = '0002'
language = 'E'
name = <f1_data>-VBELN
object = 'VBBP'
TABLES
lines = it_lines1
LOOP AT it_lines1 ASSIGNING <f2_data2> from 1 to 1.
<f1_data>-Field1 = <f2_data2>-Field1.
ENDLOOP.
Please help.
Thanks.
Sorry, that is not quite right. LOOP AT and READ are two very different statements with very different functionalities and behaviour, they cannot be substituted with each other without changing the logic of the program. There is a very small subset of LOOP scenarios that can be reliably replaced by READ. Therefore there are many scenarios where nested loops are unavoidable.
@Sunil, The READ_TEXT FM is probably the reason for the poor performance, as it is reading one for every Sales Ord - so if you have 10000 Sales Orders, this FM will run 10000 times.
See this article for an explanation on how to replace READ_TEXT with code that will pick up the texts at once for several sales orders.
Hi,
Your coding should be processed in the context of a loop over the data package. It should look like this:
field-symbols:
<data> type mc02m_0srv.
loop at c_t_data assigning <data>.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = '0002'
language = 'E'
name = <data>ebeln "<<< changed
object = 'VBBP'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_lines1[]
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
if sy-subrc = 0.
">>> do here want you need to do <<<
endif.
endloop.
Best regards,
Sander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is my code.
DATA: l_s_mc11va0itm LIKE mc11va0itm,
it_mc11va0itm TYPE mc11va0itm OCCURS 0.
DATA: l_tabix LIKE sy-tabix.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = '0002'
language = 'E'
name = This is where I want to pass 'vbeln' dynamically but do not know how. if i put C_T_DATA-VBELN, no errors but in debugging it's empty so nothing gets passed.
object = 'VBBP'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = it_lines1[]
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
As Suhas said, please post the code you are currently using..
Regards,
Loed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please post your current code and explain what you are trying to achieve. Currently it is not very clear.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.