SAP Function Modules

SD_SALES_DOCUMENT_FROM_SM SAP Function module







SD_SALES_DOCUMENT_FROM_SM 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 SD_SALES_DOCUMENT_FROM_SM into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: V46H
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM SD_SALES_DOCUMENT_FROM_SM - SD SALES DOCUMENT FROM SM





CALL FUNCTION 'SD_SALES_DOCUMENT_FROM_SM' "
* EXPORTING
*   i_vbeln_v =                 " vbap-vbeln
*   i_vbeln =                   " vbap-vbeln
*   i_sdsm_header =             " sdsm_header
*   i_sdsm_main_item =          " sdsm_main_item
*   i_simulation = SPACE        " char1
*   i_xkonv_determine = SPACE   " boole_d
*   i_no_dialog = SPACE         " char1
  IMPORTING
    e_vbeln =                   " vbak-vbeln
    e_sdsm_main_item =          " sdsm_main_item
    e_komk =                    " komk
* TABLES
*   fvbpakom =                  " vbpakom
*   fsdsm_dli =                 " sdsm_dli      Table with Item Information
*   fxkonv =                    " konv          Conditions (Transaction Data)
*   fkomk =                     " komk          Communication Header for Pricing
*   fkomp =                     " komp          Communication Item for Pricing
*   fsdsm_main_item =           " sdsm_main_item  Main Item for Generating Sales Documents from Dynamic Items
*   fsales_text =               " bapisdtext    Communication Fields: SD Texts
  EXCEPTIONS
    INCONSISTENT_IMPORT_PARAMETERS = 1  "
    ERROR_OCCURRED = 2          "               An error occurred during creation
    .  "  SD_SALES_DOCUMENT_FROM_SM

ABAP code example for Function Module SD_SALES_DOCUMENT_FROM_SM





The ABAP code below is a full code listing to execute function module SD_SALES_DOCUMENT_FROM_SM 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:
ld_e_vbeln  TYPE VBAK-VBELN ,
ld_e_sdsm_main_item  TYPE SDSM_MAIN_ITEM ,
ld_e_komk  TYPE KOMK ,
it_fvbpakom  TYPE STANDARD TABLE OF VBPAKOM,"TABLES PARAM
wa_fvbpakom  LIKE LINE OF it_fvbpakom ,
it_fsdsm_dli  TYPE STANDARD TABLE OF SDSM_DLI,"TABLES PARAM
wa_fsdsm_dli  LIKE LINE OF it_fsdsm_dli ,
it_fxkonv  TYPE STANDARD TABLE OF KONV,"TABLES PARAM
wa_fxkonv  LIKE LINE OF it_fxkonv ,
it_fkomk  TYPE STANDARD TABLE OF KOMK,"TABLES PARAM
wa_fkomk  LIKE LINE OF it_fkomk ,
it_fkomp  TYPE STANDARD TABLE OF KOMP,"TABLES PARAM
wa_fkomp  LIKE LINE OF it_fkomp ,
it_fsdsm_main_item  TYPE STANDARD TABLE OF SDSM_MAIN_ITEM,"TABLES PARAM
wa_fsdsm_main_item  LIKE LINE OF it_fsdsm_main_item ,
it_fsales_text  TYPE STANDARD TABLE OF BAPISDTEXT,"TABLES PARAM
wa_fsales_text  LIKE LINE OF it_fsales_text .


SELECT single VBELN
FROM VBAP
INTO @DATA(ld_i_vbeln_v).


SELECT single VBELN
FROM VBAP
INTO @DATA(ld_i_vbeln).

DATA(ld_i_sdsm_header) = 'Check type of data required'.
DATA(ld_i_sdsm_main_item) = 'Check type of data required'.
DATA(ld_i_simulation) = 'Check type of data required'.
DATA(ld_i_xkonv_determine) = 'Check type of data required'.
DATA(ld_i_no_dialog) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fvbpakom to it_fvbpakom.

"populate fields of struture and append to itab
append wa_fsdsm_dli to it_fsdsm_dli.

"populate fields of struture and append to itab
append wa_fxkonv to it_fxkonv.

"populate fields of struture and append to itab
append wa_fkomk to it_fkomk.

"populate fields of struture and append to itab
append wa_fkomp to it_fkomp.

"populate fields of struture and append to itab
append wa_fsdsm_main_item to it_fsdsm_main_item.

"populate fields of struture and append to itab
append wa_fsales_text to it_fsales_text. . CALL FUNCTION 'SD_SALES_DOCUMENT_FROM_SM' * EXPORTING * i_vbeln_v = ld_i_vbeln_v * i_vbeln = ld_i_vbeln * i_sdsm_header = ld_i_sdsm_header * i_sdsm_main_item = ld_i_sdsm_main_item * i_simulation = ld_i_simulation * i_xkonv_determine = ld_i_xkonv_determine * i_no_dialog = ld_i_no_dialog IMPORTING e_vbeln = ld_e_vbeln e_sdsm_main_item = ld_e_sdsm_main_item e_komk = ld_e_komk * TABLES * fvbpakom = it_fvbpakom * fsdsm_dli = it_fsdsm_dli * fxkonv = it_fxkonv * fkomk = it_fkomk * fkomp = it_fkomp * fsdsm_main_item = it_fsdsm_main_item * fsales_text = it_fsales_text EXCEPTIONS INCONSISTENT_IMPORT_PARAMETERS = 1 ERROR_OCCURRED = 2 . " SD_SALES_DOCUMENT_FROM_SM
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here 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_e_vbeln  TYPE VBAK-VBELN ,
ld_i_vbeln_v  TYPE VBAP-VBELN ,
it_fvbpakom  TYPE STANDARD TABLE OF VBPAKOM ,
wa_fvbpakom  LIKE LINE OF it_fvbpakom,
ld_e_sdsm_main_item  TYPE SDSM_MAIN_ITEM ,
ld_i_vbeln  TYPE VBAP-VBELN ,
it_fsdsm_dli  TYPE STANDARD TABLE OF SDSM_DLI ,
wa_fsdsm_dli  LIKE LINE OF it_fsdsm_dli,
ld_e_komk  TYPE KOMK ,
ld_i_sdsm_header  TYPE SDSM_HEADER ,
it_fxkonv  TYPE STANDARD TABLE OF KONV ,
wa_fxkonv  LIKE LINE OF it_fxkonv,
ld_i_sdsm_main_item  TYPE SDSM_MAIN_ITEM ,
it_fkomk  TYPE STANDARD TABLE OF KOMK ,
wa_fkomk  LIKE LINE OF it_fkomk,
ld_i_simulation  TYPE CHAR1 ,
it_fkomp  TYPE STANDARD TABLE OF KOMP ,
wa_fkomp  LIKE LINE OF it_fkomp,
ld_i_xkonv_determine  TYPE BOOLE_D ,
it_fsdsm_main_item  TYPE STANDARD TABLE OF SDSM_MAIN_ITEM ,
wa_fsdsm_main_item  LIKE LINE OF it_fsdsm_main_item,
ld_i_no_dialog  TYPE CHAR1 ,
it_fsales_text  TYPE STANDARD TABLE OF BAPISDTEXT ,
wa_fsales_text  LIKE LINE OF it_fsales_text.


SELECT single VBELN
FROM VBAP
INTO ld_i_vbeln_v.


"populate fields of struture and append to itab
append wa_fvbpakom to it_fvbpakom.

SELECT single VBELN
FROM VBAP
INTO ld_i_vbeln.


"populate fields of struture and append to itab
append wa_fsdsm_dli to it_fsdsm_dli.
ld_i_sdsm_header = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fxkonv to it_fxkonv.
ld_i_sdsm_main_item = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fkomk to it_fkomk.
ld_i_simulation = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fkomp to it_fkomp.
ld_i_xkonv_determine = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fsdsm_main_item to it_fsdsm_main_item.
ld_i_no_dialog = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fsales_text to it_fsales_text.

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 SD_SALES_DOCUMENT_FROM_SM or its description.