Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bdc

Former Member
0 Likes
792

hai friends

in bdc how to upload data by using 2 transactions.

thanks

geetha

7 REPLIES 7
Read only

Former Member
0 Likes
722

there are two process.

1. record both of the transaction and process within one session.

2. use two call transaction.

Read only

0 Likes
722

Ex :

make two bdcdata table one for creating material bdcdata1 and another to change material bdcdata2.

below first call transaction will create material and the second will modify the material.

CALL TRANSACTION 'MM01'  USING BDCDATA1  MODE 'N' 
                         MESSAGES INTO ITAB. 
CALL TRANSACTION 'MM02'  USING BDCDATA2  MODE 'N' 
                         MESSAGES INTO ITAB.

Read only

Former Member
0 Likes
722

Use two different call transaction statements!! one after the other

after the first call transaction refresh the BDC table and repopulate it , then call the next transaction

u may need to have a check after the first call transaction for success .. and only then call the next transaction

reward if helpful

Read only

Former Member
0 Likes
722

Hi,


hi Check out this sample code to use session method 



REPORT  ztest_report
 NO STANDARD PAGE HEADING
                        LINE-SIZE 255
                        MESSAGE-ID ZRASH.
 
************************************************************************
*                 Internal Table Declarations                          *
************************************************************************
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
         KUNNR(10),
         BUKRS(4),
         KTOKD(4),
         ANRED(15),
         NAME1(35),
         SORTL(10),
         STRAS(35),
         ORT01(35),
         PSTLZ(10),
         LAND1(3),
         SPRAS(2),
         AKONT(10),
       END OF IT_FFCUST.
 
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
         KUNNR(10),
         EMSG(255),
       END OF IT_ERRCUST.
 
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
         KUNNR(10),
         SMSG(255),
       END OF IT_SUCCUST.
 
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
 
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
 
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
       V_TLINES LIKE SY-TABIX,
       "For storing total records processed.
       V_ELINES LIKE SY-TABIX,
       "For storing the no of error records.
       V_SLINES LIKE SY-TABIX.
       "For storing the no of success records.
 
 
************************************************************************
*          Selection screen                                            *
************************************************************************
 
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
             V_SESNAM  LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
 
************************************************************************
*          Start-of-selection                                          *
************************************************************************
 
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
  PERFORM FORM_UPLOADFF.
 
************************************************************************
*        TOP-OF-PAGE                                                   *
************************************************************************
TOP-OF-PAGE.
  WRITE:/ 'Details of the error and success records for the transaction'
  .
  ULINE.
  SKIP.
 
 
************************************************************************
*          End of Selection                                            *
************************************************************************
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
  PERFORM FORM_BDCGENERATE.
 
*--To write the totals and the session name.
  PERFORM FORM_WRITEOP.
 
 
 
*&---------------------------------------------------------------------*
*&      Form  form_uploadff
*&---------------------------------------------------------------------*
*     Form to upload flatfile data into the internal table.
*----------------------------------------------------------------------*
FORM FORM_UPLOADFF .
 
*--Variable to change the type of the parameter file name.
  DATA : LV_FILE TYPE STRING.
 
  LV_FILE = V_FNAME.
 
*--Function to upload the flat file to the internal table.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      =  LV_FILE
*     FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = 'X'
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = 'X'
*     DAT_MODE                      = ' '
*   IMPORTING
*     FILELENGTH                    =
*     HEADER                        =
    TABLES
      DATA_TAB                      = IT_FFCUST
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
            .
  IF SY-SUBRC = 0.
*--Deleting the headings from the internal table.
    DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
    DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
 
  ENDIF.
 
 
ENDFORM.                    " form_uploadff
*&---------------------------------------------------------------------*
*&      Form  Form_bdcgenerate
*&---------------------------------------------------------------------*
*     Form to Generate a BDC from the Uploaded Internal table
*----------------------------------------------------------------------*
FORM FORM_BDCGENERATE .
 
*--Generating the BDC table for the fields of the internal table.
  LOOP AT IT_FFCUST.
    PERFORM POPULATEBDC USING :
                                'X' 'SAPMF02D' '0105',
                                ' ' 'BDC_OKCODE'  '/00' ,
                                ' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
                                ' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
                                ' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
                                'X' 'SAPMF02D' '0110' ,
                                ' ' 'BDC_OKCODE'  '/00',
                                ' ' 'KNA1-ANRED'  IT_FFCUST-ANRED,
                                ' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
                                ' ' 'KNA1-SORTL'  IT_FFCUST-SORTL,
                                ' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
                                ' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
                                ' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
                                ' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
                                ' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
 
                                'X' 'SAPMFO2D' '0120',	
                                ' ' 'BDC_OKCODE'  '/00',
 
                                'X' 'SAPMF02D' '0125',	
                                ' ' 'BDC_OKCODE'  '/00',
 
                                'X' 'SAPMF02D' '0130',	
                                ' ' 'BDC_OKCODE'  '=ENTR',
 
                                'X' 'SAPMF02D' '0340',	
                                ' ' 'BDC_OKCODE'  '=ENTR',
 
                                'X' 'SAPMF02D' '0360',
                                ' ' 'BDC_OKCODE'  '=ENTR',
 
                                'X' 'SAPMF02D' '0210',	
                                ' ' 'KNB1-AKONT'  IT_FFCUST-AKONT,
                                ' ' 'BDC_OKCODE'  '/00',
 
                                'X' 'SAPMF02D' '0215',
                                ' ' 'BDC_OKCODE'  '/00',
 
                                'X' 'SAPMF02D' '0220',	
                                ' ' 'BDC_OKCODE'  '/00',
 
                                'X' 'SAPMF02D' '0230',	
                                ' ' 'BDC_OKCODE'  '=UPDA'.
*--Calling the transaction 'fd01'.
    CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
    MESSAGES INTO IT_CUSTMSG.
    IF SY-SUBRC <> 0.
*--Populating the error records internal table.
      IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
      APPEND IT_ERRCUST.
      CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
      IF V_FLAG1 = ' '.
        PERFORM FORM_OPENSESSION.
        V_FLAG1 = 'X'.
      ENDIF.
*--Inserting the error records into already open session.
      IF V_FLAG1 = 'X'.
        PERFORM FORM_INSERT.
      ENDIF.
*--Populating the Success records internal table.
    ELSE.
      IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
      APPEND IT_SUCCUST.
      CLEAR IT_SUCCUST.
    ENDIF.
*--Displaying the messages.
    IF NOT IT_CUSTMSG[] IS INITIAL.
      PERFORM FORM_FORMATMSG.
    ENDIF.
*--Clearing the message and bdc tables.
    CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
  ENDLOOP.
 
*--Getting the total no of error records.
  DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
 
*--Getting the total no of successful records.
  DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
 
*--Closing the session only if it is open.
  IF V_FLAG1 = 'X'.
    PERFORM FORM_CLOSESESS.
  ENDIF.
 
 
ENDFORM.                    " Form_bdcgenerate
 
 
*&---------------------------------------------------------------------*
*&      Form  populatebdc
*&---------------------------------------------------------------------*
*       FOrm to Populate the BDC table.
*----------------------------------------------------------------------*
FORM POPULATEBDC  USING    VALUE(P_0178)
                           VALUE(P_0179)
                           VALUE(P_0180).
 
  IF P_0178 = 'X'.
    IT_CUSTBDC-PROGRAM = P_0179.
    IT_CUSTBDC-DYNPRO = P_0180.
    IT_CUSTBDC-DYNBEGIN = 'X'.
  ELSE.
    IT_CUSTBDC-FNAM = P_0179.
    IT_CUSTBDC-FVAL = P_0180.
  ENDIF.
 
  APPEND IT_CUSTBDC.
  CLEAR IT_CUSTBDC.
 
 
ENDFORM.                    " populatebdc
 
 
*&---------------------------------------------------------------------*
*&      Form  FORM_OPENSESSION
*&---------------------------------------------------------------------*
*       Form to Open a session.
*----------------------------------------------------------------------*
FORM FORM_OPENSESSION .
 
*--Variable to convert the given session name into reqd type.
  DATA : LV_SESNAM(12).
 
  LV_SESNAM = V_SESNAM.
 
*--Opening a session.
  CALL FUNCTION 'BDC_OPEN_GROUP'
   EXPORTING
     CLIENT                    = SY-MANDT
     GROUP                     = LV_SESNAM
     HOLDDATE                  = '20040805'
     KEEP                      = 'X'
     USER                      = SY-UNAME
     PROG                      = SY-CPROG
*  IMPORTING
*    QID                       =
   EXCEPTIONS
     CLIENT_INVALID            = 1
     DESTINATION_INVALID       = 2
     GROUP_INVALID             = 3
     GROUP_IS_LOCKED           = 4
     HOLDDATE_INVALID          = 5
     INTERNAL_ERROR            = 6
     QUEUE_ERROR               = 7
     RUNNING                   = 8
     SYSTEM_LOCK_ERROR         = 9
     USER_INVALID              = 10
     OTHERS                    = 11
            .
  IF SY-SUBRC <> 0.
    WRITE :/ 'Session not open'.
  ENDIF.
 
 
ENDFORM.                    " FORM_OPENSESSION
*&---------------------------------------------------------------------*
*&      Form  FORM_INSERT
*&---------------------------------------------------------------------*
*       fORM TO INSERT ERROR RECOED INTO A SESSION.
*----------------------------------------------------------------------*
FORM FORM_INSERT .
 
*--Inserting the record into session.
  CALL FUNCTION 'BDC_INSERT'
    EXPORTING
      TCODE                  = 'FD01'
*     POST_LOCAL             = NOVBLOCAL
*     PRINTING               = NOPRINT
*     SIMUBATCH              = ' '
*     CTUPARAMS              = ' '
    TABLES
      DYNPROTAB              = IT_CUSTBDC
    EXCEPTIONS
      INTERNAL_ERROR         = 1
      NOT_OPEN               = 2
      QUEUE_ERROR            = 3
      TCODE_INVALID          = 4
      PRINTING_INVALID       = 5
      POSTING_INVALID        = 6
      OTHERS                 = 7
            .
  IF SY-SUBRC <> 0.
    WRITE :/ 'Unable to insert the record'.
  ENDIF.
 
 
ENDFORM.                    " FORM_INSERT
*&---------------------------------------------------------------------*
*&      Form  FORM_CLOSESESS
*&---------------------------------------------------------------------*
*       Form to Close the Open Session.
*----------------------------------------------------------------------*
FORM FORM_CLOSESESS .
 
 
  CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
      NOT_OPEN    = 1
      QUEUE_ERROR = 2
      OTHERS      = 3.
  IF SY-SUBRC <> 0.
  ENDIF.
 
 
 
ENDFORM.                    " FORM_CLOSESESS
*&---------------------------------------------------------------------*
*&      Form  FORM_FORMATMSG
*&---------------------------------------------------------------------*
*       Form to format messages.
*----------------------------------------------------------------------*
FORM FORM_FORMATMSG .
 
*--Var to store the formatted msg.
  DATA : LV_MSG(255).
 
 
  CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
      ID        = SY-MSGID
      LANG      = SY-LANGU
      NO        = SY-MSGNO
      V1        = SY-MSGV1
      V2        = SY-MSGV2
      V3        = SY-MSGV3
      V4        = SY-MSGV4
    IMPORTING
      MSG       = LV_MSG
    EXCEPTIONS
      NOT_FOUND = 1
      OTHERS    = 2.
  IF SY-SUBRC = 0.
 
    WRITE :/ LV_MSG.
 
  ENDIF.
  ULINE.
 
 
ENDFORM.                    " FORM_FORMATMSG
*&---------------------------------------------------------------------*
*&      Form  form_writeop
*&---------------------------------------------------------------------*
*       To write the totals and the session name.
*----------------------------------------------------------------------*
FORM FORM_WRITEOP .
 
  WRITE :/ 'Total Records Uploaded :',V_TLINES,
           / 'No of Error Records :',V_ELINES,
           / 'No of Success Records :',V_SLINES,
           / 'Name of the Session :',V_SESNAM.
  ULINE.
 
ENDFORM.                    " form_writeop


REgards,

Vasanth

Read only

Former Member
0 Likes
722

Hi Geetha,

Record both the tranastions and process one after another.

e.g.

call transaction 'VA01' using i_bdcdata mode 'N'.

refresh i_bdcdata.

call call transaction 'VA02' using i_bdcdata mode 'N'.

rewards points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
722

Use below code ,it is dialog program and it creates sales order and then Delivery and the Billing document.

so we can use multiple transaction load the data using bdc.

PROCESS BEFORE OUTPUT.

MODULE status_9000.

LOOP AT t_tcdata WITH CONTROL t_tc CURSOR t_tc-current_line.

ENDLOOP.

PROCESS AFTER INPUT.

CHAIN.

FIELD VBAK-vdatu MODULE validate_date.

FIELD g_kunnr1 MODULE validate_cuts1.

FIELD g_kunnr2 MODULE validate_cuts2.

field g_zzjp_remarks module validate_remarks.

" ON INPUT

ENDCHAIN.

LOOP AT t_tcdata. " Looping the internal table

CHAIN.

FIELD t_tcdata-matnr MODULE validate_matnr.

FIELD t_tcdata-kdmat MODULE validate_kdmat.

FIELD t_tcdata-kwmeng MODULE validate_quan.

FIELD t_tcdata-charg MODULE validate_charg .

ENDCHAIN.

MODULE table_modify.

ENDLOOP.

MODULE user_command_9000. " Processes User Command in Screen 9000

MODULE clear_okcode. " Initializing the ok_code

MODULE exit AT EXIT-COMMAND. " Exit Command for Screen 9000

----


  • INCLUDE MZJPV327F01 *

----


&----


*& Form F_BDC_PRG

&----


  • This is for Processing of Sales ordewr ,Delivery and Billing Through

  • BDC *

----


FORM f_bdc_prg.

  • --VA01 transaction.--(1)

************************************************************************

  • Populating the BDCDATA structure(screen related) *

  • for the screen '0101'. *

************************************************************************

REFRESH t_bdcdata.

PERFORM f_bdc_dynpro USING 'SAPMV45A' '0101'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'VBAK-AUART'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM f_bdc_field USING 'VBAK-AUART' c_auart.

PERFORM f_bdc_field USING 'VBAK-VKORG' c_vkorg.

PERFORM f_bdc_field USING 'VBAK-VTWEG' c_vtweg.

PERFORM f_bdc_field USING 'VBAK-SPART' c_spart.

************************************************************************

  • Populating the BDCDATA structure(screen related) *

  • for the screen '4001'. *

************************************************************************

PERFORM f_bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=KBES'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'KUWEV-KUNNR'.

PERFORM f_bdc_field USING 'KUWEV-KUNNR' g_kunnr1.

WRITE: VBAK-vdatu TO VBAK-vdatu.

PERFORM f_bdc_field USING 'RV45A-KETDAT' VBAK-vdatu.

PERFORM f_bdc_field USING 'VBAK-AUGRU' c_augru.

IF t_tcdata-matnr IS INITIAL AND NOT t_tcdata-kdmat IS INITIAL.

SELECT matnr zjd_touitsumatnr FROM mara INTO TABLE t_kdmat.

sort t_kdmat by matnr.

LOOP AT t_kdmat.

READ TABLE t_kdmat WITH KEY zjd_touitsumatnr+3(5) = t_tcdata-kdmat.

IF SY-SUBRC = 0.

g_matnr = t_kdmat-MATNR.

exit.

ENDIF.

ENDLOOP.

g_ctr = 0.

LOOP AT t_tcdata.

g_ctr = g_ctr + 01.

CONCATENATE c_matnr '( ' g_ctr ' ) ' INTO g_mabnr.

PERFORM f_bdc_field USING g_mabnr g_matnr. "t_tcdata-matnr..

CONCATENATE c_kdmat '( ' g_ctr ' ) ' INTO g_kdmat.

PERFORM f_bdc_field USING g_kdmat t_tcdata-kdmat.

CONCATENATE c_kwmeng '( ' g_ctr ' ) ' INTO g_kwmeng.

PERFORM f_bdc_field USING g_kwmeng t_tcdata-kwmeng.

CONCATENATE c_charg '( ' g_ctr ' ) ' INTO g_charg.

PERFORM f_bdc_field USING g_charg t_tcdata-charg.

ENDLOOP.

ELSE.

g_ctr = 0.

LOOP AT t_tcdata.

g_ctr = g_ctr + 01.

CONCATENATE c_matnr '( ' g_ctr ' ) ' INTO g_mabnr.

PERFORM f_bdc_field USING g_mabnr t_tcdata-matnr.

CONCATENATE c_kdmat '( ' g_ctr ' ) ' INTO g_kdmat.

PERFORM f_bdc_field USING g_kdmat t_tcdata-kdmat.

CONCATENATE c_kwmeng '( ' g_ctr ' ) ' INTO g_kwmeng.

PERFORM f_bdc_field USING g_kwmeng t_tcdata-kwmeng.

CONCATENATE c_charg '( ' g_ctr ' ) ' INTO g_charg.

PERFORM f_bdc_field USING g_charg t_tcdata-charg.

ENDLOOP.

ENDIF.

PERFORM f_bdc_dynpro USING 'SAPMV45A' '4002'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '/EBACK'.

IF vbkd-bsark = space .

PERFORM f_bdc_field USING 'BDC_CURSOR' 'VBKD-BSARK'.

PERFORM f_bdc_field USING 'VBKD-BSARK' c_bsark.

ENDIF.

PERFORM f_bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=KZKU'.

PERFORM f_bdc_dynpro USING 'SAPMV45A' '4002'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=SICH'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'VBAK-ZZJP_REMARKS'.

PERFORM f_bdc_field USING 'VBAK-ZZJP_REMARKS' g_zzjp_remarks.

*Calling Va01 Transaction code

CALL TRANSACTION c_va01 USING t_bdcdata MODE C_N MESSAGES INTO

t_bdcmsg.

IF sy-subrc NE 0.

SET SCREEN 9000.

CLEAR : VBAK-vdatu,

g_kunnr1,

g_kunnr2,

g_zzjp_remarks.

clear g_matnr.

clear t_kdmat.

REFRESH t_tcdata.

MESSAGE e000 WITH 'Could not register order document'(t16).

ENDIF.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

v2 = sy-msgv2

IMPORTING

msg = g_vbeln

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

g_vbeln = sy-msgv2.

ENDIF.

----


  • VL10 Transaction *

----


IF NOT g_vbeln IS INITIAL.

PERFORM f_create_delivery.

ELSE.

SET SCREEN 9000.

REFRESH t_tcdata.

CLEAR: VBAK-vdatu,

g_kunnr1,

g_kunnr2,

g_zzjp_remarks.

ENDIF.

ENDFORM. " F_BDC_PRG

&----


*& Form F_CREATE_DELIVERY

&----


  • Creation of Delivery

----


FORM f_create_delivery.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = g_vbeln

IMPORTING

output = g_vbeln.

  • Getting plant

WAIT UP TO 2 SECONDS.

SELECT SINGLE WERKS FROM VBAP INTO G_WERKS WHERE VBELN = G_VBELN.

REFRESH: t_bdcmsg,t_bdcdata.

----


  • Getting shipping point

----


PERFORM f_bdc_dynpro USING 'RVV50R10C'

'1000'.

PERFORM f_bdc_field USING 'BDC_CURSOR'

'ST_LEDAT-HIGH'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=S0S_TAB2'.

PERFORM f_bdc_field USING 'ST_LEDAT-LOW'

''.

PERFORM f_bdc_field USING 'ST_LEDAT-HIGH'

''.

PERFORM f_bdc_dynpro USING 'RVV50R10C'

'1000'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=ONLI'.

PERFORM f_bdc_field USING 'BDC_CURSOR'

'ST_VBELN-LOW'.

PERFORM f_bdc_field USING 'ST_VBELN-LOW'

g_vbeln.

PERFORM f_bdc_dynpro USING 'SAPLSLVC_FULLSCREEN'

'0500'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=&ALL'.

PERFORM f_bdc_dynpro USING 'SAPLSLVC_FULLSCREEN'

'0500'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=SAMD'.

PERFORM f_bdc_dynpro USING 'SAPLSLVC_FULLSCREEN'

'0500'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=&F03'.

PERFORM f_bdc_dynpro USING 'RVV50R10C'

'1000'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'/EE'.

PERFORM f_bdc_field USING 'BDC_CURSOR'

'ST_VSTEL-LOW'.

WAIT UP TO 5 SECONDS.

CALL TRANSACTION c_vl10 USING t_bdcdata MODE C_N

MESSAGES INTO t_bdcmsg.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'Could not register the order document'(t16).

ENDIF.

SELECT SINGLE vbeln FROM lips INTO g_vbeln1

WHERE vgbel = g_vbeln.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = g_vbeln1

IMPORTING

OUTPUT = g_vbeln1

.

IF NOT g_vbeln1 IS INITIAL.

PERFORM f_post_create.

ELSE.

SET SCREEN 9000.

CLEAR : g_kunnr1,

g_kunnr2,

VBAK-vdatu,

t_tcdata,

g_zzjp_remarks.

ENDIF.

ENDFORM. " F_CREATE_DELIVERY

&----


*& Form F_POST_CREATE

&----


  • Creation of vl02n tcode

----


FORM f_post_create.

refresh t_bdcdata.

refresh t_bdcmsg.

PERFORM f_bdc_dynpro USING 'SAPMV50A' '4004'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'LIKP-VBELN'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=WABU_T'.

PERFORM f_bdc_field USING 'LIKP-VBELN' g_vbeln1.

CALL TRANSACTION c_vl02n USING t_bdcdata MODE C_N

messages into t_bdcmsg.

IF NOT g_vbeln1 IS INITIAL.

PERFORM f_billing_docu.

ELSE.

SET SCREEN 9000.

CLEAR : g_kunnr1,

g_kunnr2,

VBAK-vdatu,

g_zzjp_remarks,

t_tcdata.

ENDIF.

ENDFORM. " F_POST_CREATE

**&----


*

**& Form F_BILLING_DOCU

**&----


*

    • Creation of Billing Document (VF01)

**----


FORM f_billing_docu.

REFRESH t_bdcdata.

refresh t_bdcmsg.

PERFORM f_bdc_dynpro USING 'SAPMV60A' '0102'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'KOMFK-VBELN(01)'.

PERFORM f_bdc_field USING 'KOMFK-VBELN(01)' g_vbeln1.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=FAKT'.

PERFORM f_bdc_dynpro USING 'SAPMV60A' '0104'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=SICH'.

CALL TRANSACTION c_vf01 USING t_bdcdata MODE C_N

MESSAGES INTO t_bdcmsg .

IF sy-subrc NE 0.

MESSAGE e000 WITH 'could not register Dispatch document'(t17).

ENDIF.

CLEAR g_vbeln.

CLEAR g_vbeln1.

REFRESH t_bdcmsg.

PERFORM f_create_sales.

ENDFORM. " F_BILLING_DOCU

**&----


*

**& Form F_CREATE_SALES

**&----


*

    • Creation of Sales order with ZJPB Order type

**----


FORM f_create_sales.

    • --VA01 transaction.--(1)

************************************************************************

*

    • Populating the BDCDATA structure(screen related)

*

    • for the screen '0101'.

*

************************************************************************

*

*

REFRESH t_bdcdata.

PERFORM f_bdc_dynpro USING 'SAPMV45A' '0101'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=ENT2'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'VBAK-AUART'.

PERFORM f_bdc_field USING 'VBAK-AUART' c_auart1.

PERFORM f_bdc_field USING 'VBAK-VKORG' c_vkorg.

PERFORM f_bdc_field USING 'VBAK-VTWEG' c_vtweg.

PERFORM f_bdc_field USING 'VBAK-SPART' c_spart.

***********************************************************************

  • Populating the BDCDATA structure(screen related)

  • for the screen '4001'.

***********************************************************************

PERFORM f_bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=SICH'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'KUWEV-KUNNR'.

PERFORM f_bdc_field USING 'KUWEV-KUNNR' g_kunnr2.

PERFORM f_bdc_field USING 'VBKD-BSTKD' c_bstkd.

PERFORM f_bdc_field USING 'RV45A-KETDAT' VBAK-vdatu.

PERFORM f_bdc_field USING 'VBAK-AUGRU' c_augru.

IF t_tcdata-matnr IS INITIAL AND NOT t_tcdata-kdmat IS INITIAL.

SELECT matnr zjd_touitsumatnr FROM mara INTO TABLE t_kdmat.

sort t_kdmat by matnr.

LOOP AT t_kdmat.

READ TABLE t_kdmat WITH KEY zjd_touitsumatnr+3(5) = t_tcdata-kdmat.

IF SY-SUBRC = 0.

g_matnr = t_kdmat-MATNR.

exit.

ENDIF.

ENDLOOP.

LOOP AT t_tcdata.

g_ctr = g_ctr + 01.

CONCATENATE c_matnr '( ' g_ctr ' ) ' INTO g_mabnr.

PERFORM f_bdc_field USING g_mabnr g_matnr.

CONCATENATE c_kdmat '( ' g_ctr ' ) ' INTO g_kdmat.

PERFORM f_bdc_field USING g_kdmat t_tcdata-kdmat.

CONCATENATE c_kwmeng '( ' g_ctr ' ) ' INTO g_kwmeng.

PERFORM f_bdc_field USING g_kwmeng t_tcdata-kwmeng.

CONCATENATE c_charg '( ' g_ctr ' ) ' INTO g_charg.

PERFORM f_bdc_field USING g_charg t_tcdata-charg.

CONCATENATE C_WERKS '(' G_CTR')' INTO G_WERKS1.

PERFORM F_BDC_FIELD USING G_WERKS1 G_WERKS.

ENDLOOP.

ELSE.

g_ctr = 0.

LOOP AT t_tcdata.

g_ctr = g_ctr + 01.

CONCATENATE c_matnr '( ' g_ctr ' ) ' INTO g_mabnr.

PERFORM f_bdc_field USING g_mabnr t_tcdata-matnr.

CONCATENATE c_kdmat '( ' g_ctr ' ) ' INTO g_kdmat.

PERFORM f_bdc_field USING g_kdmat t_tcdata-kdmat.

CONCATENATE c_kwmeng '( ' g_ctr ' ) ' INTO g_kwmeng.

PERFORM f_bdc_field USING g_kwmeng t_tcdata-kwmeng.

CONCATENATE c_charg '( ' g_ctr ' ) ' INTO g_charg.

PERFORM f_bdc_field USING g_charg t_tcdata-charg.

CONCATENATE C_WERKS '(' G_CTR')' INTO G_WERKS1.

PERFORM F_BDC_FIELD USING G_WERKS1 G_WERKS.

ENDLOOP.

ENDIF.

wait up to 5 seconds.

CALL TRANSACTION c_va01 USING t_bdcdata MODE C_N MESSAGES INTO

t_bdcmsg.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'Could not register order document'(t16).

ENDIF.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

v2 = sy-msgv2

IMPORTING

msg = g_vbeln

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

g_vbeln = sy-msgv2.

ENDIF.

REFRESH t_bdcmsg.

clear g_matnr.

clear t_kdmat.

IF NOT g_vbeln IS INITIAL.

PERFORM f_create_delivery1.

ELSE.

SET SCREEN 9000.

REFRESH t_tcdata.

CLEAR: VBAK-vdatu,

g_kunnr1,

g_kunnr2,

g_zzjp_remarks.

ENDIF.

ENDFORM. " F_CREATE_SALES

**&----


*

**& Form F_BILLING_DOCU1

**&----


*

    • Creation of Billing Document (VF01)

**----


FORM f_billing_docu1.

REFRESH t_bdcdata.

PERFORM f_bdc_dynpro USING 'SAPMV60A' '0102'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'KOMFK-VBELN(01)'.

PERFORM f_bdc_field USING 'KOMFK-VBELN(01)' g_vbeln1.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=FAKT'.

PERFORM f_bdc_dynpro USING 'SAPMV60A' '0104'.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=SICH'.

wait up to 5 seconds.

CALL TRANSACTION c_vf01 USING t_bdcdata MODE c_n

MESSAGES INTO t_bdcmsg .

IF sy-subrc NE 0.

MESSAGE e000 WITH 'could not register Dispatch document'(t17).

ENDIF.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

v2 = sy-msgv2

IMPORTING

msg = g_text.

MOVE g_text TO g_zzjp_remarks.

CLEAR: g_vbeln,

g_werks.

REFRESH t_bdcmsg.

SET SCREEN 9000.

REFRESH t_tcdata.

CLEAR: VBAK-vdatu,

g_kunnr1,

g_zzjp_remarks,

g_kunnr2.

ENDFORM. " F_BILLING_DOCU1

**&----


*

**& Form F_BDC_DYNPRO

**&----


*

    • Routine for populating the BDCDATA structure with the

    • Screen related information

**----


*

    • p_prog is the program name to which data is passed

    • p_scrn is the screen number to which the data is passed

**----


FORM f_bdc_dynpro USING p_prog

p_scrn.

CLEAR t_bdcdata.

t_bdcdata-program = p_prog.

t_bdcdata-dynpro = p_scrn.

t_bdcdata-dynbegin = 'X'.

APPEND t_bdcdata.

ENDFORM. " F_BDC_DYNPRO

**&----


*

**& Form f_bdc_field

**&----


*

    • Routine for populating the BDCDATA structure with data

    • Fields related information.

**----


*

    • p_fnam is the field name to which value is passed

    • p_fval is the field value which is passed

**----


FORM f_bdc_field USING p_fnam

p_fval.

CLEAR t_bdcdata.

t_bdcdata-fnam = p_fnam.

t_bdcdata-fval = p_fval.

APPEND t_bdcdata.

ENDFORM. " F_BDC_FIELD

&----


*& Form f_create_delivery1

&----


  • text

----


form f_create_delivery1.

refresh t_bdcdata.

clear g_vbeln1.

*CLEAR G_VBELN.

PERFORM f_bdc_dynpro USING 'RVV50R10C'

'1000'.

PERFORM f_bdc_field USING 'BDC_CURSOR'

'ST_LEDAT-HIGH'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=S0S_TAB2'.

PERFORM f_bdc_field USING 'ST_LEDAT-LOW'

''.

PERFORM f_bdc_field USING 'ST_LEDAT-HIGH'

''.

PERFORM f_bdc_dynpro USING 'RVV50R10C'

'1000'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=ONLI'.

PERFORM f_bdc_field USING 'BDC_CURSOR'

'ST_VBELN-LOW'.

PERFORM f_bdc_field USING 'ST_VBELN-LOW'

g_vbeln.

PERFORM f_bdc_dynpro USING 'SAPLSLVC_FULLSCREEN'

'0500'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=&ALL'.

PERFORM f_bdc_dynpro USING 'SAPLSLVC_FULLSCREEN'

'0500'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=SAMD'.

perform f_bdc_dynpro using 'SAPLSHLC' '0200'.

perform f_bdc_field using 'BDC_OKCODE'

'/EEXIT'.

perform f_bdc_field using 'BDC_CURSOR'

'IOWORKFLDS-DAY03(03)'.

PERFORM f_bdc_dynpro USING 'SAPLSLVC_FULLSCREEN'

'0500'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'=&F03'.

PERFORM f_bdc_dynpro USING 'RVV50R10C'

'1000'.

PERFORM f_bdc_field USING 'BDC_OKCODE'

'/EE'.

PERFORM f_bdc_field USING 'BDC_CURSOR'

'ST_VSTEL-LOW'.

WAIT UP TO 5 SECONDS.

CALL TRANSACTION c_vl10 USING t_bdcdata MODE C_N

MESSAGES INTO t_bdcmsg.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'Could not register the order document'(t16).

ENDIF.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = g_vbeln

IMPORTING

OUTPUT = g_vbeln

.

SELECT SINGLE vbeln FROM lips INTO g_vbeln1

WHERE vgbel = g_vbeln.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = g_vbeln1

IMPORTING

OUTPUT = g_vbeln1

.

IF NOT g_vbeln1 IS INITIAL.

PERFORM f_post_create1.

ELSE.

SET SCREEN 9000.

CLEAR : g_kunnr1,

g_kunnr2,

VBAK-vdatu,

t_tcdata,

g_zzjp_remarks.

ENDIF.

endform. " f_create_delivery1

&----


*& Form f_post_create1

&----


  • VL02n transaction

----


form f_post_create1.

refresh t_bdcdata.

refresh t_bdcmsg.

PERFORM f_bdc_dynpro USING 'SAPMV50A' '4004'.

PERFORM f_bdc_field USING 'BDC_CURSOR' 'LIKP-VBELN'.

PERFORM f_bdc_field USING 'LIKP-VBELN' g_vbeln1.

PERFORM f_bdc_field USING 'BDC_OKCODE' '=WABU_T'.

CALL TRANSACTION c_vl02n USING t_bdcdata MODE C_N

messages into t_bdcmsg.

IF NOT g_vbeln1 IS INITIAL.

PERFORM f_billing_docu1.

ELSE.

SET SCREEN 9000.

CLEAR : g_kunnr1,

g_kunnr2,

VBAK-vdatu,

g_zzjp_remarks,

t_tcdata.

ENDIF.

endform. " f_post_create1

----


***INCLUDE MZJPV327I01 .

----


&----


*& Module USER_COMMAND_9000 INPUT

&----


  • This Module it to process the User actions in the screen 9000 *

  • as defined individually below *

----


MODULE user_command_9000 INPUT.

CASE g_ok_code.

----


  • When user press SAVE button then data entered in the table control *

  • defined in the screen 9000 is populated to the transction VA01 *

  • ---------------------------------------------------------------------*

WHEN 'SAVE'.

LOOP AT t_tcdata.

IF t_tcdata-charg IS INITIAL.

MESSAGE s000 WITH 'BATCH NUMBER MUST BE ENTERED'(t21).

ENDIF.

PERFORM f_bdc_prg.

ENDLOOP.

  • ---------------------------------------------------------------------*

  • When user press REVE button ,To exit for the Screen 9000

----


WHEN 'REVE'.

LEAVE TO SCREEN 000.

ENDCASE.

ENDMODULE. " USER_COMMAND_9000 INPUT

&----


*& Module table_modify INPUT

&----


  • Modifiying the table control according to the internal table.

----


MODULE table_modify INPUT.

MODIFY t_tcdata INDEX t_tc-current_line.

IF sy-subrc <> 0.

INSERT t_tcdata INDEX t_tc-current_line.

ENDIF.

ENDMODULE. " table_modify INPUT

&----


*& Module exit INPUT

&----


  • Processing the Exit commands for the screen 9000 *

----


MODULE exit INPUT.

CASE g_ok_code.

&----


*& To come back form the screen 9000. *

&----


WHEN 'BACK'.

LEAVE TO SCREEN 0.

&----


*& To exit for the screen 9000. *

&----


WHEN 'EXIT'.

LEAVE PROGRAM.

&----


*& To Cancel the program from the screen 9000. *

&----


WHEN 'CANC'.

LEAVE PROGRAM.

WHEN 'REVE'.

LEAVE TO SCREEN 000.

ENDCASE.

ENDMODULE. " exit INPUT

&----


*& Module CLEAR_OKCODE INPUT

&----


  • Clearing the Ok_Code *

----


MODULE clear_okcode INPUT.

CLEAR g_ok_code.

ENDMODULE. " CLEAR_OKCODE INPUT

&----


*& Module VALIDATE_CUTS1 INPUT

&----


  • Validation for Transfer from Code (G_Kunnr1)

----


MODULE validate_cuts1 INPUT.

IF NOT g_kunnr1 IS INITIAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = g_kunnr1

IMPORTING

output = g_kunnr1.

SELECT SINGLE kunnr ktokd brsch FROM kna1

INTO kna1

WHERE kunnr = g_kunnr1

AND ktokd = c_ktokd

AND brsch = c_brsch.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'Please enter the correct Transfer-from'(t01)

'code of special agent'(t02) .

ENDIF.

ELSE.

MESSAGE e000 WITH 'Make an entry in all required fields'(t03).

ENDIF.

ENDMODULE. " VALIDATE_CUTS1 INPUT

&----


*& Module VALIDATE_CUTS2 INPUT

&----


  • Validation for Transfer to code (G_kunnr2)

----


MODULE validate_cuts2 INPUT.

IF NOT g_kunnr2 IS INITIAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = g_kunnr2

IMPORTING

output = g_kunnr2.

SELECT SINGLE kunnr ktokd brsch FROM kna1

INTO kna1

WHERE kunnr = g_kunnr2

AND ktokd = c_ktokd

AND brsch = c_brsch.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'Please enter the correct Transfer-to'(t04)

'code of special agent'(t05).

ENDIF.

IF g_kunnr1 = g_kunnr2.

IF sy-subrc = 0.

MESSAGE e000 WITH 'Transfer-from code and Transfer-to code'(t06)

'are the same'(t07).

ENDIF.

ENDIF.

ELSE.

MESSAGE e000 WITH 'Make an entry in all required fields'(t03).

ENDIF.

ENDMODULE. " VALIDATE_CUTS2 INPUT

&----


*& Module VALIDATE_MATNR INPUT

&----


  • Validation for Material Number

----


MODULE validate_matnr INPUT.

IF NOT t_tcdata-matnr IS INITIAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = t_tcdata-matnr

IMPORTING

output = t_tcdata-matnr.

SELECT SINGLE matnr FROM mvke INTO t_tcdata-matnr

WHERE matnr EQ t_tcdata-matnr

AND vkorg EQ c_vkorg

AND vtweg EQ c_vtweg

AND mvgr2 EQ c_mvgr2.

IF sy-subrc <> 0.

MESSAGE e000 WITH 'Please enter the material code'(t08)

'for which material group is Z91'(t09).

ENDIF.

ENDIF.

ENDMODULE. " VALIDATE_MATNR INPUT

&----


*& Module VALIDATE_CHARG INPUT

&----


  • Validation for Batch Number(Charg)

----


MODULE validate_charg INPUT.

IF t_tcdata-charg IS INITIAL.

MESSAGE e000 WITH 'batch number must be entered'(t10).

ELSE.

IF NOT t_tcdata-matnr IS INITIAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = t_tcdata-charg

IMPORTING

output = t_tcdata-charg.

  • SELECT SINGLE charg FROM mcha INTO t_tcdata-charg

  • WHERE charg = t_tcdata-charg

  • AND matnr = t_tcdata-matnr.

*

  • IF sy-subrc NE 0.

*

*

  • MESSAGE e000 WITH 'The material does not belongs to'(t11)

  • 'the specified batch'(t12).

  • ENDIF.

select single charg from mcha into t_tcdata-charg

where charg = t_tcdata-charg.

IF sy-subrc NE 0.

MESSAGE e000 WITH 'The Batch no does not exist'(t21).

ENDIF.

ENDIF.

ENDIF.

ENDMODULE. " VALIDATE_CHARG INPUT

&----


*& Module VALIDATE_KDMAT INPUT

&----


  • Validation for Integrated product code (Kdmat)

----


MODULE validate_kdmat INPUT.

IF NOT t_tcdata-kdmat IS INITIAL AND NOT t_tcdata-matnr IS INITIAL.

MESSAGE e000 WITH 'Material Code and Integrated Product Code'(t13)

'can not be entered in the same time'(t14).

ENDIF.

IF NOT t_tcdata-kdmat IS INITIAL.

select single kdmat from vbap into t_tcdata-kdmat

where kdmat = t_tcdata-kdmat.

if sy-subrc ne 0.

MESSAGE e000 WITH ' integrated product code does not exist'(t15).

endif.

endif.

  • IF NOT t_tcdata-kdmat IS INITIAL.

*

  • select single zjd_touitsumatnr from mara into t_tcdata-kdmat

  • where zjd_touitsumatnr = t_tcdata-kdmat.

*

  • if mara-zjd_touitsumatnr+3(5) = t_tcdata-kdmat.

  • if sy-subrc ne 0.

  • MESSAGE e000 WITH ' integrated product code does not exist'(t15).

  • endif.

  • endif.

  • endif.

*

if t_tcdata-kdmat is initial and t_tcdata-matnr is initial.

message e000 with

'enter either of material code or integrated product code'(t20).

endif.

ENDMODULE. " VALIDATE_KDMAT INPUT

&----


*& Module validate_date INPUT

&----


  • Validation for Transfer date

----


module validate_date input.

if VBAK-vdatu is initial.

message e000 with 'Transfer date is mandatory field'(t18).

endif.

endmodule. " validate_date INPUT

&----


*& Module validate_quan INPUT

&----


  • Validation for Quantity field

----


module validate_quan input.

if t_tcdata-kwmeng = 0 or t_tcdata-kwmeng = space.

message e000 with 'Enter the quantity'(t19).

endif.

endmodule. " validate_quan INPUT

&----


*& Module validate_remarks INPUT

&----


  • Validation for Remarks

----


module validate_remarks input.

if g_zzjp_remarks is initial.

CALL FUNCTION 'ZJD_FGT009_SINGLECHAR_CHECK'

EXPORTING

BUF = G_ZZJP_REMARKS

EXCEPTIONS

NOT_SINGLECHAR_EXEPTION = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

message e000 with

'only single byte kana-alphanumeric can be entered into remarks'(t22).

endif.

ENDIF.

endmodule. " validate_remarks INPUT

&----


*& Module VALUE_BATCH INPUT

&----


  • f4 help for Batch number

----


*MODULE VALUE_BATCH INPUT.

*

*CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

  • EXPORTING

  • TABNAME = 'VBAP'

  • FIELDNAME = 'CHARG'

  • DYNPPROG = G_PROG

  • DYNPNR = '9000'

  • DYNPROFIELD = 'T_TCDATA-CHARG'.

*

*ENDMODULE. " VALUE_BATCH INPUT

----


  • INCLUDE MZJPV327O01 *

----


&----


*& Module STATUS_9000 OUTPUT

&----


  • Defining the module status for the screen 9000. *

  • When the end user clicks SAVE BUUTON, function code SAVE is *

  • triggered and data entered in the table control defined *

  • in the screen 9000 is populated to the transction VA01. *

  • The title bar is for the screen 9000 consists "Goods Transfer *

  • Recording Process *

----


MODULE STATUS_9000 OUTPUT.

SET PF-STATUS '9000'.

SET TITLEBAR 'ZJP_TITLE'.

DESCRIBE TABLE T_TCDATA LINES G_LINE.

T_TC-LINES = T_TC-LINES + 5.

ENDMODULE. " STATUS_9000 OUTPUT

&----


*& Include MZJPV327TOP *

&----


*& This TOP include is for declaring the global data. *

&----


PROGRAM SAPMZJPV327 MESSAGE-ID ZJPV001 .

----


  • Constants Declaration.

----


CONSTANTS : C_VA01 LIKE TSTC-TCODE VALUE 'VA01', " TCODE FOR VA01

  • C_VL01N LIKE TSTC-TCODE VALUE 'VL01N', " TCODE FOR VL01N

C_VF01 LIKE TSTC-TCODE VALUE 'VF01', " TCODE FOR VF01

c_vl10 like tstc-tcode value 'VL10', " tcode for VL10

c_vl02n like tstc-tcode value 'VL02N' ," tcode for VL02N

C_AUART(4) TYPE C VALUE 'ZJPA' , " Order Type

C_AUART1(4) TYPE C VALUE 'ZJPB', " Order Type

C_VKORG(4) TYPE C VALUE 'JP20', " Sales Organization

C_VTWEG(4) TYPE C VALUE 'TR', " Distribution Channel

C_SPART(2) TYPE C VALUE '01', " Division

C_AUGRU(6) TYPE C VALUE 'Z33', " Order reason

C_MATNR(11) VALUE 'RV45A-MABNR',

C_KDMAT(11) VALUE 'VBAP-KDMAT', " Material no Used by

" Customer

C_BSARK(4) VALUE 'Z020', " Customer Purchase

" Order type

c_bstkd(2) type c value '*' , " Purchase order no

C_KWMENG(12) VALUE 'RV45A-KWMENG', " Quantity

C_CHARG(11) VALUE 'VBAP-CHARG', " Batch No

C_MVGR2(3) VALUE 'Z91', " Material Group 2

C_KTOKD(4) TYPE C VALUE 'Z002', " Account Group

C_BRSCH(4) TYPE C VALUE 'JP03', " Industry Key

C_WERKS(10) TYPE C VALUE 'VBAP-WERKS'," Plant

c_n(1) type c value 'N'. " Mode

----


  • Tables *

----


TABLES : VBAK, " Sales Document: Header Data

KNA1, " Customer master

KNVV, " Customer master (Sales)

VBKD, " Purchase order

VBAP, " sales document : Item data

MARA. " Material master

----


  • Internal table to hold the data for formating in screen 9000.

----


DATA: BEGIN OF T_TCDATA OCCURS 0,

MATNR LIKE VBAP-MATNR,

KDMAT LIKE VBAP-KDMAT,

KWMENG(13) TYPE N,

CHARG LIKE VBAP-CHARG,

END OF T_TCDATA.

----


  • Internal table to hold BDC data. *

  • t_bdcdata : Internal table to store table field structure for Batch*

  • Input. *

  • t_bdcmsg : Collecting error messages in the SAP System *

----


DATA : T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

T_BDCMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

  • Internal table to Hold Customer master data

DATA : BEGIN OF T_KNA1 OCCURS 0,

KUNNR LIKE KNA1-KUNNR, " Customer No

KTOKD LIKE KNA1-KTOKD, " Account Group

BRSCH LIKE KNA1-BRSCH, " Industry Key

END OF T_KNA1.

DATA : BEGIN OF T_VBAP1 OCCURS 0,

MATNR LIKE VBAP-MATNR,

KDMAT LIKE VBAP-KDMAT,

END OF T_VBAP1.

DATA : BEGIN OF T_KDMAT OCCURS 0,

matnr like mara-matnr,

ZJD_TOUITSUMATNR LIKE MARA-ZJD_TOUITSUMATNR,

END OF T_KDMAT.

DATA : BEGIN OF T_ZJDMATNR OCCURS 0,

MATNR LIKE MARA-MATNR,

ZJD_TOUITSUMATNR LIKE MARA-ZJD_TOUITSUMATNR,

END OF T_ZJDMATNR.

DATA : BEGIN OF T_VBAP OCCURS 0,

VBELN LIKE VBAP-VBELN,

VSTEL LIKE VBAP-VSTEL,

WERKS LIKE VBAP-WERKS,

END OF T_VBAP.

  • Table Control declaration for screen 9000.

CONTROLS T_TC TYPE TABLEVIEW USING SCREEN 9000.

DATA : G_MABNR(20) TYPE C,

G_KDMAT(37) TYPE C,

G_KWMENG(16) TYPE C,

G_CHARG(20) TYPE C,

G_CTR TYPE N.

DATA : G_PROG LIKE SY-REPID.

DATA : G_KUNNR1 LIKE VBAK-KUNNR, " Variable to hold Source Customer

G_KUNNR2 LIKE VBAK-KUNNR, " Variable to hold Destination Customer

g_vdatu like vbak-vdatu, " Transfer date

G_WERKS LIKE VBAP-WERKS, " Variable to hold Plant

G_WERKS1(15) TYPE C, " Plant

G_ZZJP_REMARKS LIKE VBAK-ZZJP_REMARKS, " remarks

g_text(30) type c,

g_matnr like mara-matnr, " material number

G_OK_CODE LIKE SY-UCOMM, " Variable to hold Function codes

G_VBELN LIKE VBAP-VBELN, " variable to hold Sales Document No

G_VBELN1 LIKE LIKP-VBELN, " variable to hold Sales Document No

  • G_VSTEL LIKE VBAP-VSTEL, " Variable to Hold Shipping Point

g_remarks(30) type c, " Remarks

G_LINE TYPE I. " Variable to hold Table Control lines

reward points if it is helpful.

Thanks

Seshu

Read only

Former Member
0 Likes
722

I will suggest you to use standard function modules like BDC_INSERT etc. to execute multiple transaction codes and not to use the CALL TRANSACTION.

Regards,

Amey