ABAP-DBC Recording Screen

Source: Internet
Author: User

*&---------------------------------------------------------------------*
*& zxxl_mm02_01
*&---------------------------------------------------------------------*
Report zxxl_mm02_01.
INCLUDE Zxxl_mm02_01head.
INCLUDE Zxxl_mm02_01from.

Start-of-selection.
PERFORM get_date.

End-of-selection.
The Convert
PERFORM Append_bdcdata.


Zxxl_mm02_01head Program:
*&---------------------------------------------------------------------*
*& contains Zxxl_mm02_01head
*&---------------------------------------------------------------------*
Types:begin of Gty_material,
Matnr TYPE C LENGTH 18, "Item code
MAKTX TYPE C LENGTH 40, "Material description
Brgew TYPE C LENGTH 20, "gross weight
Ntgew TYPE C LENGTH 20, "net weight
Gewei TYPE C LENGTH 3, "unit
END of Gty_material.

DATA gt_material TYPE TABLE of Gty_material.
DATA gs_material TYPE gty_material.

*bdcdata defining an inner table with header rows
DATA bdcdata TYPE bdcdata occurs 0 with HEADER line.

Zxxl_mm02_01from Program:
*&---------------------------------------------------------------------*
*& contains Zxxl_mm02_01from
*&---------------------------------------------------------------------*

*----------------------------------------------------------------------*
* Start New screen *
*---------- ------------------------------------------------------------*
*&---------------------------------------- -----------------------------*
*& Form append_bdcdata
*&------------------------------------------ ---------------------------*
* Execute DBC
*-------------------------------------------------------------------- --*
~-P1 Text
* <--p2 text
*-------------------------------------------------------------------- --*
FORM Append_bdcdata.
LOOP at Gt_material to Gs_material.
CLEAR Bdcdata.
CLEAR bdcdata[].
PERFORM bdc_dynpro USING ' saplmgmm ' 0060 '.
PERFORM bdc_field USING ' bdc_cursor ' Rmmg1-matnr '.
PERFORM bdc_field USING ' bdc_okcode ' =entr '.
PERFORM bdc_field USING ' Rmmg1-matnr ' Gs_material-matnr.

PERFORM bdc_dynpro USING ' saplmgmm ' 0070 '.
PERFORM bdc_field USING ' bdc_cursor ' msichtausw-dytxt (01) '.
PERFORM bdc_field USING ' bdc_okcode ' =entr '.
PERFORM Bdc_field USING ' Msichtausw-kzsel (") ' X '.
PERFORM bdc_dynpro USING ' saplmgmm ' 4004 '.

PERFORM bdc_field USING ' bdc_okcode ' =bu '.
PERFORM bdc_field USING ' makt-maktx ' gs_material-maktx.
PERFORM bdc_field USING ' bdc_cursor ' Mara-gewei '.
PERFORM bdc_field USING ' Mara-brgew ' Gs_material-brgew.
PERFORM bdc_field USING ' Mara-gewei ' Gs_material-gewei.
PERFORM bdc_field USING ' Mara-ntgew ' Gs_material-ntgew.
"PERFORM bdc_transaction USING ' MM02 '.

Call TRANSACTION ' MM02 ' USING bdcdata
MODE ' N '. "Display mode: A; N backstage; E:
Record If successful
if SY-SUBRC <> 0.
" Log error messages for reference
EndIf.
Endloop.
EndForm. The
FORM bdc_dynpro USING program Dynpro.
CLEAR Bdcdata.
Bdcdata-program = program.
Bdcdata-dynpro = Dynpro.
Bdcdata-dynbegin = ' X '.
APPEND Bdcdata.
EndForm.

*----------------------------------------------------------------------*
* Insert field *
*------------- ---------------------------------------------------------*
FORM bdc_field USING fnam fval.
IF fval <> nodata.
CLEAR Bdcdata.
Bdcdata-fnam = Fnam.
Bdcdata-fval = fval.
APPEND Bdcdata.
ENDIF.
EndForm.
*&---------------------------------------------------------------------*
*& Form get_date
* &---------------------------------------------------------------------*
* Initialize data
*-------------------- --------------------------------------------------*
*-P1 text
* <--p2 text
*-------------------- --------------------------------------------------*
FORM get_date.
PERFORM add_material USING ' 301020015252 ' material description a ' "" "" "" G ".
PERFORM add_material USING ' 301020015261 ' material description B ' ' 260 ' G '.
PERFORM add_material USING ' 301020015262 ' material description C ' ' + ' ' G '.
EndForm.

FORM add_material USING VALUE (P_MATNR)
VALUE (P_MAKTX)
VALUE (P_brgew)
VALUE (P_ntgew)
VALUE (P_gewei).

CLEAR gs_material.
Gs_material-matnr = P_matnr.
GS_MATERIAL-MAKTX = P_maktx.
Gs_material-brgew = P_brgew.
Gs_material-ntgew = P_ntgew.
Gs_material-gewei = P_gewei.
APPEND gs_material to Gt_material.
EndForm.

ABAP-DBC Recording Screen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.