Skip to Content

VOFM Requirement coding

Advice sought..

I want to use an Output Control <i>requirement</i> to determine if an event should be triggered by Sales Order Output Control. The value I want to use to decide is the CEPOK flag on the sales order item line. Any line with CEPOK set to 'B' should satisfy the <i>requirement</i>. However I presume the KOMBPV1 structure will only hold a single line.. Which line? and how do I examine all lines? And how come KOMBPV1 doesn't have the VBELN key field? I was going to use some code like:

SELECT SINGLE CEPOK

FROM VBAP INTO VBAP-CEPOK

WHERE VBELN = KOMPBV1-VBELN

AND CEPOK = 'B' OR CEPOK = 'C'.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 05, 2007 at 01:15 AM

    Hi,

    1) Is your output type at the line item level??

    2) Also you can extend the communication structure KOMPBV1 with the field CEPOK using APPEND structures..

    Then check the field KOMPBV1-CEPOK = 'C' OR 'B'..To propose the output type..

    SAP will automatically move the value to the communication structure KOMPBV1..

    Thanks,

    Naren

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2007 at 01:59 AM

    Hi,

    Find answer to your question below.

    [1]. In VOFM. the routine related to your requirement is in under menu "Requirements --> Output control".

    [2]. The routine you should look at here is

    - <b>Routine 20</b> (Order (Hdr) incompl.) If you want to triggers the output based on whole sales document ( if all line item satisfy your requirement ) with menu "Extras --> Output --> Header --> Edit"

    - <b>Routine 21</b> (Order (Itm) incompl.) . If you want to trigger the output based on indivisual lines with menu "Extras --> Output --> Item --> Edit" with one item selected.

    [3]. Copy this routine in customer namespace ( 600 - 999 ). You will need an access key for this. Let's say you are implemening the routine number 621, then you will need access key for object <b>R3TR PROG RV61B621</b>. Choose the application V1 here.

    [4]. Regarding your question, VBELN is not available, <b>you need to get it from call stack</b>. You have access to following stack variables here.

    -- (SAPMV45A)VBAK : Structure VBAK

    -- (SAPMV45A)VBAP : Structure VBAP ( in routine 20 POSNR = 0000 )

    -- (SAPMV45A)XVBAK : Strucutre XVBAK

    -- (SAPMV45A)XVBAP : Table XVBAP ( it contains all lines )

    [5]. The routine ( 20 or 21 ) triggers only once. It tirggers when you select your output using "Extras --> Output --> Header / Item --> Edit" and Hit SAVE. On hitting Saving the sales document, the routine triggers once, it checks your requirement and detemine output trigger based on it.

    I hope i clarify your doubt.

    Let me know if you have any question.

    Regards,

    RS

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Tony Bramhill

      Hi,

      Get the value from call stack with following code.

      You might only need XVBAP values only. Check if your requirements meet with XVBAP only, then you can remove the code related to VBAK and VBAP.

      Let me know if you have find any issue with this code.

      *----------------------------------------------------------------------*
      *----------------------------------------------------------------------*
      TYPES:   BEGIN OF xvbap.
              INCLUDE STRUCTURE vbapvb.
      TYPES:   END OF xvbap.
      
      TYPES: t_vbap TYPE STANDARD TABLE OF xvbap.
      
      **-- Field Symbols Declarations
      FIELD-SYMBOLS :<fs_vbak>  TYPE ANY,
                     <fs_vbap>  TYPE ANY,
                     <fs_xvbap> TYPE t_vbap.
      
      **-- Structure Declaration for field symbols
      DATA :  str_vbap  TYPE vbap,
              str_vbak  TYPE vbak.
      
      *Table for XVBAP
      DATA: lit_xvbap TYPE t_vbap.
      
      *Work area
      DATA: lst_xvbap TYPE xvbap.
      
      DATA: l_cepok LIKE vbap-cepok.
      
      **--- Field Symbol Declarations
      DATA : l_vbak(20)  VALUE '(SAPMV45A)VBAK',
             l_vbap(20)  VALUE '(SAPMV45A)VBAP',
             l_xvbap(20) VALUE '(SAPMV45A)XVBAP'.
      
      **---Logic to get the Sales Order Header data
      ASSIGN (l_vbak) TO <fs_vbak>.
      IF sy-subrc EQ 0.
        IF NOT <fs_vbak> IS INITIAL.
          MOVE <fs_vbak> TO str_vbak.
        ENDIF.
      ENDIF.
      
      **---Logic to get the Sales Order Item data
      ASSIGN (l_vbap) TO <fs_vbap>.
      IF sy-subrc EQ 0.
        IF NOT <fs_vbap> IS INITIAL.
          MOVE <fs_vbap> TO str_vbap.
        ENDIF.
      ENDIF.
      
      **---Logic to get the Sales Order Item data (all item)
      ASSIGN (l_xvbap) TO <fs_xvbap>.
      IF sy-subrc EQ 0.
        IF NOT <fs_xvbap> IS INITIAL.
          MOVE <fs_xvbap> TO lit_xvbap.
        ENDIF.
      ENDIF.
      
      IF NOT lit_xvbap[] IS INITIAL.
      * loop at sales order line item
        LOOP AT lit_xvbap INTO lst_xvbap.
          l_cepok = lst_xvbap-cepok.
          CHECK: l_cepok >< 'B' AND l_cepok >< 'C'.
          sy-subrc = 0.
        ENDLOOP.
      ENDIF.
      *----------------------------------------------------------------------*
      *----------------------------------------------------------------------*

      Regards,

      RS

  • Apr 11, 2007 at 11:00 PM

    Thanks RS, I am getting the values from the call stack as u suggested.

    I had to make a slight change to the code:

    (SAPMV45A)VBAP ==> (SAPMV45A)VBAP[]

    I remain surprised that R/3 does not supply VBELN in the KOM structure when application V1 invoked Message Control and the requirement is executed.

    Many thanks for your advice.

    Add comment
    10|10000 characters needed characters exceeded