Posted: Sun Dec 16, 2007 6:53 pm Post subject: Finding Where the material is used.
Code:
TABLES : marc.
TYPE-POOLS : slis.
DATA: BEGIN OF g_t_final OCCURS 0,
werks LIKE marc-werks,
matnr LIKE marc-matnr,
comp LIKE marc-matnr,
level LIKE stpov-level,
END OF g_t_final.
DATA : g_t_fieldcat TYPE slis_t_fieldcat_alv.
DATA : g_t_marc LIKE marc OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-000.
PARAMETERS : p_werks LIKE marc-werks.
SELECT-OPTIONS : s_matnr FOR marc-matnr.
SELECTION-SCREEN END OF BLOCK blk1.
*&---------------------------------------------------------------------*
*& Form get_ss_components
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
<-- p2 text
*----------------------------------------------------------------------*
FORM get_ss_components.
SELECT * FROM marc INTO TABLE g_t_marc WHERE matnr IN s_matnr
AND werks = p_werks.
ENDFORM. " get_ss_components
*&---------------------------------------------------------------------*
*& Form search_components
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
<-- p2 text
*----------------------------------------------------------------------*
FORM search_components.
DATA : l_t_marc LIKE marc OCCURS 0 WITH HEADER LINE,
l_t_final LIKE g_t_final OCCURS 0 WITH HEADER LINE.
DATA : l_t_wultb LIKE stpov OCCURS 0 WITH HEADER LINE,
l_t_equicat LIKE cscequi OCCURS 0 WITH HEADER LINE,
l_t_kndcat LIKE cscknd OCCURS 0 WITH HEADER LINE,
l_t_matcat LIKE cscmat OCCURS 0 WITH HEADER LINE,
l_t_stdcat LIKE cscstd OCCURS 0 WITH HEADER LINE,
l_t_tplcat LIKE csctpl OCCURS 0 WITH HEADER LINE.
DATA : l_f_matnr LIKE mara-matnr,
l_f_num TYPE i VALUE '0'.
l_t_marc[] = g_t_marc[].
CLEAR g_t_marc.
REFRESH g_t_marc[].
DO.
l_f_num = l_f_num + 1.
LOOP AT l_t_marc.
IF l_f_num = 1.
l_f_matnr = l_t_marc-matnr.
ENDIF.
ENDDO.
ENDFORM. " search_components
*&---------------------------------------------------------------------*
*& Form display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
<-- p2 text
*----------------------------------------------------------------------*
FORM display.
DATA : l_t_fieldcat TYPE slis_t_fieldcat_alv,
l_r_fieldcat LIKE LINE OF l_t_fieldcat,
l_f_repid LIKE sy-repid,
l_r_layout TYPE slis_layout_alv.
IF g_t_final[] IS INITIAL.
MESSAGE i000(vz) WITH 'No data found'.
EXIT.
ELSE.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.