Skip to Content
author's profile photo Former Member
Former Member

how to add logic in FM in User exit

Hi All,

here i m giving my Function Module Logic here.

FUNCTION zqm_upd_insp_lot.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_QALS) LIKE QALS STRUCTURE QALS

*" VALUE(I_QAVE) LIKE QAVE STRUCTURE QAVE OPTIONAL

*" EXPORTING

*" REFERENCE(E_QALS) LIKE QALS STRUCTURE QALS

*" REFERENCE(E_ACTIVE) LIKE QM00-QKZ

*" VALUE(E_SUBRC) LIKE SY-SUBRC

*" TABLES

*" E_PROTOCOL STRUCTURE RQEVP OPTIONAL

*"----


DATA : lv_pono TYPE ekko-ebeln,

lv_mnfr TYPE wyt3-lifn2,

lv_lifnr TYPE ekko-lifnr,

lv_ekorg TYPE ekko-ekorg,

lv_ktext TYPE qals-ktextlos,

lv_prod_off TYPE qals-zzprodoff,

lv_po_valid TYPE c,

lv_pdoff_valid TYPE c.

CONSTANTS: lc_active TYPE qm00-qkz VALUE 'X',

lc_comma(1) TYPE c VALUE ','.

  • I_QALS-KTEXTLOS will contain value of purchase order number

CLEAR : lv_pono,

lv_ktext,

lv_prod_off.

MOVE i_qals-ktextlos TO lv_ktext.

CONDENSE lv_ktext NO-GAPS.

SPLIT lv_ktext AT lc_comma INTO lv_pono lv_prod_off.

TRANSLATE lv_prod_off TO UPPER CASE.

CLEAR : lv_pdoff_valid,

lv_po_valid.

  • Validate purchase order number

PERFORM f_validate_po USING lv_pono

CHANGING lv_po_valid.

  • Validate production office

PERFORM f_validate_prod_off USING lv_prod_off

CHANGING lv_pdoff_valid.

IF lv_pdoff_valid NE gc_valid

OR lv_po_valid NE gc_valid.

  • Send a message to user and allow the user to enter new PO number

  • and production office.

PERFORM f_process_invalid_po_pdoff USING lv_po_valid

lv_pdoff_valid

lv_pono

lv_prod_off.

ENDIF.

CLEAR lv_ktext.

IF NOT lv_pono IS INITIAL

AND NOT lv_prod_off IS INITIAL.

CONCATENATE lv_pono lc_comma lv_prod_off INTO lv_ktext.

ELSEIF NOT lv_prod_off IS INITIAL

AND lv_pono IS INITIAL.

CONCATENATE lv_pono lc_comma lv_prod_off INTO lv_ktext.

ELSEIF NOT lv_pono IS INITIAL

AND lv_prod_off IS INITIAL .

lv_ktext = lv_pono.

ENDIF.

  • If po is in initial,Invalid OR No purchase order exists. So

  • only update Manufacturer field.

IF ( lv_pono IS INITIAL

AND lv_prod_off IS INITIAL )

OR ( lv_pono IS INITIAL )."Invaild PO and production office

  • Get 'Reference to other vendor' value

PERFORM f_get_manufacturer USING i_qals-lifnr

CHANGING lv_mnfr.

IF NOT lv_mnfr IS INITIAL

OR NOT lv_prod_off IS INITIAL .

  • Update Manufacturer

MOVE i_qals TO e_qals.

e_qals-hersteller = lv_mnfr.

e_qals-zzprodoff = lv_prod_off.

e_qals-ktextlos = lv_ktext.

e_active = lc_active.

ENDIF.

ELSE."Valid PO

  • it has valid PO, so get requried field value based on PO

PERFORM f_get_po_values USING lv_pono

CHANGING lv_mnfr

lv_lifnr

lv_ekorg.

  • Update the PO number,Short Text,Vendor,Manufacturer and purchasing

  • organization

MOVE i_qals TO e_qals.

e_qals-ebeln = lv_pono.

e_qals-ktextlos = lv_ktext.

e_qals-hersteller = lv_mnfr.

e_qals-lifnr = lv_lifnr.

e_qals-ekorg = lv_ekorg.

e_qals-zzprodoff = lv_prod_off.

e_active = lc_active.

ENDIF.

ENDFUNCTION.

plz help me, this is very urgent.

regards,

JD

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 08:11 AM

    please give more details , what you are looking for..

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      this is my requirement:

      1.2. Check the Inspection type in the Inspection lot (QALS-ART) .

      IF E_QALS-ART = Z_VSGR. If yes go to 1.2.1… else EXIT.

      1.2.1. Read the Purchase order Number (E_QALS-EBELN) and Go to this PO header table (EKKO) and read our “ Reference” field value (EKKO-UNSEZ) and if (EKKO-UNSEZ = EKKO-EBELN) to get the original PO Number sent to the Vendor from Production Office.

      1.2.2. Update the Vendor Number in the Inspection lot ( E_QALS-LIFNR).

      1.2.3. Update the Short Text Field (E_QALS_KTEXTLOS).

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.