This website is not affiliated with, sponsored by, or approved by SAP AG.

Change standard SAP fields/values using PERFORM

Development SAPscript/ Smartforms

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Change standard SAP fields/values using PERFORM

Postby Type O- » Wed Feb 29, 2012 12:36 pm

HI All:

We have a situation where some of the standard SAP fields/values being passed to the SAPscript form are initial. For example, when multi-level packaging is used (Progam SDPACKDR), LVBPLP-VBELN, POSNR, and VEMNG are initial. These same fields are populated when single-level packaging is used. A large number of SAPscript forms have PERFORM statements that pass these values to ABAP routines in order to get other values needed for the HU labels. Now that some plants are using multi-level packaging, their labels are not printing with all of the necessary data.

I would like to add code to the SAPscript forms that check the values of these 3 fields. If they are initial (zero, null, etc.), then I would like to use a PERFORM statement to get the appropriate values for these fields to be used in the subsequent PERFORM statements. Will SAPscript allow me to change the values in these fields directly by using them as the CHANGING parameters of the new PERFORM or will I need to do it a different way (DEFINE statement maybe)?

Code: Select all
/*   Proposed new PERFORM below
/:   PERFORM 'GET_VBELN_POSNR_VEMNG' IN PROGRAM 'ZVU_LABEL_FORM'
/:                                       USING &LVBPLP-VENUM&
/:                                       CHANGING &LVBPLP-VBELN&
/:                                       CHANGING &LVBPLP-POSNR&
/:                                       CHANGING &LVBPLP-VEMNG&
/:   ENDPERFORM.

/*   Existing PERFORM that uses the fields that are initial for multi-level packaging
/:   PERFORM 'GET_SHIP_LBL_INFO_CH' IN PROGRAM 'ZVU_LABEL_FORM'
/:                                       USING &LVBPLP-VBELN&
/:                                       USING &LVBPLP-POSNR&
/:                                       CHANGING &MAKT-MAKTX&
/:                                       CHANGING &MARC-HERKL&
/:                                       CHANGING &ZAESKD&
/:                                       CHANGING &ZVPROG&
/:                                       CHANGING &ZEIKTO&
/:                                       CHANGING &ZKNREF&
/:                                       CHANGING &ZUSR03&
/:                                       CHANGING &ZUSR04&
/:                                       CHANGING &ZUSR05&
/:                                       CHANGING &ZLOCATION&.
/:   ENDPERFORM.


I am trying to minimize the amount of SAPscript and possibly ABAP changes needed for the plants using multi-level packaging. Any and all help will be greatly appreciated. Thanks in advance for your help!
Type O-
 
Posts: 25
Joined: Fri Sep 05, 2003 5:14 pm
Location: Kentucky

Re: Change standard SAP fields/values using PERFORM

Postby Gothmog » Thu Mar 01, 2012 3:59 am

Hi,
You will be able to change the value of these fields using this PERFORM - just make sure you won't need the old values elsewhere, but since you're changing them only when they're initial, I don't think there will be a problem.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Change standard SAP fields/values using PERFORM

Postby Type O- » Fri Apr 27, 2012 3:21 pm

Thanks for the information, Gothmog!

I finally got back to working on this and am having 2 issues.

First, I can't seem to get the quantity (lv_vemng LIKE vepo-vemng) passed to the out table (CO_SET_SYMBOLS in this case). The MOVE statement isn't transferring/converting the value, but the other MOVE statements are working fine. If I change the value using the ABAP debugger, then the value is stored in the out table.
Code: Select all
FORM get_vbeln_posnr_vemng TABLES co_sym_using   STRUCTURE itcsy
                                  co_set_symbols STRUCTURE itcsy.

  DATA: BEGIN OF ls_vbco3.
          INCLUDE STRUCTURE vbco3.
  DATA: END OF ls_vbco3.

  DATA: BEGIN OF ls_vbplk.                                  "UD1K958196
          INCLUDE STRUCTURE vbplk.                          "UD1K958196
  DATA: END OF ls_vbplk.                                    "UD1K958196

  DATA: BEGIN OF ls_vbplp.
          INCLUDE STRUCTURE vbplp.
  DATA: END OF ls_vbplp.

  DATA: lt_vbplp LIKE TABLE OF ls_vbplp,
        lv_posnr LIKE vepo-posnr,
        lv_vbeln LIKE vepo-vbeln,
        lv_vemng LIKE vepo-vemng.
.
.
.
    READ TABLE co_set_symbols WITH KEY name = 'LVBPLP-VBELN'.
    IF sy-subrc = 0.
      MOVE lv_vbeln TO co_set_symbols-value.                "UD1K958202
      MODIFY co_set_symbols INDEX sy-tabix.
    ENDIF.

    READ TABLE co_set_symbols WITH KEY name = 'LVBPLP-POSNR'.
    IF sy-subrc = 0.
      MOVE lv_posnr TO co_set_symbols-value.                "UD1K958202
      MODIFY co_set_symbols INDEX sy-tabix.
    ENDIF.

    READ TABLE co_set_symbols WITH KEY name = 'LVBPLP-VEMNG'.
    IF sy-subrc = 0.
      MOVE lv_vemng TO co_set_symbols-value.                "UD1K958202
      MODIFY co_set_symbols INDEX sy-tabix.
    ENDIF.

  ENDIF.

ENDFORM.                                         "GET_VBELN_POSNR_VEMNG


Second, even though I can see that values are stored in the CO_SET_SYMBOLS table, they are not being passed back to my SAPscript form. However, if I do a print preview from transaction VL74 before I actually issue the output (print the label), the values are present in the SAPscript so that my IF statement that checks for initial values isn't even executed.
Code: Select all
/*   UD1K958194 - z558315 - 04/16/2012 - {Begins}
/:   IF &LVBPLP-VBELN& = '' AND &LVBPLP-POSNR(I)& = ''
/:     PERFORM 'GET_VBELN_POSNR_VEMNG' IN PROGRAM 'ZVU_LABEL_FORM'
/:                                          USING &VBCO3-VENUM&
/:                                          USING &VBCO3-SPRAS&
/:                                          USING &VBCO3-PARVW&
/:                                          USING &VBCO3-KUNDE&
/:                                          USING &VBCO3-PACKD&
/:                                          CHANGING &LVBPLP-VBELN&
/:                                          CHANGING &LVBPLP-POSNR&
/:                                          CHANGING &LVBPLP-VEMNG&
/:     ENDPERFORM
/:   ENDIF
/*   UD1K958194 - z558315 - 04/16/2012 - {Ends}


Please forgive any rookie ABAP/SAPscript coding mistakes as I am more or less self-taught. As always, any and all help will be greatly appreciated.
Type O-
 
Posts: 25
Joined: Fri Sep 05, 2003 5:14 pm
Location: Kentucky

Re: Change standard SAP fields/values using PERFORM

Postby SHS » Wed May 02, 2012 6:17 am

About the quantity:
You should be aware that the symbols you are returning to your form are text fields.
Therefore, make sure that you format the quantity field correctly before passing it back to your form.
Use CONDENSE or SHIFT <field> LEFT DELETING LEADING space.
This will left-justify your field.
SHS
 
Posts: 483
Joined: Mon Mar 06, 2006 3:57 am

Re: Change standard SAP fields/values using PERFORM

Postby Type O- » Wed May 02, 2012 9:21 am

Thanks, SHS! I will try that. I thought the MOVE would take care of the conversion for me (I thought both MOVE and WRITE would perform the appropriate conversion).
Type O-
 
Posts: 25
Joined: Fri Sep 05, 2003 5:14 pm
Location: Kentucky


Return to SAPscript/Smartforms

Who is online

Users browsing this forum: No registered users and 3 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.