SAP Function Modules

WGEN_PURCHASE_ORDER_GENERATION SAP Function module







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

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


Pattern for FM WGEN_PURCHASE_ORDER_GENERATION - WGEN PURCHASE ORDER GENERATION





CALL FUNCTION 'WGEN_PURCHASE_ORDER_GENERATION' "
  EXPORTING
*   im_messg_yes_no = 'N'       " c
    im_fb_typ =                 " wauf_fb_typ
    im_prot =                   "
*   im_fbg_call = SPACE         " c
    im_add_dc_po =              " rwscreenhelp-add_dc_po
  IMPORTING
    ex_purchase_order_generated =   " c
  TABLES
    im_ex_postab =              " watfg_postab_table
    im_ex_betriebsdaten =       " watfg_zuordnung_table
    im_ex_messg =               " rw17a
    im_aupo =                   " rw01a
  CHANGING
    im_ex_ekko =                " fbg_ekko
    .  "  WGEN_PURCHASE_ORDER_GENERATION

ABAP code example for Function Module WGEN_PURCHASE_ORDER_GENERATION





The ABAP code below is a full code listing to execute function module WGEN_PURCHASE_ORDER_GENERATION 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_ex_purchase_order_generated  TYPE C ,
it_im_ex_postab  TYPE STANDARD TABLE OF WATFG_POSTAB_TABLE,"TABLES PARAM
wa_im_ex_postab  LIKE LINE OF it_im_ex_postab ,
it_im_ex_betriebsdaten  TYPE STANDARD TABLE OF WATFG_ZUORDNUNG_TABLE,"TABLES PARAM
wa_im_ex_betriebsdaten  LIKE LINE OF it_im_ex_betriebsdaten ,
it_im_ex_messg  TYPE STANDARD TABLE OF RW17A,"TABLES PARAM
wa_im_ex_messg  LIKE LINE OF it_im_ex_messg ,
it_im_aupo  TYPE STANDARD TABLE OF RW01A,"TABLES PARAM
wa_im_aupo  LIKE LINE OF it_im_aupo .

DATA(ld_im_ex_ekko) = 'Check type of data required'.
DATA(ld_im_messg_yes_no) = 'Check type of data required'.
DATA(ld_im_fb_typ) = 'Check type of data required'.
DATA(ld_im_prot) = 'some text here'.
DATA(ld_im_fbg_call) = 'Check type of data required'.

DATA(ld_im_add_dc_po) = some text here

"populate fields of struture and append to itab
append wa_im_ex_postab to it_im_ex_postab.

"populate fields of struture and append to itab
append wa_im_ex_betriebsdaten to it_im_ex_betriebsdaten.

"populate fields of struture and append to itab
append wa_im_ex_messg to it_im_ex_messg.

"populate fields of struture and append to itab
append wa_im_aupo to it_im_aupo. . CALL FUNCTION 'WGEN_PURCHASE_ORDER_GENERATION' EXPORTING * im_messg_yes_no = ld_im_messg_yes_no im_fb_typ = ld_im_fb_typ im_prot = ld_im_prot * im_fbg_call = ld_im_fbg_call im_add_dc_po = ld_im_add_dc_po IMPORTING ex_purchase_order_generated = ld_ex_purchase_order_generated TABLES im_ex_postab = it_im_ex_postab im_ex_betriebsdaten = it_im_ex_betriebsdaten im_ex_messg = it_im_ex_messg im_aupo = it_im_aupo CHANGING im_ex_ekko = ld_im_ex_ekko . " WGEN_PURCHASE_ORDER_GENERATION
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_im_ex_ekko  TYPE FBG_EKKO ,
ld_ex_purchase_order_generated  TYPE C ,
ld_im_messg_yes_no  TYPE C ,
it_im_ex_postab  TYPE STANDARD TABLE OF WATFG_POSTAB_TABLE ,
wa_im_ex_postab  LIKE LINE OF it_im_ex_postab,
ld_im_fb_typ  TYPE WAUF_FB_TYP ,
it_im_ex_betriebsdaten  TYPE STANDARD TABLE OF WATFG_ZUORDNUNG_TABLE ,
wa_im_ex_betriebsdaten  LIKE LINE OF it_im_ex_betriebsdaten,
ld_im_prot  TYPE STRING ,
it_im_ex_messg  TYPE STANDARD TABLE OF RW17A ,
wa_im_ex_messg  LIKE LINE OF it_im_ex_messg,
ld_im_fbg_call  TYPE C ,
it_im_aupo  TYPE STANDARD TABLE OF RW01A ,
wa_im_aupo  LIKE LINE OF it_im_aupo,
ld_im_add_dc_po  TYPE RWSCREENHELP-ADD_DC_PO .

ld_im_ex_ekko = 'Check type of data required'.
ld_im_messg_yes_no = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_im_ex_postab to it_im_ex_postab.
ld_im_fb_typ = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_im_ex_betriebsdaten to it_im_ex_betriebsdaten.
ld_im_prot = 'some text here'.

"populate fields of struture and append to itab
append wa_im_ex_messg to it_im_ex_messg.
ld_im_fbg_call = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_im_aupo to it_im_aupo.

ld_im_add_dc_po = some text here

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