Skip to Content
avatar image
Former Member

limit process order quantities as per plan order

Dear all,

I need to restrict process order quantities as per plan order and for this purpose I have found a Badi "WORKORDER_UPDATE" and after placing break point on save event I got to check the structure of badi "IS_HEADER_DIALOG" , All I want is to have plan order number through which I can check quantities of plan order and generate error message if quantity exceeds, but there is no value in the mentioned structure, Although there is reference field which should have filed with plan order number. Now I am badly stuck and can't move forward.


I did try user enhancement PPCO0007 and same is the issue which I am facing.


Any help would be highly appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 25 at 06:03 AM

    I have solved this issue by myself , I got plan order number through global variable of the program. Mention below is the sample code if someone face the same issue.

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

    DATA: lo_obj TYPE REF TO object.

    DATA: ld_class TYPE string,
    ld_method TYPE string.

    data lv_GSMNG type GSMNG.

    data diff type gsmng.
    data po_q type gsmng.
    data used type gsmng.
    FIELD-SYMBOLS:
    <lo_kernel> TYPE ANY.

    DATA:
    ls_AFPOD TYPE AFPOD,
    lt_AFPOD TYPE STANDARD TABLE OF AFPOD,
    ld_line TYPE sytabix,
    ld_tabix TYPE sytabix,
    lx_dep_tables TYPE abap_bool.

    ld_class = '(SAPLCOZV)AFPOD'.
    ASSIGN (ld_class) TO <lo_kernel>.

    " Reference: SDN Wiki entry
    " 'Accessing the Inacessible - Local Classes within Global Classes'
    " https://wiki.sdn.sap.com/wiki/display/ABAP/Accessing+
    " the+Inacessible+-+Local+Classes+within+Global+Classes
    if sy-subrc = 0.
    ls_afpod = <lo_kernel>.
    endif.

    select single GSMNG from zplaf into lv_gsmng where PLNUM = ls_afpod-plnum.

    select sum( PSMNG ) from afpo into used where plnum = ls_afpod-plnum.

    po_q = HEADER_IMP-GAMNG .
    lv_gsmng = lv_gsmng - used.

    if HEADER_IMP-GAMNG > lv_gsmng.
    diff = po_q - lv_gsmng.
    MESSAGE E006(ZFAK) WITH text-001 diff." text-002 .

    endif.

    Add comment
    10|10000 characters needed characters exceeded