Skip to Content

short text for inspection multiple time for single lot no

According to business requirement i have develop a Z report for monthly amorphous production report.

Data are extracted from qals,qave and qamv table.while selecting data from qamv there are multiple short text for inspection

with respect to one lot no (PRUeflos).I am stuck in resolving it how shall i display this in alv .For ref tcode qa13

The following code i have written:

SELECT

prueflos

werk

aufnr

matnr

charg

lagortchrg

ebeln

blart

mjahr

mblnr

budat

bwart

losmenge

FROM qals

INTO CORRESPONDING FIELDS OF TABLE it_final

WHERE mjahr IN s_mjahr

AND matnr IN s_matnr

AND werk IN s_werk

AND budat IN s_budat

AND bwart EQ '101' OR bwart EQ '102'.

* SORT it_final DESCENDING .

IF it_final[] IS INITIAL.

MESSAGE e008(zcr).

ENDIF.

IF NOT it_final[] IS INITIAL.

SELECT matnr spras maktx FROM makt INTO TABLE it_makt FOR ALL ENTRIES IN it_final WHERE matnr = it_final-matnr

AND spras EQ 'E'.

LOOP AT it_final INTO wa_final.

READ TABLE it_makt INTO wa_makt WITH KEY matnr = wa_final-matnr

spras = 'E' .

IF sy-subrc = 0.

wa_final-maktx = wa_makt-maktx.

MODIFY it_final FROM wa_final.

clear wa_final.

ENDIF.

ENDLOOP.

ENDIF.

IF NOT it_final[] IS INITIAL.

SELECT prueflos vcode FROM qave INTO TABLE it_qave FOR ALL ENTRIES IN it_final WHERE prueflos = it_final-prueflos.

LOOP AT it_final INTO wa_final.

READ TABLE it_qave INTO wa_qave WITH KEY prueflos = wa_final-prueflos .

IF sy-subrc = 0.

wa_final-vcode = wa_qave-vcode.

CASE:wa_final-vcode.

WHEN 'A'.

wa_final-vcode_text = c_vcode_a.

WHEN 'A1'.

wa_final-vcode_text = c_vcode_a1.

WHEN 'B1'.

wa_final-vcode_text = c_vcode_b1.

WHEN 'B2'.

wa_final-vcode_text = c_vcode_b2.

WHEN 'C'.

wa_final-vcode_text = c_vcode_c.

WHEN 'R'.

wa_final-vcode_text = c_vcode_r.

WHEN 'R1'.

wa_final-vcode_text = c_vcode_r1.

WHEN 'S'.

wa_final-vcode_text = c_vcode_s.

WHEN 'W'.

wa_final-vcode_text = c_vcode_w.

ENDCASE.

MODIFY it_final FROM wa_final .

clear wa_final.

ENDIF.

ENDLOOP.

ENDIF.

IF NOT it_final[] IS INITIAL.

break-point.

SELECT prueflos MERKNR kurztext FROM qamv INTO TABLE it_qamv FOR ALL ENTRIES IN it_final WHERE prueflos = it_final-prueflos.

LOOP AT it_final INTO wa_final where prueflos = wa_final-prueflos.

READ TABLE it_qamv INTO wa_qamv WITH KEY prueflos = wa_final-prueflos .

* idx = sy-tabix.

* clear wa_final.

IF sy-subrc = 0.

* sort it_qamv descending.

wa_final-MERKNR = wa_qamv-MERKNR.

wa_final-kurztext = wa_qamv-kurztext.

MODIFY it_final FROM wa_final.

clear wa_final.

ENDIF.

ENDLOOP.

ENDIF.

Capture.PNG (56.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Nov 06, 2015 at 10:25 AM

    Good day Durgesh,

    Use FM - REUSE_ALV_GRID_DISPLAY.

    Here is the example how to display on ALV.

    http://www.saptechnical.com/Tutorials/ALV/SampleALVGridProgram.htm

    Regards,

    Tumelo Modise

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 06, 2015 at 11:31 AM

    Hi Durgesh,

    The short text of the lot depends on the node selected i.e in the above screenshot your node is 0010(operation/Activity). I have used the tables QALS, PLMK for this.

    the values that need to be passed to PLMK table are PLNTY, PLNNR and PLNKN and get the details of KURZTEXT(short text for the lot characteristics).PLNTY and PLNNR values can be passed from QALS table but PLNKN value should be the current node. In my report I fetched the node value from Ztable and I donno any Standard table where this node value will be stored so, ask QM consultant to help you in fetching the node value. Hope this helps.

    Regards,

    Mounika M

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member DURGESH K PANDEY

      Hi,

      First of all my requirement is completely different, its not a report. So i have done some little modifications to my code. This is purely for reference.

      Vorglfnr is the node i mentioned above. I think you can even use QAMV table instead of PLPO and PLMK tables as it contains VORGLFNR field in it and the value of MERKNR can be achived using the FM 'QEEM_GET_CHARACTERISTIC_DATA'. Anyway, I have used PLPO and PLMK tables. Hard-coded values NA SI S etc. are the MIC values and for you they are Grades,IV,COOH etc.

      SELECT OBJNR

      PRUEFLOS

      WERKS

      VORGLFNR FROM ZQM_ANLSMPL_GEN INTO TABLE IT_SAMP

      WHERE OBJNR IN S_OBJNR.

      IF IT_SAMP IS NOT INITIAL.

      SELECT PRUEFLOS

      WERK

      PLNTY

      PLNNR FROM QALS INTO CORRESPONDING FIELDS OF TABLE IT_QALS

      FOR ALL ENTRIES IN IT_SAMP

      WHERE PRUEFLOS = IT_SAMP-PRUEFLOS.

      LOOP AT IT_SAMP INTO WA_SAMP.

      READ TABLE IT_QALS INTO WA_QALS WITH KEY PRUEFLOS = WA_SAMP-PRUEFLOS.

      WA_QALS-NODE = WA_SAMP-VORGLFNR.

      APPEND WA_QALS TO IT_QALS2.

      CLEAR: WA_SAMP, WA_QALS.

      ENDLOOP.

      IF IT_QALS2 IS NOT INITIAL.

      SELECT PLNTY

      PLNNR

      PLNKN

      VORNR

      WERKS FROM PLPO INTO TABLE IT_PLPO

      FOR ALL ENTRIES IN IT_QALS2

      WHERE PLNTY = IT_QALS2-PLNTY

      AND PLNNR = IT_QALS2-PLNNR

      AND PLNKN = IT_QALS2-NODE

      AND LOEKZ <> 'X'.

      IF IT_PLPO IS NOT INITIAL.

      SELECT PLNTY

      PLNNR

      PLNKN

      MERKNR

      VERWMERKM FROM PLMK INTO TABLE IT_PLMK

      FOR ALL ENTRIES IN IT_PLPO

      WHERE PLNTY = IT_PLPO-PLNTY

      AND PLNNR = IT_PLPO-PLNNR

      AND PLNKN = IT_PLPO-PLNKN

      AND LOEKZ <> 'X'.

      ENDIF.

      ENDIF.

      ENDIF.


      LOOP AT IT_SAMP INTO WA_SAMP WHERE OBJNR IN S_OBJNR.

      IF SY-SUBRC = 0.

      wa_final-PLANT = WA_SAMP-WERKS.

      wa_final-SAMPLE_NO = wa_samp-objnr.

      wa_final-prueflos = wa_samp-PRUEFLOS.

      READ TABLE IT_QALS2 INTO WA_QALS WITH KEY PRUEFLOS = WA_SAMP-PRUEFLOS BINARY SEARCH.

      IF SY-SUBRC = 0.

      READ TABLE IT_PLMK INTO WA_PLMK WITH KEY PLNTY = WA_PLPO-PLNTY

      PLNNR = WA_PLPO-PLNNR

      PLNKN = WA_PLPO-PLNKN

      VERWMERKM = WA_QAMKTAB-VERWMERKM BINARY SEARCH.

      IF SY-SUBRC = 0.

      CALL FUNCTION 'QEEM_GET_CHARACTERISTIC_DATA'

      EXPORTING

      I_PRUEFLOS = wa_final-prueflos

      TABLES

      T_QAMKTAB = T_QAMKTAB

      * EXCEPTIONS

      * NO_DATA_FOUND = 1

      * INTERNAL_PROBLEMS = 2

      * OTHERS = 3

      .

      IF SY-SUBRC <> 0.

      ENDIF.

      LOOP AT T_QAMKTAB INTO WA_QAMKTAB WHERE PLNKN = WA_PLPO-PLNKN.

      wa_final-INSP_TEST_NO = WA_QAMKTAB-MERKNR.

      READ TABLE IT_PLMK INTO WA_PLMK WITH KEY PLNKN = WA_QAMKTAB-PLNKN

      VERWMERKM = WA_QAMKTAB-VERWMERKM.

      IF SY-SUBRC = 0.

      IF WA_PLMK-VERWMERKM = 'NA' .

      wa_final-INSP_TEST_RSLT = value.

      ELSEIF WA_PLMK-VERWMERKM = 'SI'.

      wa_final-INSP_TEST_RSLT = value.

      ELSEIF WA_PLMK-VERWMERKM = 'P' .

      wa_final-INSP_TEST_RSLT = value.

      ELSEIF WA_PLMK-VERWMERKM = 'S' .

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-S.

      ELSEIF WA_PLMK-VERWMERKM = 'CA'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-CA.

      ELSEIF WA_PLMK-VERWMERKM = 'V' .

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-V.

      ELSEIF WA_PLMK-VERWMERKM = 'FE'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-FE.

      ELSEIF WA_PLMK-VERWMERKM = 'NI'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-NI.

      ELSEIF WA_PLMK-VERWMERKM = 'TI'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-TI.

      ELSEIF WA_PLMK-VERWMERKM = 'MN'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-MN.

      ELSEIF WA_PLMK-VERWMERKM = 'AL'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-AL.

      ELSEIF WA_PLMK-VERWMERKM = 'MG'.

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-MG.

      ELSEIF WA_PLMK-VERWMERKM = 'K' .

      wa_final-INSP_TEST_RSLT = value."WA_XRF2-K.

      ELSEIF WA_PLMK-VERWMERKM = 'C'.

      wa_final-INSP_TEST_RSLT = value." WA_XRF2-C.

      ENDIF.

      ENDIF.

      APPEND wa_final to it_final.

      CLEAR: WA_QAMKTAB , wa_final.

      ENDLOOP.

      DELETE IT_final WHERE INSP_TEST_RSLT IS INITIAL.

      ENDIF.

      ENDIF.

      ENDIF.

      ENDLOOP.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.