Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Add Document flow not work.

Former Member
0 Kudos
175

Hi experts,

I want to add some information in SD Document flow.

but it not work. code is as below:

FORM USEREXIT_VORGAENGER.
*{   INSERT         D50K907150                                        1
DATA : V_EKKN TYPE EKKN.
DATA : WA_VBFA TYPE VBFA,
       XVVBFA TYPE VBFA.
DATA : V_INDEX TYPE SY-TABIX.
  READ TABLE VBFA_TAB INTO XVVBFA WITH KEY VBELV = ''
                                          POSNV = '0'
                                          VBTYP_N = 'V'
                                          VBTYP_V = ''
                                          vbeln = vbfa-vbelv
                                          posnn = vbfa-posnv.
IF SY-SUBRC = 0.
  V_INDEX = SY-TABIX.
CASE SY-TCODE.
  WHEN 'VF01' OR 'VF02' OR 'VF03'.
      SELECT SINGLE * FROM EKKN INTO V_EKKN
        WHERE EBELN = XVVBFA-VBELN
          AND EBELP = XVVBFA-POSNN.
      IF SY-SUBRC = 0.
        WA_VBFA-MANDT = XVVBFA-MANDT.
        WA_VBFA-VBELN = V_EKKN-VBELN.
        WA_VBFA-POSNN = V_EKKN-VBELP.
        WA_VBFA-MEINS = wa_vbfa-vrkme = 'TO'.
        wa_vbfa-matnr = 'X'.
        SELECT SINGLE AUDAT INTO WA_VBFA-ERDAT
          FROM VBAK
          WHERE VBELN = V_EKKN-VBELN.
        WA_VBFA-STUFE = XVVBFA-STUFE + 1.
        wa_vbfa-vbtyp_n = '2'.
        INSERT WA_VBFA INTO VBFA_TAB INDEX V_INDEX.
        vbfa_insert = vbfa_insert + 1.
        IF SY-SUBRC = 0.
           READ TABLE VBFA_TAB INTO XVBFA WITH KEY VBELN = XVVBFA-VBELN
                                                   POSNN = XVVBFA-POSNN
                                                   VBTYP_N = XVVBFA-VBTYP_N
                                                   STUFE = XVVBFA-STUFE
                                                   VBELV = ''
                                                   POSNV = '0'
                                                   VBTYP_V = ''.
           IF SY-SUBRC = 0.
             XVVBFA-VBELV = WA_VBFA-VBELN.
             XVVBFA-POSNV = WA_vbfa-posnn.
             XVvbfa-vbtyp_v = wa_vbfa-vbtyp_n.
             modify vbfa_tab from XVvbfa INDEX SY-TABIX transporting vbelv posnv vbtyp_v.
           ENDIF.
        endif.
      endif.
      endcase.
    endif.
DELETE ADJACENT DUPLICATES FROM VBFA_TAB
COMPARING VBELV POSNV VBTYP_N VBELN POSNN.
*
*}   INSERT

ENDFORM.

2 REPLIES 2

Former Member
0 Kudos
61

Dear Experts,

Pl. help its.

0 Kudos
61

Dear experts ,

Pl. help.

how can???