‎2006 Sep 19 4:37 AM
Hi,
i have a kind of req here...
I_ITEM has matnr,lgort etc.
I_ATPSTO has matnr and few other fields...
i have to loop at i_item and for each material no , there are many lgort field in i_ATPSTO so each time loop goes inside i_atpsto,i have to create a dynamic internal table and move the value correspondingly to that dynamic internal table....then for each of these values i need to pass parameter to FM MD_CONVERT_MATERIAL_UNIT and move the new exported value again to dynamic internal table....
how shall i go about this?
in short:
Loop I_ATP_STO where MATNR = I_ITEM-MATNR.
Move ATP Stock per storage location, I_ATP_STO-VMENG to I_OUTPUT-ATPSTO01 to I_OUTPUT-ATPSTOXX, where 01 to xx are storage location.
Call function MD_CONVERT_MATERIAL_UNIT and conver quantity. Move to I_OUTPUT-ATPSTOALT
Regards
Gunjan
‎2006 Sep 19 5:23 AM
Please check the code,it may help u.
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SYST'
CHANGING
ct_fieldcat = it_fcat[].
LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
MOVE-CORRESPONDING is_fcat TO is_fieldcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP.
Regards
‎2006 Sep 19 5:28 AM
hi
good
go through this link, which ll give your brief idea about the dynamic internal table.
http://www.sap-img.com/ab030.htm
/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
thanks
mrutyun^