SAP Function Modules

RV_SALES_DOCUMENT_ADD SAP Function module - Create sales document







RV_SALES_DOCUMENT_ADD is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name RV_SALES_DOCUMENT_ADD into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: V45U
Released Date: Not Released
Processing type: Update is started immediately, no restart possible (Immediate start, No restart)
update module no restart settings


Pattern for FM RV_SALES_DOCUMENT_ADD - RV SALES DOCUMENT ADD





CALL FUNCTION 'RV_SALES_DOCUMENT_ADD' "Create sales document
  EXPORTING
*   fkonv_geaendert = 'X'       " rv45a-vbap_selkz  Indicator: conditions changed
    fvbak =                     " vbak          Corresponds to VBAK
    falekz =                    " tvap-alekz
*   it_allocations =            " bapi3060_allocations  Classification: Assignments
*   it_valuations_char =        " bapi3060_valuations_char  Classification System: Obj. Descriptions and CHAR/BOOL Valuation
*   it_valuations_curr =        " bapi3060_valuations_curr  Classification: Object Descriptions and CURR Values
*   it_valuations_num =         " bapi3060_valuations_num  Classification: Object Descriptions and NUM Values
*   is_csfg_info =              " csfgt_info_dyn  Info Structure for CSFG in Sales Order (Update Process)
  TABLES
*   fxkomv =                    " komv          Corresponds to XKOMV
    fxsadr =                    " sadrvb
    fxvbap =                    " vbapvb        Corresponds to XVBAP
    fxvbapf =                   " vbapf
    fxvbbe =                    " vbbed
    fxvbbs =                    " vbbsd
    fxvbep =                    " vbepvb        Corresponds to XVBEP
    fxvbfa =                    " vbfavb        Corresponds to XVBFA
    fxvbkd =                    " vbkdvb        Corresponds to XVBKD
    fxvbpa =                    " vbpavb        Corresponds to XVBPA
*   fxvbpa2 =                   " vbpa2vb
    fxvbsn =                    " vbsnvb
    fxvbuk =                    " vbukvb        Corresponds to XVBUK
    fxvbup =                    " vbupvb        Corresponds to XVBUP
    fxqtch =                    " qtchd
    fxqtvb =                    " qtvbd
    fxapoi =                    " atpfield
    fyvbbe =                    " vbbed
    fyvbbs =                    " vbbsd
    fyvbuk =                    " vbukvb        Corresponds to YVBUK
    fyvbup =                    " vbupvb        Corresponds to YVBUP
    fxvbuv =                    " vbuvvb
*   fxfpla =                    " fplavb
*   fyfpla =                    " fplavb
*   fxfplt =                    " fpltvb
*   fyfplt =                    " fpltvb
    fyqtvb =                    " qtvbd
    fvbkey =                    " vbkey
    fxvblb =                    " vblbvb
    fyvblb =                    " vblbvb
*   fxvbkfz =                   " vbkfzvb
*   fyvbkfz =                   " vbkfzvb
    .  "  RV_SALES_DOCUMENT_ADD

ABAP code example for Function Module RV_SALES_DOCUMENT_ADD





The ABAP code below is a full code listing to execute function module RV_SALES_DOCUMENT_ADD including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
it_fxkomv  TYPE STANDARD TABLE OF KOMV,"TABLES PARAM
wa_fxkomv  LIKE LINE OF it_fxkomv ,
it_fxsadr  TYPE STANDARD TABLE OF SADRVB,"TABLES PARAM
wa_fxsadr  LIKE LINE OF it_fxsadr ,
it_fxvbap  TYPE STANDARD TABLE OF VBAPVB,"TABLES PARAM
wa_fxvbap  LIKE LINE OF it_fxvbap ,
it_fxvbapf  TYPE STANDARD TABLE OF VBAPF,"TABLES PARAM
wa_fxvbapf  LIKE LINE OF it_fxvbapf ,
it_fxvbbe  TYPE STANDARD TABLE OF VBBED,"TABLES PARAM
wa_fxvbbe  LIKE LINE OF it_fxvbbe ,
it_fxvbbs  TYPE STANDARD TABLE OF VBBSD,"TABLES PARAM
wa_fxvbbs  LIKE LINE OF it_fxvbbs ,
it_fxvbep  TYPE STANDARD TABLE OF VBEPVB,"TABLES PARAM
wa_fxvbep  LIKE LINE OF it_fxvbep ,
it_fxvbfa  TYPE STANDARD TABLE OF VBFAVB,"TABLES PARAM
wa_fxvbfa  LIKE LINE OF it_fxvbfa ,
it_fxvbkd  TYPE STANDARD TABLE OF VBKDVB,"TABLES PARAM
wa_fxvbkd  LIKE LINE OF it_fxvbkd ,
it_fxvbpa  TYPE STANDARD TABLE OF VBPAVB,"TABLES PARAM
wa_fxvbpa  LIKE LINE OF it_fxvbpa ,
it_fxvbpa2  TYPE STANDARD TABLE OF VBPA2VB,"TABLES PARAM
wa_fxvbpa2  LIKE LINE OF it_fxvbpa2 ,
it_fxvbsn  TYPE STANDARD TABLE OF VBSNVB,"TABLES PARAM
wa_fxvbsn  LIKE LINE OF it_fxvbsn ,
it_fxvbuk  TYPE STANDARD TABLE OF VBUKVB,"TABLES PARAM
wa_fxvbuk  LIKE LINE OF it_fxvbuk ,
it_fxvbup  TYPE STANDARD TABLE OF VBUPVB,"TABLES PARAM
wa_fxvbup  LIKE LINE OF it_fxvbup ,
it_fxqtch  TYPE STANDARD TABLE OF QTCHD,"TABLES PARAM
wa_fxqtch  LIKE LINE OF it_fxqtch ,
it_fxqtvb  TYPE STANDARD TABLE OF QTVBD,"TABLES PARAM
wa_fxqtvb  LIKE LINE OF it_fxqtvb ,
it_fxapoi  TYPE STANDARD TABLE OF ATPFIELD,"TABLES PARAM
wa_fxapoi  LIKE LINE OF it_fxapoi ,
it_fyvbbe  TYPE STANDARD TABLE OF VBBED,"TABLES PARAM
wa_fyvbbe  LIKE LINE OF it_fyvbbe ,
it_fyvbbs  TYPE STANDARD TABLE OF VBBSD,"TABLES PARAM
wa_fyvbbs  LIKE LINE OF it_fyvbbs ,
it_fyvbuk  TYPE STANDARD TABLE OF VBUKVB,"TABLES PARAM
wa_fyvbuk  LIKE LINE OF it_fyvbuk ,
it_fyvbup  TYPE STANDARD TABLE OF VBUPVB,"TABLES PARAM
wa_fyvbup  LIKE LINE OF it_fyvbup ,
it_fxvbuv  TYPE STANDARD TABLE OF VBUVVB,"TABLES PARAM
wa_fxvbuv  LIKE LINE OF it_fxvbuv ,
it_fxfpla  TYPE STANDARD TABLE OF FPLAVB,"TABLES PARAM
wa_fxfpla  LIKE LINE OF it_fxfpla ,
it_fyfpla  TYPE STANDARD TABLE OF FPLAVB,"TABLES PARAM
wa_fyfpla  LIKE LINE OF it_fyfpla ,
it_fxfplt  TYPE STANDARD TABLE OF FPLTVB,"TABLES PARAM
wa_fxfplt  LIKE LINE OF it_fxfplt ,
it_fyfplt  TYPE STANDARD TABLE OF FPLTVB,"TABLES PARAM
wa_fyfplt  LIKE LINE OF it_fyfplt ,
it_fyqtvb  TYPE STANDARD TABLE OF QTVBD,"TABLES PARAM
wa_fyqtvb  LIKE LINE OF it_fyqtvb ,
it_fvbkey  TYPE STANDARD TABLE OF VBKEY,"TABLES PARAM
wa_fvbkey  LIKE LINE OF it_fvbkey ,
it_fxvblb  TYPE STANDARD TABLE OF VBLBVB,"TABLES PARAM
wa_fxvblb  LIKE LINE OF it_fxvblb ,
it_fyvblb  TYPE STANDARD TABLE OF VBLBVB,"TABLES PARAM
wa_fyvblb  LIKE LINE OF it_fyvblb ,
it_fxvbkfz  TYPE STANDARD TABLE OF VBKFZVB,"TABLES PARAM
wa_fxvbkfz  LIKE LINE OF it_fxvbkfz ,
it_fyvbkfz  TYPE STANDARD TABLE OF VBKFZVB,"TABLES PARAM
wa_fyvbkfz  LIKE LINE OF it_fyvbkfz .


DATA(ld_fkonv_geaendert) = some text here
DATA(ld_fvbak) = 'Check type of data required'.

SELECT single ALEKZ
FROM TVAP
INTO @DATA(ld_falekz).

DATA(ld_it_allocations) = 'Check type of data required'.
DATA(ld_it_valuations_char) = 'Check type of data required'.
DATA(ld_it_valuations_curr) = 'Check type of data required'.
DATA(ld_it_valuations_num) = 'Check type of data required'.
DATA(ld_is_csfg_info) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxkomv to it_fxkomv.

"populate fields of struture and append to itab
append wa_fxsadr to it_fxsadr.

"populate fields of struture and append to itab
append wa_fxvbap to it_fxvbap.

"populate fields of struture and append to itab
append wa_fxvbapf to it_fxvbapf.

"populate fields of struture and append to itab
append wa_fxvbbe to it_fxvbbe.

"populate fields of struture and append to itab
append wa_fxvbbs to it_fxvbbs.

"populate fields of struture and append to itab
append wa_fxvbep to it_fxvbep.

"populate fields of struture and append to itab
append wa_fxvbfa to it_fxvbfa.

"populate fields of struture and append to itab
append wa_fxvbkd to it_fxvbkd.

"populate fields of struture and append to itab
append wa_fxvbpa to it_fxvbpa.

"populate fields of struture and append to itab
append wa_fxvbpa2 to it_fxvbpa2.

"populate fields of struture and append to itab
append wa_fxvbsn to it_fxvbsn.

"populate fields of struture and append to itab
append wa_fxvbuk to it_fxvbuk.

"populate fields of struture and append to itab
append wa_fxvbup to it_fxvbup.

"populate fields of struture and append to itab
append wa_fxqtch to it_fxqtch.

"populate fields of struture and append to itab
append wa_fxqtvb to it_fxqtvb.

"populate fields of struture and append to itab
append wa_fxapoi to it_fxapoi.

"populate fields of struture and append to itab
append wa_fyvbbe to it_fyvbbe.

"populate fields of struture and append to itab
append wa_fyvbbs to it_fyvbbs.

"populate fields of struture and append to itab
append wa_fyvbuk to it_fyvbuk.

"populate fields of struture and append to itab
append wa_fyvbup to it_fyvbup.

"populate fields of struture and append to itab
append wa_fxvbuv to it_fxvbuv.

"populate fields of struture and append to itab
append wa_fxfpla to it_fxfpla.

"populate fields of struture and append to itab
append wa_fyfpla to it_fyfpla.

"populate fields of struture and append to itab
append wa_fxfplt to it_fxfplt.

"populate fields of struture and append to itab
append wa_fyfplt to it_fyfplt.

"populate fields of struture and append to itab
append wa_fyqtvb to it_fyqtvb.

"populate fields of struture and append to itab
append wa_fvbkey to it_fvbkey.

"populate fields of struture and append to itab
append wa_fxvblb to it_fxvblb.

"populate fields of struture and append to itab
append wa_fyvblb to it_fyvblb.

"populate fields of struture and append to itab
append wa_fxvbkfz to it_fxvbkfz.

"populate fields of struture and append to itab
append wa_fyvbkfz to it_fyvbkfz. . CALL FUNCTION 'RV_SALES_DOCUMENT_ADD' EXPORTING * fkonv_geaendert = ld_fkonv_geaendert fvbak = ld_fvbak falekz = ld_falekz * it_allocations = ld_it_allocations * it_valuations_char = ld_it_valuations_char * it_valuations_curr = ld_it_valuations_curr * it_valuations_num = ld_it_valuations_num * is_csfg_info = ld_is_csfg_info TABLES * fxkomv = it_fxkomv fxsadr = it_fxsadr fxvbap = it_fxvbap fxvbapf = it_fxvbapf fxvbbe = it_fxvbbe fxvbbs = it_fxvbbs fxvbep = it_fxvbep fxvbfa = it_fxvbfa fxvbkd = it_fxvbkd fxvbpa = it_fxvbpa * fxvbpa2 = it_fxvbpa2 fxvbsn = it_fxvbsn fxvbuk = it_fxvbuk fxvbup = it_fxvbup fxqtch = it_fxqtch fxqtvb = it_fxqtvb fxapoi = it_fxapoi fyvbbe = it_fyvbbe fyvbbs = it_fyvbbs fyvbuk = it_fyvbuk fyvbup = it_fyvbup fxvbuv = it_fxvbuv * fxfpla = it_fxfpla * fyfpla = it_fyfpla * fxfplt = it_fxfplt * fyfplt = it_fyfplt fyqtvb = it_fyqtvb fvbkey = it_fvbkey fxvblb = it_fxvblb fyvblb = it_fyvblb * fxvbkfz = it_fxvbkfz * fyvbkfz = it_fyvbkfz . " RV_SALES_DOCUMENT_ADD
IF SY-SUBRC EQ 0. "All OK ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_fkonv_geaendert  TYPE RV45A-VBAP_SELKZ ,
it_fxkomv  TYPE STANDARD TABLE OF KOMV ,
wa_fxkomv  LIKE LINE OF it_fxkomv,
ld_fvbak  TYPE VBAK ,
it_fxsadr  TYPE STANDARD TABLE OF SADRVB ,
wa_fxsadr  LIKE LINE OF it_fxsadr,
ld_falekz  TYPE TVAP-ALEKZ ,
it_fxvbap  TYPE STANDARD TABLE OF VBAPVB ,
wa_fxvbap  LIKE LINE OF it_fxvbap,
ld_it_allocations  TYPE BAPI3060_ALLOCATIONS ,
it_fxvbapf  TYPE STANDARD TABLE OF VBAPF ,
wa_fxvbapf  LIKE LINE OF it_fxvbapf,
ld_it_valuations_char  TYPE BAPI3060_VALUATIONS_CHAR ,
it_fxvbbe  TYPE STANDARD TABLE OF VBBED ,
wa_fxvbbe  LIKE LINE OF it_fxvbbe,
ld_it_valuations_curr  TYPE BAPI3060_VALUATIONS_CURR ,
it_fxvbbs  TYPE STANDARD TABLE OF VBBSD ,
wa_fxvbbs  LIKE LINE OF it_fxvbbs,
ld_it_valuations_num  TYPE BAPI3060_VALUATIONS_NUM ,
it_fxvbep  TYPE STANDARD TABLE OF VBEPVB ,
wa_fxvbep  LIKE LINE OF it_fxvbep,
ld_is_csfg_info  TYPE CSFGT_INFO_DYN ,
it_fxvbfa  TYPE STANDARD TABLE OF VBFAVB ,
wa_fxvbfa  LIKE LINE OF it_fxvbfa,
it_fxvbkd  TYPE STANDARD TABLE OF VBKDVB ,
wa_fxvbkd  LIKE LINE OF it_fxvbkd,
it_fxvbpa  TYPE STANDARD TABLE OF VBPAVB ,
wa_fxvbpa  LIKE LINE OF it_fxvbpa,
it_fxvbpa2  TYPE STANDARD TABLE OF VBPA2VB ,
wa_fxvbpa2  LIKE LINE OF it_fxvbpa2,
it_fxvbsn  TYPE STANDARD TABLE OF VBSNVB ,
wa_fxvbsn  LIKE LINE OF it_fxvbsn,
it_fxvbuk  TYPE STANDARD TABLE OF VBUKVB ,
wa_fxvbuk  LIKE LINE OF it_fxvbuk,
it_fxvbup  TYPE STANDARD TABLE OF VBUPVB ,
wa_fxvbup  LIKE LINE OF it_fxvbup,
it_fxqtch  TYPE STANDARD TABLE OF QTCHD ,
wa_fxqtch  LIKE LINE OF it_fxqtch,
it_fxqtvb  TYPE STANDARD TABLE OF QTVBD ,
wa_fxqtvb  LIKE LINE OF it_fxqtvb,
it_fxapoi  TYPE STANDARD TABLE OF ATPFIELD ,
wa_fxapoi  LIKE LINE OF it_fxapoi,
it_fyvbbe  TYPE STANDARD TABLE OF VBBED ,
wa_fyvbbe  LIKE LINE OF it_fyvbbe,
it_fyvbbs  TYPE STANDARD TABLE OF VBBSD ,
wa_fyvbbs  LIKE LINE OF it_fyvbbs,
it_fyvbuk  TYPE STANDARD TABLE OF VBUKVB ,
wa_fyvbuk  LIKE LINE OF it_fyvbuk,
it_fyvbup  TYPE STANDARD TABLE OF VBUPVB ,
wa_fyvbup  LIKE LINE OF it_fyvbup,
it_fxvbuv  TYPE STANDARD TABLE OF VBUVVB ,
wa_fxvbuv  LIKE LINE OF it_fxvbuv,
it_fxfpla  TYPE STANDARD TABLE OF FPLAVB ,
wa_fxfpla  LIKE LINE OF it_fxfpla,
it_fyfpla  TYPE STANDARD TABLE OF FPLAVB ,
wa_fyfpla  LIKE LINE OF it_fyfpla,
it_fxfplt  TYPE STANDARD TABLE OF FPLTVB ,
wa_fxfplt  LIKE LINE OF it_fxfplt,
it_fyfplt  TYPE STANDARD TABLE OF FPLTVB ,
wa_fyfplt  LIKE LINE OF it_fyfplt,
it_fyqtvb  TYPE STANDARD TABLE OF QTVBD ,
wa_fyqtvb  LIKE LINE OF it_fyqtvb,
it_fvbkey  TYPE STANDARD TABLE OF VBKEY ,
wa_fvbkey  LIKE LINE OF it_fvbkey,
it_fxvblb  TYPE STANDARD TABLE OF VBLBVB ,
wa_fxvblb  LIKE LINE OF it_fxvblb,
it_fyvblb  TYPE STANDARD TABLE OF VBLBVB ,
wa_fyvblb  LIKE LINE OF it_fyvblb,
it_fxvbkfz  TYPE STANDARD TABLE OF VBKFZVB ,
wa_fxvbkfz  LIKE LINE OF it_fxvbkfz,
it_fyvbkfz  TYPE STANDARD TABLE OF VBKFZVB ,
wa_fyvbkfz  LIKE LINE OF it_fyvbkfz.


ld_fkonv_geaendert = some text here

"populate fields of struture and append to itab
append wa_fxkomv to it_fxkomv.
ld_fvbak = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxsadr to it_fxsadr.

SELECT single ALEKZ
FROM TVAP
INTO ld_falekz.


"populate fields of struture and append to itab
append wa_fxvbap to it_fxvbap.
ld_it_allocations = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxvbapf to it_fxvbapf.
ld_it_valuations_char = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxvbbe to it_fxvbbe.
ld_it_valuations_curr = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxvbbs to it_fxvbbs.
ld_it_valuations_num = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxvbep to it_fxvbep.
ld_is_csfg_info = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxvbfa to it_fxvbfa.

"populate fields of struture and append to itab
append wa_fxvbkd to it_fxvbkd.

"populate fields of struture and append to itab
append wa_fxvbpa to it_fxvbpa.

"populate fields of struture and append to itab
append wa_fxvbpa2 to it_fxvbpa2.

"populate fields of struture and append to itab
append wa_fxvbsn to it_fxvbsn.

"populate fields of struture and append to itab
append wa_fxvbuk to it_fxvbuk.

"populate fields of struture and append to itab
append wa_fxvbup to it_fxvbup.

"populate fields of struture and append to itab
append wa_fxqtch to it_fxqtch.

"populate fields of struture and append to itab
append wa_fxqtvb to it_fxqtvb.

"populate fields of struture and append to itab
append wa_fxapoi to it_fxapoi.

"populate fields of struture and append to itab
append wa_fyvbbe to it_fyvbbe.

"populate fields of struture and append to itab
append wa_fyvbbs to it_fyvbbs.

"populate fields of struture and append to itab
append wa_fyvbuk to it_fyvbuk.

"populate fields of struture and append to itab
append wa_fyvbup to it_fyvbup.

"populate fields of struture and append to itab
append wa_fxvbuv to it_fxvbuv.

"populate fields of struture and append to itab
append wa_fxfpla to it_fxfpla.

"populate fields of struture and append to itab
append wa_fyfpla to it_fyfpla.

"populate fields of struture and append to itab
append wa_fxfplt to it_fxfplt.

"populate fields of struture and append to itab
append wa_fyfplt to it_fyfplt.

"populate fields of struture and append to itab
append wa_fyqtvb to it_fyqtvb.

"populate fields of struture and append to itab
append wa_fvbkey to it_fvbkey.

"populate fields of struture and append to itab
append wa_fxvblb to it_fxvblb.

"populate fields of struture and append to itab
append wa_fyvblb to it_fyvblb.

"populate fields of struture and append to itab
append wa_fxvbkfz to it_fxvbkfz.

"populate fields of struture and append to itab
append wa_fyvbkfz to it_fyvbkfz.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name RV_SALES_DOCUMENT_ADD or its description.