GET ITEM DATA IN SAP ABAP
FUNCTION zrk_sales_header.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(S_VBELN) TYPE VBELN
*" TABLES
*" GT_VBAK STRUCTURE ZRKFM_TABLE123 OPTIONAL
*" EXCEPTIONS
*" ERROR
*"----------------------------------------------------------------------
* here we used table we can also used types and data types for this purpose
* TYPES: BEGIN OF ty_vbak,
* vbeln TYPE vbeln_va,
* erdat TYPE erdat,
* erzet TYPE erzet,
* ernam TYPE ernam,
* angdt TYPE angdt_v,
* bnddt TYPE bnddt,
* audat TYPE audat,
* vbtyp TYPE vbtyp,
* posnr TYPE posnr_va,
* matnr TYPE matnr,
* matkl TYPE matkl ,
* END OF ty_vbak.
* DATA: gt_vbak TYPE STANDARD TABLE OF ty_vbak,
* gs_vbak TYPE ty_vbak.
SELECT a~vbeln a~erdat a~erzet a~ernam
a~audat a~vbtyp b~posnr b~matnr b~matkl
INTO TABLE gt_vbak
FROM vbak AS a INNER JOIN vbap AS b
ON a~vbeln = b~vbeln
WHERE a~vbeln = s_vbeln.
IF sy-subcs IS NOT INITIAL.
RAISE error.
ENDIF.
ENDFUNCTION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(S_VBELN) TYPE VBELN
*" TABLES
*" GT_VBAK STRUCTURE ZRKFM_TABLE123 OPTIONAL
*" EXCEPTIONS
*" ERROR
*"----------------------------------------------------------------------
* here we used table we can also used types and data types for this purpose
* TYPES: BEGIN OF ty_vbak,
* vbeln TYPE vbeln_va,
* erdat TYPE erdat,
* erzet TYPE erzet,
* ernam TYPE ernam,
* angdt TYPE angdt_v,
* bnddt TYPE bnddt,
* audat TYPE audat,
* vbtyp TYPE vbtyp,
* posnr TYPE posnr_va,
* matnr TYPE matnr,
* matkl TYPE matkl ,
* END OF ty_vbak.
* DATA: gt_vbak TYPE STANDARD TABLE OF ty_vbak,
* gs_vbak TYPE ty_vbak.
SELECT a~vbeln a~erdat a~erzet a~ernam
a~audat a~vbtyp b~posnr b~matnr b~matkl
INTO TABLE gt_vbak
FROM vbak AS a INNER JOIN vbap AS b
ON a~vbeln = b~vbeln
WHERE a~vbeln = s_vbeln.
IF sy-subcs IS NOT INITIAL.
RAISE error.
ENDIF.
ENDFUNCTION.
Comments
Post a Comment