SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

FAQ



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> PP
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Tue Sep 18, 2007 11:04 am    Post subject: FAQ Reply with quote

PP tables

Production Planning

Thanks to Tymon Kerste for the PP table info. Thanks to Tymon Kerste for the PP table info.
MAST Material BOM
STKO BOM Header
STPO BOM Positions (detail)
MAPL Assignment fo Task Lists to Materials
PLKO Routing Group Header
PLSO Routing Group Sequence
PLPO Routing Group Operations
AFKO Production Order Header
AFPO Production Order Position (details)
AUFK Order master data

MRP Function Modules

CS_BOM_EXPLOSION_MAT - BOM explosion for material old version (before 3.0)

CS_BOM_EXPL_MAT_V2 - Explode BOM for Production.
Mostly necessary input parameters:
CAPID (Application Id): 'PP01' (Production - general)
DATUV (Validity date)
MTNRV (Material)
WERKS (Plant)
Example: Explode assembly (including phantom assemblies up to last level)
Code:

report z.
* Explode assembly (including phantom assemblies up to last level)

parameters: p_werks like t001w-werks obligatory,
p_matnr like mara-matnr obligatory.

constants c_x value 'X'.

data: begin of it_comp occurs 0,
idnrk like stpox-idnrk,
ojtxp like stpox-ojtxp,
menge like stpox-menge,
meins like stpox-meins,
matkl like stpox-matmk,
end of it_comp.

data: w_topmat like cstmat,

*******************
start-of-selection.
*******************
perform explode_assembly.

*****************
end-of-selection.
*****************
perform write_report.

************
top-of-page.
************
perform print_header.


*&---------------------------------------------------------------------*
form print_header.
write: /(18) 'Component'(h00),
(40) 'Description'(h01),
'Mat.Group'(h02),
(18) 'Quantity'(h03).
uline.
endform.

*&---------------------------------------------------------------------*
form write_report.
write: / w_topmat-matnr under text-h00 color col_heading,
w_topmat-maktx under text-h01 color col_heading.
loop at it_comp.
write: /
it_comp-idnrk under text-h00,
it_comp-ojtxp under text-h01,
it_comp-matkl under text-h02,
it_comp-menge unit it_comp-meins under text-h03,
it_comp-meins.
endloop.
uline.
endform.

*&---------------------------------------------------------------------*
form explode_assembly.
data: it_stb like stpox occurs 0 with header line,
it_stb2 like stpox occurs 0 with header line,
it_stb3 like stpox occurs 0 with header line,
w_msg(255) type c.

* Explode highest level:
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
mtnrv = p_matnr
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
exit.
endif.

* Don't process documents
delete it_stb where idnrk is initial.

* Don't process valid from furure:
delete it_stb where datuv >= sy-datum.

* Explode phantom assemblies up to last level
do.
it_stb2[] = it_stb[].
delete it_stb2 where dumps is initial.
if it_stb2[] is initial.
exit.
endif.

delete it_stb where not dumps is initial.

loop at it_stb2.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
mtnrv = it_stb2-idnrk
werks = p_werks
tables
stb = it_stb3
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
else.
delete it_stb3 where idnrk is initial.
loop at it_stb3.
multiply it_stb3-menge by it_stb2-menge.
modify it_stb3 transporting menge.
endloop.
append lines of it_stb3 to it_stb.
endif.

endloop.
enddo.

* Build table of components collecting the same components from
* all levels
loop at it_stb.
it_comp-matkl = it_stb-matmk.
it_comp-idnrk = it_stb-idnrk.
it_comp-ojtxp = it_stb-ojtxp.
it_comp-menge = it_stb-menge.
it_comp-meins = it_stb-meins.

collect it_comp.
clear it_comp.
endloop.

endform.


CS_BOM_EXPL_KND_V1 - Explode BOM for Sales and Distribution.
Additional input parameters:
CAPID (Application Id): 'SD01' (Sales and Distribution)
VBELN (Sales order number)
VBPOS (Item in sales order)

CS_BOM_EXPLOSION - General BOM explosion
Internal function module, called by all FMs from function group CSS4 (for material as well as for equipment, Project Position, Document etc.)

CS_WHERE_USED_MAT - BOMs: where-used list returns BOM##, parent materials and other information for component. Additional criterias: valid dates, item category and BOM usage, plant (can be '*' to select all plants).

CS_WHERE_USED_MAT_VIA_CLA - Bills of material; where-used list via classes

CS_WHERE_USED_MAT_ANY - Bills of material; where-used list as material or class item
In SAP 4.6C this function group is used in report RCS15001 (Material Where-Used List), which called from transaction CS15 (Single-Level Where-Used List)

CSEP_MAT_BOM_SELECT_WHERE_USED - API Bills of Material: Select BOM(s)
New and simplified function module. Input: only component name (material number). Return the same as function modules above.

DOCUMENTS_TO_CHANGE_NUMBER - Documents for Change Number
Returns internal table within materials and documents for the engineering change number AENR-AENNR (just select * from the DRAW table).

DOCUMENTS_CHANGE_NUMBER_USAGE - Check use of change number for documents
Raises NO_USAGE if not used. Calls DOCUMENTS_TO_CHANGE_NUMBER to check usage

DISPOBELEG_LESEN - Read MRP Table data.
Input: MRP Table # and Aggregated MRP list flag (MDKP-DTNUM and MDKP-CFLAG).
Output: MRP Table data (~ MDTB data)

CSAP_MAT_BOM_READ - You can use this function module to display simple material BOMs. You cannot display BOM groups (for example, all variants of a variant BOM). as in transaction CS03. Current restrictions: You cannot display long texts. You cannot display sub-items. You cannot display classification data of BOM items for batches. You can only display one alternative or variant. You cannot enter an alternative for module CSAP_MAT_BOM_READ, so you always see alternative 01. The following example came from a posting on the SAP-R3-L mailing list.
Code:

data: begin of tstk2 occurs 0.
          include structure stko_api02.
data: end of tstk2.
data: begin of tstp2 occurs 0.
          include structure stpo_api02.
data: end of tstp2.
data: begin of tdep_data occurs 0.
         include structure csdep_data.
data: end of tdep_data.
data: begin of tdep_descr occurs 0.
         include structure csdep_descr.
data: end of tdep_descr.
data: begin of tdep_source occurs 0.
         include structure csdep_source.
data: end of tdep_source.
data: begin of tdep_order occurs 0.
         include structure csdep_order.
data: end of tdep_order.
data: begin of tdep_doc occurs 0.
         include structure csdep_doc.
data: end of tdep_doc.
data: flg_warning like capiflag-flwarning.
   call function 'CSAP_MAT_BOM_READ'
        exporting
             material   = 'MAT100'
             plant      = '0001'
             bom_usage  = '1'
             valid_from = '20.12.1996'
*            valid_to
        importing
             fl_warning = flg_warning
        tables
             t_stko       = tstk2
             t_stpo       = tstp2
             t_dep_data   = tdep_data
             t_dep_descr  = tdep_descr
             t_dep_source = tdep_source
             t_dep_order  = tdep_order
             t_dep_doc    = tdep_doc
        exceptions
             error      = 1.


CSAI_BOM_CREATE - create the Equipment BOM

Code:
CLEAR wa_csin.
* wa_csin-aennr = '009900159470'.
wa_csin-datuv = sy-datum.
wa_csin-equnr = '000000000000300245'.
wa_csin-stlan = 'T'.
wa_csin-stlty = 'E'.

CLEAR wa_stkob.
wa_stkob-stlty = 'E'.

CLEAR wa_stzub.
wa_stzub-stlty = 'E'.

CLEAR wa_stpob.
wa_stpob-stlty = 'E'.
wa_stpob-postp = 'T'.
wa_stpob-posnr = '0010'.
wa_stpob-menge = 1.
wa_stpob-potx1 = '------------------------------------'.
wa_stpob-datuv = sy-datum.
APPEND wa_stpob TO tab_stpob.
CLEAR wa_stpob.

wa_stpob-stlty = 'E'.
wa_stpob-postp = 'T'.
wa_stpob-posnr = '0020'.
wa_stpob-menge = '1'.
wa_stpob-potx1 = '001 level: Sharat Test 23X27X38'.
wa_stpob-datuv = sy-datum.
APPEND wa_stpob TO tab_stpob.
CLEAR wa_stpob.

wa_stpob-stlty = 'E'.
wa_stpob-postp = 'T'.
wa_stpob-posnr = '0030'.
wa_stpob-menge = '1'.
wa_stpob-potx1 = '------------------------------------'.
wa_stpob-datuv = sy-datum.
APPEND wa_stpob TO tab_stpob.
CLEAR wa_stpob.

wa_stpob-stlty = 'E'.
wa_stpob-idnrk = '0814MSD-14-05'.
wa_stpob-postp = 'L'.
wa_stpob-posnr = '0090'.
wa_stpob-menge = '1'.
wa_stpob-datuv = sy-datum.
APPEND wa_stpob TO tab_stpob.
CLEAR wa_stpob.

wa_stpob-stlty = 'E'.
wa_stpob-idnrk = '0814MSD-14-01'.
wa_stpob-postp = 'L'.
wa_stpob-posnr = '0140'.
wa_stpob-menge = '1'.
wa_stpob-datuv = sy-datum.
APPEND wa_stpob TO tab_stpob.
CLEAR wa_stpob.

CALL FUNCTION 'CSAI_BOM_CREATE'
  EXPORTING
    ecsin = wa_csin
    estkob = wa_stkob
    estzub = wa_stzub
* FL_NO_CHANGE_DOC = ' '
* FL_COMMIT_AND_WAIT = ' '
* FL_NO_COMMIT_WORK = ' '
* FL_ALE = ' '
* fl_default_values = 'X'
  IMPORTING
    fl_warning = g_flwarning
    astlnr = g_warn_stlnr
  TABLES
    t_stpob = tab_stpob
  EXCEPTIONS
    error = 1
    OTHERS = 2.

IF sy-subrc 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> PP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.