Wednesday, September 26, 2012

MM Class characteristics

About TEXT_ID
----------------------------
Text ID details stored in table: TTXID
TTXID: Definition of Text IDs  
This control table contains all text IDs supported by SAPscript. Text IDs are always allocated to a text object.
The key of this table thus consists of the text object and a four-digit text ID. You can use the SAPscript
function modules only to process texts whose IDs are stored in this table. The table is client-independent.
To maintain the table, call transaction SE75 by choosing Tools > Word processing > Settings.
Text actual storage location is:
STXH - header
STXL - details.
if you want to read the texts you can use FM READ_TEXT
Any Application Header and tem Long texts are stored in STXH table with the 4 parameters OBJECT,ID,NAME and LANG
These texts are fetched from databse using READ_TEXT fun module by passing the above 4 parameters.
Double click on the text, from the text editor menu GOTO-> HEDAER
you will find the all above 4 paramters
so accordingly you have to pass to the fun module READ_TEXT to fetch the texts.
-----------------------------------------------------
CMOD to create a new enhancement

SMOD to test an old enhancement

MM classtype characteristic change specific enhancement CLFM0001/CLFM0002

CL03*: classtype characteristics maintenance

MM02: Material class modification

enhancement: ZXCLFU02 -status 'H' for modified New row, Status 'L' for old value.

If new value is blank, there will be no row with H, If previous characteristic value was blank then there will be no L row but H row.

T_ALLAUSP: characterisitc Table

T_ALLKSSK: classtype table.

If there is any change done by programmer in T_ALLAUSP must make E_ACTIVE flag true.

Logic to find class for a characteristic:

t_allausp-atinn = gt_cabn-atinn > gt_objectdata-atnam = gt_cabn-atnam > gt_class-class can be found at Index gt_objectdata-tabix.

Respective tables and there use:

AUSP contains all the characteristcs details for a material

CABN: contain list of characteristcs

CAWN: contains list of characteristics multiple value

KSSK: Allocation Table: Object to Class (Class assigned to a material)

Where to get object key for class

SELECT SINGLE cuobj FROM inob INTO gv_cuobj WHERE klart = 'Z01' AND obtab = c_mara AND objek = i_rmclf-objek.

objek = 18 digit material + 10 digit batch
 Put cuobj from above in AUSP to get material characteristic.


FM used:

FUNCTION 'POPUP_TO_CONFIRM'

gv_objkey = i_rmclf-objek. "'000000000000000855'.
EXPORT gv_objkey TO MEMORY ID c_memid.
IMPORT gv_objkey FROM MEMORY ID c_memid.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = gv_objkey
objecttable = c_mara
classnum = ls_rdetails-classname
classtype = ls_rdetails-classtype
keydate = sy-datum
language = sy-langu
TABLES
allocvaluesnum = gt_num_tab
allocvalueschar = gt_char_tab
allocvaluescurr = gt_curr_tab
return = gt_return.

CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = gv_objkey
objecttable = c_mara
"AUSP "'MCH1'
classnum = ls_rdetails-classname
classtype = ls_rdetails-classtype
TABLES
allocvaluesnumnew = gt_num_tab
allocvaluescharnew = gt_char_tab
allocvaluescurrnew = gt_curr_tab
return = gt_return.

* Collect class and classification detail for current class as well.

CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
classtext = c_x
classtype = i_rmclf-klart
features = c_x
language = sy-langu
object = l_object
objecttable = c_mara
key_date = sy-datum
initial_charact = c_x
no_value_descript = c_x
change_service_clf = c_x
TABLES
t_class = gt_class
t_objectdata = gt_objectdata
EXCEPTIONS
no_classification =
1
no_classtypes =
2
invalid_class_type =
3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF gt_objectdata IS NOT INITIAL.
SELECT atinn adzhl atnam atfor
FROM cabn
INTO TABLE gt_cabn
FOR ALL ENTRIES IN gt_objectdata1
WHERE atnam = gt_objectdata1-atnam.
ENDIF.
QM

QE03: Inspection Lot no display
QE51N: Inspection result display

Table linking: Flow of tables:
SELECT a~prueflos
         a~stat35
         a~charg
         a~werk
         a~matnr
         a~lifnr
         b~vdatum
               FROM qals AS a
               INNER JOIN qave AS b
               ON a~prueflos = b~prueflos
               INTO TABLE gt_qals
               WHERE a~matnr IN s_matnr
               AND   a~stat35 NE space
               AND   b~vdatum IN s_date.
  IF sy-subrc = 0.
    SELECT lifnr
           name1
           name2 INTO TABLE gt_lfa1
                 FROM lfa1
                 FOR ALL ENTRIES IN gt_qals
                 WHERE lifnr = gt_qals-lifnr.

  ELSE.
    MESSAGE text-004 TYPE c_s.
    LEAVE LIST-PROCESSING.
  ENDIF.

  LOOP AT gt_lfa1 INTO gs_lfa1.
    gs_lfa1-name2 = gs_lfa1-name2+0(3).
    APPEND gs_lfa1 TO lt_lfa1.
    CLEAR:gs_lfa1.
  ENDLOOP.
  DELETE lt_lfa1 WHERE name2 NOT IN s_region.
  CLEAR: gt_lfa1.
  gt_lfa1 = lt_lfa1.

  LOOP AT gt_lfa1 INTO gs_lfa1.
    ls_lifnr-sign   = c_i.
    ls_lifnr-option = c_eq.
    ls_lifnr-low = gs_lfa1-lifnr.
    APPEND ls_lifnr TO gt_lifnr.
    CLEAR: ls_lifnr, gs_lfa1.
  ENDLOOP.

  IF gt_lfa1 IS NOT INITIAL.
    DELETE gt_qals WHERE lifnr NOT IN gt_lifnr.
    IF gt_qals IS NOT INITIAL.

      SELECT prueflos
             merknr
             qpmk_werks
             verwmerkm
             mkversion FROM qamv
                       INTO TABLE gt_qamv
                       FOR ALL ENTRIES IN gt_qals
                       WHERE prueflos = gt_qals-prueflos.

      SELECT matnr
             maktx FROM makt
                   INTO TABLE gt_makt
                   FOR ALL ENTRIES IN gt_qals
                   WHERE matnr = gt_qals-matnr.

      SELECT qasr~prueflos
             qasr~vorglfnr
             qasr~merknr
             qasr~probenr
             qasr~pruefbemkt AS rpruefbemkt
             qasr~satzstatus
             qasr~anzwertg
             qase~pruefbemkt AS epruefbemkt
             qase~detailerg
             qase~code1
               INTO TABLE gt_qasr
               FROM qasr
               LEFT OUTER JOIN qase ON ( qase~prueflos = qasr~prueflos AND
                                         qase~merknr = qasr~merknr )
               FOR ALL entries IN gt_qals
               WHERE qasr~prueflos = gt_qals-prueflos AND
                     qasr~vorglfnr = c_001.

         SELECT phynr matnr charg plos2 entdatum
           FROM qprs
           INTO TABLE gt_qprs
           FOR ALL ENTRIES IN gt_qals
           WHERE plos2 = gt_qals-prueflos AND
                entdatum <> c_0.
    ENDIF.
  ELSE.
    MESSAGE text-004 TYPE c_s.
    LEAVE LIST-PROCESSING.
  ENDIF.






No comments:

Post a Comment